From 8669b46de1a561fc1760554944c503ff228d8119 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Thu, 17 Oct 2024 00:25:02 +0200 Subject: [PATCH 001/175] improv cpx erf calculation --- src/hartree_fock/deb_ao_2e_int.irp.f | 102 +++++++++++++++++++- src/utils/cpx_boys.irp.f | 138 +++++++++++++++++---------- src/utils/cpx_erf.irp.f | 107 +++++++++++++++------ 3 files changed, 266 insertions(+), 81 deletions(-) diff --git a/src/hartree_fock/deb_ao_2e_int.irp.f b/src/hartree_fock/deb_ao_2e_int.irp.f index 29608603..94dc0bda 100644 --- a/src/hartree_fock/deb_ao_2e_int.irp.f +++ b/src/hartree_fock/deb_ao_2e_int.irp.f @@ -3,10 +3,11 @@ program deb_ao_2e_int implicit none - call check_ao_two_e_integral_cgtos() + !call check_ao_two_e_integral_cgtos() !call check_crint1() !call check_crint2() !call check_crint3() + call check_crint4() end @@ -344,3 +345,102 @@ subroutine check_crint3() ! --- +subroutine check_crint4() + + implicit none + + integer :: i_test, n_test + integer :: i, seed_size, clock_time + double precision :: xr(1), x, shift + double precision :: yr(1), y + double precision :: dif_re, dif_im, acc_re, nrm_re, acc_im, nrm_im + double precision :: delta_ref + double precision :: t1, t2, t_int1, t_int2 + complex*16 :: rho + complex*16 :: int1, int2, int3 + integer, allocatable :: seed(:) + + + + call random_seed(size=seed_size) + allocate(seed(seed_size)) + call system_clock(count=clock_time) + seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) + !seed = 123456789 + call random_seed(put=seed) + + + t_int1 = 0.d0 + t_int2 = 0.d0 + + n_test = 100 + shift = 15.d0 + + acc_re = 0.d0 + nrm_re = 0.d0 + acc_im = 0.d0 + nrm_im = 0.d0 + do i_test = 1, n_test + + call random_number(xr) + call random_number(yr) + + x = 1.d0 * (2.d0 * shift * xr(1) - shift) + y = 1.d0 * (2.d0 * shift * yr(1) - shift) + + rho = x + (0.d0, 1.d0) * y + + call wall_time(t1) + call zboysfun00_1(rho, int1) + call wall_time(t2) + t_int1 = t_int1 + t2 - t1 + + call wall_time(t1) + call zboysfun00_2(rho, int2) + call wall_time(t2) + t_int2 = t_int2 + t2 - t1 + + dif_re = dabs(real(int1) - real(int2)) + dif_im = dabs(aimag(int1) - aimag(int2)) + if((dif_re .gt. 1d-10) .or. (dif_im .gt. 1d-10)) then + print*, ' important error found: ' + print*, " rho = ", x, y + print*, real(int1), real(int2), dif_re + print*, aimag(int1), aimag(int2), dif_im + call crint_quad_12(0, rho, 10000000, int3) + if(zabs(int1 - int3) .lt. zabs(int2 - int3)) then + print*, ' implementation 2 seems to be wrong' + else + print*, ' implementation 1 seems to be wrong' + print*, ' quad 10000000:', real(int3), aimag(int3) + call crint_quad_12(0, rho, 100000000, int3) + print*, ' quad 100000000:', real(int3), aimag(int3) + endif + !print*, ' quad:', real(int3), aimag(int3) + !stop + endif + + if((real(int1) /= real(int1)) .or. (aimag(int1) /= aimag(int1)) .or. & + (real(int2) /= real(int2)) .or. (aimag(int2) /= aimag(int2)) ) then + cycle + else + acc_re += dif_re + acc_im += dif_im + nrm_re += dabs(real(int1)) + nrm_im += dabs(aimag(int1)) + endif + enddo + + print*, "accuracy on real part (%):", 100.d0 * acc_re / (nrm_re + 1d-15) + print*, "accuracy on imag part (%):", 100.d0 * acc_im / (nrm_im + 1d-15) + + print*, "zerf_1 wall time (sec) = ", t_int1 + print*, "zerf_2 wall time (sec) = ", t_int2 + + + deallocate(seed) + +end + +! --- + diff --git a/src/utils/cpx_boys.irp.f b/src/utils/cpx_boys.irp.f index 687433e4..acac1f6f 100644 --- a/src/utils/cpx_boys.irp.f +++ b/src/utils/cpx_boys.irp.f @@ -10,44 +10,100 @@ complex*16, intent(in) :: rho integer :: i, mmax - double precision :: rho_mod, rho_re, rho_im - double precision :: sq_rho_re, sq_rho_im - double precision :: n_tmp + double precision :: rho_mod + double precision :: tmp complex*16 :: sq_rho, rho_inv, rho_exp - complex*16 :: crint_smallz, cpx_erf_1 + complex*16 :: crint_smallz - rho_re = real (rho) - rho_im = aimag(rho) - rho_mod = dsqrt(rho_re*rho_re + rho_im*rho_im) + rho_mod = zabs(rho) + + if(rho_mod < 3.5d0) then + + if(rho_mod .lt. 0.35d0) then + + select case(n) + case(0) + crint_1 = (((((((((1.3122532963802805073d-08 * rho & + - 1.450385222315046877d-07) * rho & + + 1.458916900093370682d-06) * rho & + - 0.132275132275132275d-04) * rho & + + 0.106837606837606838d-03) * rho & + - 0.757575757575757576d-03) * rho & + + 0.462962962962962963d-02) * rho & + - 0.238095238095238095d-01) * rho & + + 0.10000000000000000000d0) * rho & + - 0.33333333333333333333d0) * rho & + + 1.0d0 + case(1) + crint_1 = (((((((((1.198144314086343d-08 * rho & + - 1.312253296380281d-07) * rho & + + 1.305346700083542d-06) * rho & + - 1.167133520074696d-05) * rho & + + 9.259259259259259d-05) * rho & + - 6.410256410256410d-04) * rho & + + 3.787878787878788d-03) * rho & + - 1.851851851851852d-02) * rho & + + 7.142857142857142d-02) * rho & + - 2.000000000000000d-01) * rho & + + 3.333333333333333d-01 + case(2) + crint_1 = (((((((((1.102292768959436d-08 * rho & + - 1.198144314086343d-07) * rho & + + 1.181027966742252d-06) * rho & + - 1.044277360066834d-05) * rho & + + 8.169934640522875d-05) * rho & + - 5.555555555555556d-04) * rho & + + 3.205128205128205d-03) * rho & + - 1.515151515151515d-02) * rho & + + 5.555555555555555d-02) * rho & + - 1.428571428571428d-01) * rho & + + 2.000000000000000d-01 + case(3) + crint_1 = (((((((((1.020641452740218d-08 * rho & + - 1.102292768959436d-07) * rho & + + 1.078329882677709d-06) * rho & + - 9.448223733938020d-06) * rho & + + 7.309941520467836d-05) * rho & + - 4.901960784313725d-04) * rho & + + 2.777777777777778d-03) * rho & + - 1.282051282051282d-02) * rho & + + 4.545454545454546d-02) * rho & + - 1.111111111111111d-01) * rho & + + 1.428571428571428d-01 + case default + tmp = dble(n + n + 1) + crint_1 = (((((((((2.755731922398589d-07 * rho / (tmp + 20.d0) & + - 2.755731922398589d-06 / (tmp + 18.d0)) * rho & + + 2.480158730158730d-05 / (tmp + 16.d0)) * rho & + - 1.984126984126984d-04 / (tmp + 14.d0)) * rho & + + 1.388888888888889d-03 / (tmp + 12.d0)) * rho & + - 8.333333333333333d-03 / (tmp + 10.d0)) * rho & + + 4.166666666666666d-02 / (tmp + 8.d0)) * rho & + - 1.666666666666667d-01 / (tmp + 6.d0)) * rho & + + 5.000000000000000d-01 / (tmp + 4.d0)) * rho & + - 1.000000000000000d+00 / (tmp + 2.d0)) * rho & + + 1.0d0 / tmp + end select - if(rho_mod < 10.d0) then - ! small z - if(rho_mod .lt. 1.d-15) then - crint_1 = 1.d0 / dble(n + n + 1) else + crint_1 = crint_smallz(n, rho) + endif else - ! large z if(rho_mod .gt. 40.d0) then - n_tmp = dble(n) + 0.5d0 - crint_1 = 0.5d0 * gamma(n_tmp) / (rho**n_tmp) + crint_1 = 0.5d0 * gamma(dble(n) + 0.5d0) / (rho**n * zsqrt(rho)) else - ! get \sqrt(rho) - sq_rho_re = sq_op5 * dsqrt(rho_re + rho_mod) - sq_rho_im = 0.5d0 * rho_im / sq_rho_re - sq_rho = sq_rho_re + (0.d0, 1.d0) * sq_rho_im - rho_exp = 0.5d0 * zexp(-rho) rho_inv = (1.d0, 0.d0) / rho - crint_1 = 0.5d0 * sqpi * cpx_erf_1(sq_rho_re, sq_rho_im) / sq_rho + call zboysfun00_1(rho, crint_1) mmax = n if(mmax .gt. 0) then do i = 0, mmax-1 @@ -56,9 +112,9 @@ endif endif - endif + return end ! --- @@ -72,27 +128,15 @@ complex*16, intent(in) :: rho, d1(0:n_pt_out) integer :: n, i, mmax - double precision :: rho_mod, rho_re, rho_im - double precision :: sq_rho_re, sq_rho_im + double precision :: rho_mod complex*16 :: sq_rho, F0 complex*16 :: rho_tmp, rho_inv, rho_exp complex*16, allocatable :: Fm(:) - complex*16 :: crint_smallz, cpx_erf_1 - + complex*16 :: crint_smallz - rho_re = real (rho) - rho_im = aimag(rho) - rho_mod = dsqrt(rho_re*rho_re + rho_im*rho_im) -! ! debug -! double precision :: d1_real(0:n_pt_out) -! double precision :: rint_sum -! do i = 0, n_pt_out -! d1_real(i) = real(d1(i)) -! enddo -! crint_sum_1 = rint_sum(n_pt_out, rho_re, d1_real) -! return + rho_mod = zabs(rho) if(rho_mod < 10.d0) then ! small z @@ -132,12 +176,7 @@ else - ! get \sqrt(rho) - sq_rho_re = sq_op5 * dsqrt(rho_re + rho_mod) - sq_rho_im = 0.5d0 * rho_im / sq_rho_re - sq_rho = sq_rho_re + (0.d0, 1.d0) * sq_rho_im - - F0 = 0.5d0 * sqpi * cpx_erf_1(sq_rho_re, sq_rho_im) / sq_rho + call zboysfun00_1(rho, F0) crint_sum_1 = F0 * d1(0) rho_exp = 0.5d0 * zexp(-rho) @@ -219,15 +258,16 @@ integer, intent(in) :: n complex*16, intent(in) :: rho - double precision :: tmp - complex*16 :: rho2 + double precision :: tmp, abs_rho complex*16 :: vals(0:n) complex*16, external :: crint_smallz - if(abs(rho) < 3.5d0) then + abs_rho = zabs(rho) - if(abs(rho) .lt. 0.35d0) then + if(abs_rho < 3.5d0) then + + if(abs_rho .lt. 0.35d0) then select case(n) case(0) @@ -343,7 +383,7 @@ subroutine zboysfun(n_max, x, vals) integer :: n complex*16 :: yy, x_inv - call zboysfun00(x, vals(0)) + call zboysfun00_2(x, vals(0)) yy = 0.5d0 * zexp(-x) x_inv = (1.d0, 0.d0) / x @@ -434,7 +474,7 @@ subroutine crint_2_vec(n_max, rho, vals) integer :: n double precision :: tmp, abs_rho - complex*16 :: rho2, rho3, erho + complex*16 :: erho abs_rho = abs(rho) @@ -855,8 +895,6 @@ subroutine crint_quad_12_vec(n_max, rho, vals) complex*16, intent(out) :: vals(0:n_max) integer :: n - double precision :: tmp, abs_rho - complex*16 :: rho2, rho3, erho do n = 0, n_max call crint_quad_12(n, rho, 10000000, vals(n)) diff --git a/src/utils/cpx_erf.irp.f b/src/utils/cpx_erf.irp.f index 914a5157..6afac49e 100644 --- a/src/utils/cpx_erf.irp.f +++ b/src/utils/cpx_erf.irp.f @@ -1,6 +1,37 @@ ! --- +subroutine zboysfun00_1(rho, F0) + + implicit none + + include 'constants.include.F' + + complex*16, intent(in) :: rho + complex*16, intent(out) :: F0 + + double precision :: rho_re, rho_im, rho_mod + double precision :: sq_rho_re, sq_rho_im + complex*16 :: sq_rho + + complex*16, external :: cpx_erf_1 + + + rho_re = real(rho) + rho_im = aimag(rho) + rho_mod = dsqrt(rho_re*rho_re + rho_im*rho_im) + + sq_rho_re = sq_op5 * dsqrt(rho_re + rho_mod) + sq_rho_im = 0.5d0 * rho_im / sq_rho_re + sq_rho = sq_rho_re + (0.d0, 1.d0) * sq_rho_im + + F0 = 0.5d0 * sqpi * cpx_erf_1(sq_rho_re, sq_rho_im) / sq_rho + + return +end + +! --- + complex*16 function cpx_erf_1(x, y) BEGIN_DOC @@ -43,6 +74,7 @@ cpx_erf_1 = conjg(erf_tot) endif + return end ! --- @@ -54,22 +86,42 @@ double precision, intent(in) :: x, yabs - if((dabs(x).gt.6.d0) .or. (x==0.d0)) then + double precision :: xy + + + if(dabs(x) .gt. 6.d0) then erf_E = (0.d0, 0.d0) return endif - if(dabs(x) .lt. 1.d-7) then + xy = x * yabs + + if(dabs(xy) .lt. 0.1d0) then + + erf_E = ((((((((((((-(0.d0, 9.3968347936601903d-8) * xy + (6.5777843555621328d-7, 0.d0) & + ) * xy + (0.d0, 4.2755598311153869d-6) & + ) * xy - (2.5653358986692322d-5, 0.d0) & + ) * xy - (0.d0, 0.00014109347442680775d0) & + ) * xy + (0.00070546737213403885d0, 0.d0) & + ) * xy + (0.d0, 0.0031746031746031746d0) & + ) * xy - (0.012698412698412698d0, 0.d0) & + ) * xy - (0.d0, 0.044444444444444446d0) & + ) * xy + (0.13333333333333333d0, 0.d0) & + ) * xy + (0.d0, 0.33333333333333331d0) & + ) * xy - (0.66666666666666663d0, 0.d0) & + ) * xy - (0.d0, 1.d0) & + ) * xy + (1.d0, 0.d0) - erf_E = -inv_pi * (0.d0, 1.d0) * yabs + erf_E = erf_E * (0.d0, 1.d0) * yabs * inv_pi * dexp(-x*x) else erf_E = 0.5d0 * inv_pi * dexp(-x*x) & - * ((1.d0, 0.d0) - zexp(-(2.d0, 0.d0) * x * yabs)) / x + * ((1.d0, 0.d0) - zexp(-(0.d0, 2.d0) * xy)) / x endif + return end ! --- @@ -84,31 +136,30 @@ double precision function erf_F(x, yabs) integer, parameter :: Nmax = 13 integer :: i - double precision :: tmp1, tmp2, x2, ct + double precision :: tmp1, tmp2, x2 if(dabs(x) .gt. 5.8d0) then - erf_F = 0.d0 + return + endif - else - x2 = x * x - ct = x * inv_pi + x2 = x * x - erf_F = 0.d0 - do i = 1, Nmax + erf_F = 0.d0 + do i = 1, Nmax - tmp1 = 0.25d0 * dble(i) * dble(i) + x2 - tmp2 = dexp(-tmp1) / tmp1 - erf_F = erf_F + tmp2 + tmp1 = 0.25d0 * dble(i*i) + x2 + tmp2 = dexp(-tmp1) / tmp1 + erf_F = erf_F + tmp2 - if(dabs(tmp2) .lt. 1d-15) exit - enddo - erf_F = ct * erf_F + if(tmp2 .lt. 1d-15) exit + enddo - endif + erf_F = x * inv_pi * erf_F + return end ! --- @@ -149,6 +200,7 @@ double precision function erf_F(x, yabs) enddo + return end ! --- @@ -163,19 +215,14 @@ double precision function erf_F(x, yabs) integer, parameter :: Nmax = 13 integer :: i - double precision :: tmp0, tmp1, tmp_mod, x2, ct, idble + double precision :: tmp0, tmp1, x2, idble complex*16 :: tmp2 - if(x .eq. 0.d0) then - erf_H = (0.d0, 0.d0) - return - endif - - if((dabs(x) .lt. 10d0) .and. (yabs .lt. 6.1d0)) then + if((dabs(x) .lt. 107d0) .and. (yabs .lt. 6.1d0)) then + !if((dabs(x) .lt. 10d0) .and. (yabs .lt. 6.1d0)) then x2 = x * x - ct = 0.5d0 * inv_pi erf_H = 0.d0 do i = 1, Nmax @@ -186,10 +233,10 @@ double precision function erf_F(x, yabs) tmp2 = dexp(-tmp1-idble*yabs) * (x + (0.d0, 1.d0)*tmp0) / tmp1 erf_H = erf_H + tmp2 - tmp_mod = dsqrt(real(tmp2)*real(tmp2) + aimag(tmp2)*aimag(tmp2)) - if(tmp_mod .lt. 1d-15) exit + if(zabs(tmp2) .lt. 1d-15) exit enddo - erf_H = ct * erf_H + + erf_H = 0.5d0 * inv_pi * erf_H else @@ -201,7 +248,7 @@ double precision function erf_F(x, yabs) ! --- -subroutine zboysfun00(z, val) +subroutine zboysfun00_2(z, val) BEGIN_DOC ! From ff63afa7978aa2ee39a975c927ea9d66d1806822 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Thu, 17 Oct 2024 19:14:22 +0200 Subject: [PATCH 002/175] working on maney center problem in cgtos --- src/ao_basis/EZFIO.cfg | 6 +- src/ao_basis/README.rst | 2 +- src/ao_one_e_ints/aos_cgtos.irp.f | 79 +-- .../one_e_coul_integrals_cgtos.irp.f | 70 +- .../one_e_kin_integrals_cgtos.irp.f | 80 +-- .../two_e_coul_integrals_cgtos.irp.f | 597 +++++++++--------- src/hartree_fock/deb_ao_2e_int.irp.f | 195 +++++- src/utils/cgtos_one_e.irp.f | 44 +- src/utils/cgtos_utils.irp.f | 72 ++- src/utils/cpx_boys.irp.f | 178 +++--- 10 files changed, 764 insertions(+), 559 deletions(-) diff --git a/src/ao_basis/EZFIO.cfg b/src/ao_basis/EZFIO.cfg index ad36ca6b..bd716383 100644 --- a/src/ao_basis/EZFIO.cfg +++ b/src/ao_basis/EZFIO.cfg @@ -73,7 +73,7 @@ doc: If true, use cgtos for AO integrals interface: ezfio default: False -[ao_expo_im_cgtos] +[ao_expo_im] type: double precision doc: imag part for Exponents for each primitive of each cGTOs |AO| size: (ao_basis.ao_num,ao_basis.ao_prim_num_max) @@ -82,12 +82,12 @@ interface: ezfio, provider [ao_expo_pw] type: double precision doc: plane wave part for each primitive GTOs |AO| -size: (4,ao_basis.ao_num,ao_basis.ao_prim_num_max) +size: (3,ao_basis.ao_num,ao_basis.ao_prim_num_max) interface: ezfio, provider [ao_expo_phase] type: double precision doc: phase shift for each primitive GTOs |AO| -size: (4,ao_basis.ao_num,ao_basis.ao_prim_num_max) +size: (3,ao_basis.ao_num,ao_basis.ao_prim_num_max) interface: ezfio, provider diff --git a/src/ao_basis/README.rst b/src/ao_basis/README.rst index 6b9e6c07..0b7e5c3e 100644 --- a/src/ao_basis/README.rst +++ b/src/ao_basis/README.rst @@ -40,6 +40,6 @@ Complex Gaussian-Type Orbitals (cGTOs) are also supported: \chi_i(\mathbf{r}) = x^a y^b z^c \sum_k c_{ki} \left( e^{-\alpha_{ki} \mathbf{r}^2 - \imath \mathbf{k}_{ki} \cdot \mathbf{r} - \imath \phi_{ki}} + \text{C.C.} \right) where: - - :math:`\alpha \in \mathbb{C}` and :math:`\Re(\alpha) > 0` (specified by ``ao_expo`` and ``ao_expo_im_cgtos``), + - :math:`\alpha \in \mathbb{C}` and :math:`\Re(\alpha) > 0` (specified by ``ao_expo`` and ``ao_expo_im``), - :math:`\mathbf{k} = (k_x, k_y, k_z) \in \mathbb{R}^3` (specified by ``ao_expo_pw``), - :math:`\phi = \phi_x + \phi_y + \phi_z \in \mathbb{R}` (specified by ``ao_expo_phase``). diff --git a/src/ao_one_e_ints/aos_cgtos.irp.f b/src/ao_one_e_ints/aos_cgtos.irp.f index 2792d938..b5dd5263 100644 --- a/src/ao_one_e_ints/aos_cgtos.irp.f +++ b/src/ao_one_e_ints/aos_cgtos.irp.f @@ -21,21 +21,18 @@ &BEGIN_PROVIDER [complex*16, ao_expo_phase_ord_transp, (4, ao_prim_num_max, ao_num)] implicit none + integer :: i, j, m do j = 1, ao_num do i = 1, ao_prim_num_max + ao_expo_cgtos_ord_transp(i,j) = ao_expo_cgtos_ord(j,i) - do m = 1, 3 + + do m = 1, 4 ao_expo_pw_ord_transp(m,i,j) = ao_expo_pw_ord(m,j,i) ao_expo_phase_ord_transp(m,i,j) = ao_expo_phase_ord(m,j,i) enddo - ao_expo_pw_ord_transp(4,i,j) = ao_expo_pw_ord_transp(1,i,j) * ao_expo_pw_ord_transp(1,i,j) & - + ao_expo_pw_ord_transp(2,i,j) * ao_expo_pw_ord_transp(2,i,j) & - + ao_expo_pw_ord_transp(3,i,j) * ao_expo_pw_ord_transp(3,i,j) - ao_expo_phase_ord_transp(4,i,j) = ao_expo_phase_ord_transp(1,j,i) & - + ao_expo_phase_ord_transp(2,j,i) & - + ao_expo_phase_ord_transp(3,j,i) enddo enddo @@ -50,16 +47,12 @@ integer :: i, j, ii, m, powA(3), nz double precision :: norm double precision :: kA2, phiA - complex*16 :: expo, expo_inv, C_A(3) + complex*16 :: expo, expo_inv, C_Ae(3), C_Ap(3) complex*16 :: overlap_x, overlap_y, overlap_z complex*16 :: integ1, integ2, C1, C2 nz = 100 - C_A(1) = (0.d0, 0.d0) - C_A(2) = (0.d0, 0.d0) - C_A(3) = (0.d0, 0.d0) - ao_coef_norm_cgtos = 0.d0 do i = 1, ao_num @@ -74,19 +67,22 @@ do j = 1, ao_prim_num(i) - expo = ao_expo(i,j) + (0.d0, 1.d0) * ao_expo_im_cgtos(i,j) + expo = ao_expo(i,j) + (0.d0, 1.d0) * ao_expo_im(i,j) expo_inv = (1.d0, 0.d0) / expo do m = 1, 3 - C_A(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo_inv * ao_expo_pw(m,i,j) + C_Ap(m) = nucl_coord(ii,m) + C_Ae(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo_inv * ao_expo_pw(m,i,j) enddo - phiA = ao_expo_phase(4,i,j) - KA2 = ao_expo_pw(4,i,j) + phiA = ao_expo_phase(1,i,j) + ao_expo_phase(2,i,j) + ao_expo_phase(3,i,j) + KA2 = ao_expo_pw(1,i,j) * ao_expo_pw(1,i,j) & + + ao_expo_pw(2,i,j) * ao_expo_pw(2,i,j) & + + ao_expo_pw(3,i,j) * ao_expo_pw(3,i,j) C1 = zexp(-(0.d0, 2.d0) * phiA - 0.5d0 * expo_inv * KA2) C2 = zexp(-(0.5d0, 0.d0) * real(expo_inv) * KA2) - call overlap_cgaussian_xyz(C_A, C_A, expo, expo, powA, powA, overlap_x, overlap_y, overlap_z, integ1, nz) - call overlap_cgaussian_xyz(conjg(C_A), C_A, conjg(expo), expo, powA, powA, overlap_x, overlap_y, overlap_z, integ2, nz) + call overlap_cgaussian_xyz(C_Ae, C_Ae, expo, expo, powA, powA, C_Ap, C_Ap, overlap_x, overlap_y, overlap_z, integ1, nz) + call overlap_cgaussian_xyz(conjg(C_Ae), C_Ae, conjg(expo), expo, powA, powA, conjg(C_Ap), C_Ap, overlap_x, overlap_y, overlap_z, integ2, nz) norm = 2.d0 * real(C1 * integ1 + C2 * integ2) @@ -126,12 +122,17 @@ iorder(j) = j d(j,1) = ao_expo(i,j) d(j,2) = ao_coef_norm_cgtos(i,j) - d(j,3) = ao_expo_im_cgtos(i,j) + d(j,3) = ao_expo_im(i,j) - do m = 1, 4 + do m = 1, 3 d(j,3+m) = ao_expo_pw(m,i,j) + enddo + d(j,7) = d(j,4) * d(j,4) + d(j,5) * d(j,5) + d(j,6) * d(j,6) + + do m = 1, 3 d(j,7+m) = ao_expo_phase(m,i,j) enddo + d(j,11) = d(j,8) + d(j,9) + d(j,10) enddo call dsort(d(1,1), iorder, ao_prim_num(i)) @@ -165,8 +166,8 @@ double precision :: c, overlap, overlap_x, overlap_y, overlap_z double precision :: KA2(3), phiA(3) double precision :: KB2(3), phiB(3) - complex*16 :: alpha, alpha_inv, A_center(3) - complex*16 :: beta, beta_inv, B_center(3) + complex*16 :: alpha, alpha_inv, Ae_center(3), Ap_center(3) + complex*16 :: beta, beta_inv, Be_center(3), Bp_center(3) complex*16 :: C1(1:4), C2(1:4) complex*16 :: overlap1, overlap_x1, overlap_y1, overlap_z1 complex*16 :: overlap2, overlap_x2, overlap_y2, overlap_z2 @@ -178,18 +179,18 @@ dim1 = 100 - !$OMP PARALLEL DO SCHEDULE(GUIDED) & - !$OMP DEFAULT(NONE) & - !$OMP PRIVATE(i, j, m, n, l, ii, jj, c, C1, C2, & - !$OMP alpha, alpha_inv, A_center, power_A, KA2, phiA, & - !$OMP beta, beta_inv, B_center, power_B, KB2, phiB, & - !$OMP overlap_x , overlap_y , overlap_z , overlap, & - !$OMP overlap_x1, overlap_y1, overlap_z1, overlap1, & - !$OMP overlap_x2, overlap_y2, overlap_z2, overlap2) & - !$OMP SHARED(nucl_coord, ao_power, ao_prim_num, ao_num, ao_nucl, dim1, & - !$OMP ao_coef_cgtos_norm_ord_transp, ao_expo_cgtos_ord_transp, & - !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & - !$OMP ao_overlap_cgtos_x, ao_overlap_cgtos_y, ao_overlap_cgtos_z, & + !$OMP PARALLEL DO SCHEDULE(GUIDED) & + !$OMP DEFAULT(NONE) & + !$OMP PRIVATE(i, j, m, n, l, ii, jj, c, C1, C2, & + !$OMP alpha, alpha_inv, Ae_center, Ap_center, power_A, KA2, phiA, & + !$OMP beta, beta_inv, Be_center, Bp_center, power_B, KB2, phiB, & + !$OMP overlap_x , overlap_y , overlap_z , overlap, & + !$OMP overlap_x1, overlap_y1, overlap_z1, overlap1, & + !$OMP overlap_x2, overlap_y2, overlap_z2, overlap2) & + !$OMP SHARED(nucl_coord, ao_power, ao_prim_num, ao_num, ao_nucl, dim1, & + !$OMP ao_coef_cgtos_norm_ord_transp, ao_expo_cgtos_ord_transp, & + !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & + !$OMP ao_overlap_cgtos_x, ao_overlap_cgtos_y, ao_overlap_cgtos_z, & !$OMP ao_overlap_cgtos) do j = 1, ao_num @@ -212,7 +213,8 @@ alpha_inv = (1.d0, 0.d0) / alpha do m = 1, 3 phiA(m) = ao_expo_phase_ord_transp(m,n,j) - A_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * alpha_inv * ao_expo_pw_ord_transp(m,n,j) + Ap_center(m) = nucl_coord(jj,m) + Ae_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * alpha_inv * ao_expo_pw_ord_transp(m,n,j) KA2(m) = ao_expo_pw_ord_transp(m,n,j) * ao_expo_pw_ord_transp(m,n,j) enddo @@ -222,7 +224,8 @@ beta_inv = (1.d0, 0.d0) / beta do m = 1, 3 phiB(m) = ao_expo_phase_ord_transp(m,l,i) - B_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * beta_inv * ao_expo_pw_ord_transp(m,l,i) + Bp_center(m) = nucl_coord(ii,m) + Be_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * beta_inv * ao_expo_pw_ord_transp(m,l,i) KB2(m) = ao_expo_pw_ord_transp(m,l,i) * ao_expo_pw_ord_transp(m,l,i) enddo @@ -238,10 +241,10 @@ C2(3) = zexp((0.d0, 1.d0) * (phiA(3) - phiB(3)) - 0.25d0 * (conjg(alpha_inv) * KA2(3) + beta_inv * KB2(3))) C2(4) = C2(1) * C2(2) * C2(3) - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x1, overlap_y1, overlap_z1, overlap1, dim1) - call overlap_cgaussian_xyz(conjg(A_center), B_center, conjg(alpha), beta, power_A, power_B, & + call overlap_cgaussian_xyz(conjg(Ae_center), Be_center, conjg(alpha), beta, power_A, power_B, conjg(Ap_center), Bp_center, & overlap_x2, overlap_y2, overlap_z2, overlap2, dim1) overlap_x = 2.d0 * real(C1(1) * overlap_x1 + C2(1) * overlap_x2) diff --git a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f index 568d4d8f..fed5f29d 100644 --- a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f +++ b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f @@ -17,25 +17,25 @@ double precision :: c, Z, C_center(3) double precision :: phiA, KA2 double precision :: phiB, KB2 - complex*16 :: alpha, alpha_inv, A_center(3) - complex*16 :: beta, beta_inv, B_center(3) + complex*16 :: alpha, alpha_inv, Ae_center(3), Ap_center(3) + complex*16 :: beta, beta_inv, Be_center(3), Bp_center(3) complex*16 :: C1, C2, I1, I2 complex*16 :: NAI_pol_mult_cgtos ao_integrals_n_e_cgtos = 0.d0 - !$OMP PARALLEL & - !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i, j, k, l, m, n, ii, jj, C_center, Z, c, & - !$OMP alpha, alpha_inv, A_center, phiA, KA2, power_A, C1, I1, & - !$OMP beta, beta_inv, B_center, phiB, KB2, power_B, C2, I2) & - !$OMP SHARED (ao_num, ao_prim_num, ao_nucl, nucl_coord, & - !$OMP ao_power, nucl_num, nucl_charge, n_pt_max_integrals, & - !$OMP ao_expo_cgtos_ord_transp, ao_coef_cgtos_norm_ord_transp, & - !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & - !$OMP ao_integrals_n_e_cgtos) - !$OMP DO SCHEDULE (dynamic) + !$OMP PARALLEL & + !$OMP DEFAULT (NONE) & + !$OMP PRIVATE (i, j, k, l, m, n, ii, jj, C_center, Z, c, C1, C2, I1, I2, & + !$OMP alpha, alpha_inv, Ae_center, Ap_center, phiA, KA2, power_A, & + !$OMP beta, beta_inv, Be_center, Bp_center, phiB, KB2, power_B) & + !$OMP SHARED (ao_num, ao_prim_num, ao_nucl, nucl_coord, & + !$OMP ao_power, nucl_num, nucl_charge, n_pt_max_integrals, & + !$OMP ao_expo_cgtos_ord_transp, ao_coef_cgtos_norm_ord_transp, & + !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & + !$OMP ao_integrals_n_e_cgtos) + !$OMP DO SCHEDULE (dynamic) do j = 1, ao_num @@ -51,9 +51,9 @@ alpha = ao_expo_cgtos_ord_transp(n,j) alpha_inv = (1.d0, 0.d0) / alpha - do m = 1, 3 - A_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * alpha_inv * ao_expo_pw_ord_transp(m,n,j) + Ap_center(m) = nucl_coord(jj,m) + Ae_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * alpha_inv * ao_expo_pw_ord_transp(m,n,j) enddo phiA = ao_expo_phase_ord_transp(4,n,j) KA2 = ao_expo_pw_ord_transp(4,n,j) @@ -62,9 +62,9 @@ beta = ao_expo_cgtos_ord_transp(l,i) beta_inv = (1.d0, 0.d0) / beta - do m = 1, 3 - B_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * beta_inv * ao_expo_pw_ord_transp(m,l,i) + Bp_center(m) = nucl_coord(ii,m) + Be_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * beta_inv * ao_expo_pw_ord_transp(m,l,i) enddo phiB = ao_expo_phase_ord_transp(4,l,i) KB2 = ao_expo_pw_ord_transp(4,l,i) @@ -79,9 +79,11 @@ C_center(1:3) = nucl_coord(k,1:3) - I1 = NAI_pol_mult_cgtos(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_max_integrals) + I1 = NAI_pol_mult_cgtos(Ae_center, Be_center, power_A, power_B, alpha, beta, & + Ap_center, Bp_center, C_center, n_pt_max_integrals) - I2 = NAI_pol_mult_cgtos(conjg(A_center), B_center, power_A, power_B, conjg(alpha), beta, C_center, n_pt_max_integrals) + I2 = NAI_pol_mult_cgtos(conjg(Ae_center), Be_center, power_A, power_B, conjg(alpha), beta, & + conjg(Ap_center), Bp_center, C_center, n_pt_max_integrals) c = c - Z * 2.d0 * real(C1 * I1 + C2 * I2) enddo @@ -93,14 +95,15 @@ enddo enddo - !$OMP END DO - !$OMP END PARALLEL + !$OMP END DO + !$OMP END PARALLEL END_PROVIDER ! --- -complex*16 function NAI_pol_mult_cgtos(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in) +complex*16 function NAI_pol_mult_cgtos(Ae_center, Be_center, power_A, power_B, alpha, beta, & + Ap_center, Bp_center, C_center, n_pt_in) BEGIN_DOC ! @@ -115,7 +118,8 @@ integer, intent(in) :: n_pt_in, power_A(3), power_B(3) double precision, intent(in) :: C_center(3) - complex*16, intent(in) :: alpha, beta, A_center(3), B_center(3) + complex*16, intent(in) :: alpha, Ae_center(3), Ap_center(3) + complex*16, intent(in) :: beta, Be_center(3), Bp_center(3) integer :: i, n_pt, n_pt_out double precision :: dist_AB, dist_AC @@ -124,20 +128,19 @@ complex*16 :: d(0:n_pt_in) complex*16, external :: V_n_e_cgtos - complex*16, external :: crint_2 - complex*16, external :: crint_sum_2 + complex*16, external :: crint_sum dist_AB = 0.d0 dist_AC = 0.d0 do i = 1, 3 - dist_AB += abs(A_center(i) - B_center(i)) - dist_AC += abs(A_center(i) - C_center(i) * (1.d0, 0.d0)) + dist_AB += abs(Ae_center(i) - Be_center(i)) + dist_AC += abs(Ae_center(i) - C_center(i) * (1.d0, 0.d0)) enddo - if((dist_AB .gt. 1d-13) .or. (dist_AC .gt. 1d-13)) then + if((dist_AB .gt. 1d-13) .or. (dist_AC .gt. 1d-13) .or. use_pw) then continue @@ -157,8 +160,8 @@ dist = (0.d0, 0.d0) dist_integral = (0.d0, 0.d0) do i = 1, 3 - P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv - dist += (A_center(i) - B_center(i)) * (A_center(i) - B_center(i)) + P_center(i) = (alpha * Ae_center(i) + beta * Be_center(i)) * p_inv + dist += (Ae_center(i) - Be_center(i)) * (Ae_center(i) - Be_center(i)) dist_integral += (P_center(i) - C_center(i)) * (P_center(i) - C_center(i)) enddo @@ -175,12 +178,13 @@ n_pt = 2 * ((power_A(1) + power_B(1)) + (power_A(2) + power_B(2)) + (power_A(3) + power_B(3))) if(n_pt == 0) then - NAI_pol_mult_cgtos = coeff * crint_2(0, const) + !NAI_pol_mult_cgtos = coeff * crint_1(0, const) + NAI_pol_mult_cgtos = coeff * crint_sum(0, const, (1.d0, 0.d0)) return endif d(0:n_pt_in) = (0.d0, 0.d0) - call give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & + call give_cpolynomial_mult_center_one_e(Ap_center, Bp_center, alpha, beta, & power_A, power_B, C_center, n_pt_in, d, n_pt_out) if(n_pt_out < 0) then @@ -188,7 +192,7 @@ return endif - NAI_pol_mult_cgtos = coeff * crint_sum_2(n_pt_out, const, d) + NAI_pol_mult_cgtos = coeff * crint_sum(n_pt_out, const, d) return end diff --git a/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f b/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f index 7f1f62cb..b55c37f8 100644 --- a/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f +++ b/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f @@ -10,8 +10,8 @@ double precision :: c, deriv_tmp double precision :: KA2, phiA double precision :: KB2, phiB - complex*16 :: alpha, alpha_inv, A_center(3), C1 - complex*16 :: beta, beta_inv, B_center(3), C2 + complex*16 :: alpha, alpha_inv, Ae_center(3), Ap_center(3), C1 + complex*16 :: beta, beta_inv, Be_center(3), Bp_center(3), C2 complex*16 :: overlap_x, overlap_y, overlap_z, overlap complex*16 :: overlap_x0_1, overlap_y0_1, overlap_z0_1 complex*16 :: overlap_x0_2, overlap_y0_2, overlap_z0_2 @@ -24,30 +24,32 @@ ! -- Dummy call to provide everything - A_center(:) = (0.0d0, 0.d0) - B_center(:) = (1.0d0, 0.d0) - alpha = (1.0d0, 0.d0) - beta = (0.1d0, 0.d0) - power_A = 1 - power_B = 0 - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + Ae_center(:) = (0.0d0, 0.d0) + Be_center(:) = (1.0d0, 0.d0) + Ap_center(:) = (0.0d0, 0.d0) + Bp_center(:) = (1.0d0, 0.d0) + alpha = (1.0d0, 0.d0) + beta = (0.1d0, 0.d0) + power_A = 1 + power_B = 0 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap, dim1) ! --- - !$OMP PARALLEL DO SCHEDULE(GUIDED) & - !$OMP DEFAULT(NONE) & - !$OMP PRIVATE(i, j, m, n, l, ii, jj, c, C1, C2, & - !$OMP A_center, power_A, alpha, alpha_inv, KA2, phiA, & - !$OMP B_center, power_B, beta, beta_inv, KB2, phiB, & - !$OMP deriv_tmp, deriv_tmp_1, deriv_tmp_2, & - !$OMP overlap_x, overlap_y, overlap_z, overlap, & - !$OMP overlap_m2_1, overlap_p2_1, overlap_m2_2, overlap_p2_2, & - !$OMP overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap_x0_2, & - !$OMP overlap_y0_2, overlap_z0_2) & - !$OMP SHARED(nucl_coord, ao_power, ao_prim_num, ao_num, ao_nucl, dim1, & - !$OMP ao_coef_cgtos_norm_ord_transp, ao_expo_cgtos_ord_transp, & - !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & + !$OMP PARALLEL DO SCHEDULE(GUIDED) & + !$OMP DEFAULT(NONE) & + !$OMP PRIVATE(i, j, m, n, l, ii, jj, c, C1, C2, & + !$OMP Ae_center, power_A, alpha, alpha_inv, KA2, phiA, Ap_center, & + !$OMP Be_center, power_B, beta, beta_inv, KB2, phiB, Bp_center, & + !$OMP deriv_tmp, deriv_tmp_1, deriv_tmp_2, & + !$OMP overlap_x, overlap_y, overlap_z, overlap, & + !$OMP overlap_m2_1, overlap_p2_1, overlap_m2_2, overlap_p2_2, & + !$OMP overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap_x0_2, & + !$OMP overlap_y0_2, overlap_z0_2) & + !$OMP SHARED(nucl_coord, ao_power, ao_prim_num, ao_num, ao_nucl, dim1, & + !$OMP ao_coef_cgtos_norm_ord_transp, ao_expo_cgtos_ord_transp, & + !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & !$OMP ao_deriv2_cgtos_x, ao_deriv2_cgtos_y, ao_deriv2_cgtos_z) do j = 1, ao_num @@ -73,7 +75,8 @@ alpha = ao_expo_cgtos_ord_transp(n,j) alpha_inv = (1.d0, 0.d0) / alpha do m = 1, 3 - A_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * alpha_inv * ao_expo_pw_ord_transp(m,n,j) + Ap_center(m) = nucl_coord(jj,m) + Ae_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * alpha_inv * ao_expo_pw_ord_transp(m,n,j) enddo phiA = ao_expo_phase_ord_transp(4,n,j) KA2 = ao_expo_pw_ord_transp(4,n,j) @@ -83,7 +86,8 @@ beta = ao_expo_cgtos_ord_transp(l,i) beta_inv = (1.d0, 0.d0) / beta do m = 1, 3 - B_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * beta_inv * ao_expo_pw_ord_transp(m,l,i) + Bp_center(m) = nucl_coord(ii,m) + Be_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * beta_inv * ao_expo_pw_ord_transp(m,l,i) enddo phiB = ao_expo_phase_ord_transp(4,l,i) KB2 = ao_expo_pw_ord_transp(4,l,i) @@ -93,20 +97,20 @@ C1 = zexp((0.d0, 1.d0) * (-phiA - phiB) - 0.25d0 * (alpha_inv * KA2 + beta_inv * KB2)) C2 = zexp((0.d0, 1.d0) * (-phiA + phiB) - 0.25d0 * (alpha_inv * KA2 + conjg(beta_inv) * KB2)) - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_x0_2, overlap_y0_2, overlap_z0_2, overlap, dim1) ! --- power_A(1) = power_A(1) - 2 if(power_A(1) > -1) then - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_m2_1, overlap_y, overlap_z, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_m2_2, overlap_y, overlap_z, overlap, dim1) else overlap_m2_1 = (0.d0, 0.d0) @@ -114,10 +118,10 @@ endif power_A(1) = power_A(1) + 4 - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_p2_1, overlap_y, overlap_z, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_p2_2, overlap_y, overlap_z, overlap, dim1) power_A(1) = power_A(1) - 2 @@ -138,10 +142,10 @@ power_A(2) = power_A(2) - 2 if(power_A(2) > -1) then - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x, overlap_m2_1, overlap_y, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_x, overlap_m2_2, overlap_y, overlap, dim1) else overlap_m2_1 = (0.d0, 0.d0) @@ -149,10 +153,10 @@ endif power_A(2) = power_A(2) + 4 - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x, overlap_p2_1, overlap_y, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_x, overlap_p2_2, overlap_y, overlap, dim1) power_A(2) = power_A(2) - 2 @@ -173,10 +177,10 @@ power_A(3) = power_A(3) - 2 if(power_A(3) > -1) then - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x, overlap_y, overlap_m2_1, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_x, overlap_y, overlap_m2_2, overlap, dim1) else overlap_m2_1 = (0.d0, 0.d0) @@ -184,10 +188,10 @@ endif power_A(3) = power_A(3) + 4 - call overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & overlap_x, overlap_y, overlap_p2_1, overlap, dim1) - call overlap_cgaussian_xyz(A_center, conjg(B_center), alpha, conjg(beta), power_A, power_B, & + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & overlap_x, overlap_y, overlap_p2_2, overlap, dim1) power_A(3) = power_A(3) - 2 diff --git a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f index 3ac6f1a1..9414e851 100644 --- a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f +++ b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f @@ -21,10 +21,10 @@ double precision function ao_two_e_integral_cgtos(i, j, k, l) double precision :: KJ2, phiJ double precision :: KK2, phiK double precision :: KL2, phiL - complex*16 :: expo1, expo1_inv, I_center(3) - complex*16 :: expo2, expo2_inv, J_center(3) - complex*16 :: expo3, expo3_inv, K_center(3) - complex*16 :: expo4, expo4_inv, L_center(3) + complex*16 :: expo1, expo1_inv, Ie_center(3), Ip_center(3) + complex*16 :: expo2, expo2_inv, Je_center(3), Jp_center(3) + complex*16 :: expo3, expo3_inv, Ke_center(3), Kp_center(3) + complex*16 :: expo4, expo4_inv, Le_center(3), Lp_center(3) complex*16 :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv complex*16 :: P2_new(0:max_dim,3), P2_center(3), fact_p2, pp2, p2_inv complex*16 :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv @@ -44,258 +44,238 @@ double precision function ao_two_e_integral_cgtos(i, j, k, l) ao_two_e_integral_cgtos = ao_2e_cgtos_schwartz_accel(i, j, k, l) - else + return + endif + + dim1 = n_pt_max_integrals - dim1 = n_pt_max_integrals + ii = ao_nucl(i) + jj = ao_nucl(j) + kk = ao_nucl(k) + ll = ao_nucl(l) - ii = ao_nucl(i) - jj = ao_nucl(j) - kk = ao_nucl(k) - ll = ao_nucl(l) + do m = 1, 3 + I_power(m) = ao_power(i,m) + J_power(m) = ao_power(j,m) + K_power(m) = ao_power(k,m) + L_power(m) = ao_power(l,m) + enddo - do m = 1, 3 - I_power(m) = ao_power(i,m) - J_power(m) = ao_power(j,m) - K_power(m) = ao_power(k,m) - L_power(m) = ao_power(l,m) - enddo + ao_two_e_integral_cgtos = 0.d0 - ao_two_e_integral_cgtos = 0.d0 + if(use_pw .or. ii /= jj .or. kk /= ll .or. jj /= kk) then - if(ii /= jj .or. kk /= ll .or. jj /= kk) then + do p = 1, ao_prim_num(i) + + coef1 = ao_coef_cgtos_norm_ord_transp(p,i) + expo1 = ao_expo_cgtos_ord_transp(p,i) + expo1_inv = (1.d0, 0.d0) / expo1 + do m = 1, 3 + Ip_center(m) = nucl_coord(ii,m) + Ie_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,p,i) + enddo + phiI = ao_expo_phase_ord_transp(4,p,i) + KI2 = ao_expo_pw_ord_transp(4,p,i) - do p = 1, ao_prim_num(i) + do q = 1, ao_prim_num(j) - coef1 = ao_coef_cgtos_norm_ord_transp(p,i) - expo1 = ao_expo_cgtos_ord_transp(p,i) - expo1_inv = (1.d0, 0.d0) / expo1 + coef2 = coef1 * ao_coef_cgtos_norm_ord_transp(q,j) + expo2 = ao_expo_cgtos_ord_transp(q,j) + expo2_inv = (1.d0, 0.d0) / expo2 do m = 1, 3 - I_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,p,i) + Jp_center(m) = nucl_coord(jj,m) + Je_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,q,j) enddo - phiI = ao_expo_phase_ord_transp(4,p,i) - KI2 = ao_expo_pw_ord_transp(4,p,i) + phiJ = ao_expo_phase_ord_transp(4,q,j) + KJ2 = ao_expo_pw_ord_transp(4,q,j) - do q = 1, ao_prim_num(j) + call give_explicit_cpoly_and_cgaussian(P1_new, P1_center, pp1, fact_p1, iorder_p1, & + expo1, expo2, I_power, J_power, Ie_center, Je_center, Ip_center, Jp_center, dim1) - coef2 = coef1 * ao_coef_cgtos_norm_ord_transp(q,j) - expo2 = ao_expo_cgtos_ord_transp(q,j) - expo2_inv = (1.d0, 0.d0) / expo2 - do m = 1, 3 - J_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,q,j) - enddo - phiJ = ao_expo_phase_ord_transp(4,q,j) - KJ2 = ao_expo_pw_ord_transp(4,q,j) + p1_inv = (1.d0, 0.d0) / pp1 + + call give_explicit_cpoly_and_cgaussian(P2_new, P2_center, pp2, fact_p2, iorder_p2, & + conjg(expo1), expo2, I_power, J_power, conjg(Ie_center), Je_center, conjg(Ip_center), Jp_center, dim1) - call give_explicit_cpoly_and_cgaussian(P1_new, P1_center, pp1, fact_p1, iorder_p1, & - expo1, expo2, I_power, J_power, I_center, J_center, dim1) - p1_inv = (1.d0, 0.d0) / pp1 + p2_inv = (1.d0, 0.d0) / pp2 + + do r = 1, ao_prim_num(k) - call give_explicit_cpoly_and_cgaussian(P2_new, P2_center, pp2, fact_p2, iorder_p2, & - conjg(expo1), expo2, I_power, J_power, conjg(I_center), J_center, dim1) - p2_inv = (1.d0, 0.d0) / pp2 + coef3 = coef2 * ao_coef_cgtos_norm_ord_transp(r,k) + expo3 = ao_expo_cgtos_ord_transp(r,k) + expo3_inv = (1.d0, 0.d0) / expo3 + do m = 1, 3 + Kp_center(m) = nucl_coord(kk,m) + Ke_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo3_inv * ao_expo_pw_ord_transp(m,r,k) + enddo + phiK = ao_expo_phase_ord_transp(4,r,k) + KK2 = ao_expo_pw_ord_transp(4,r,k) - do r = 1, ao_prim_num(k) + do s = 1, ao_prim_num(l) - coef3 = coef2 * ao_coef_cgtos_norm_ord_transp(r,k) - expo3 = ao_expo_cgtos_ord_transp(r,k) - expo3_inv = (1.d0, 0.d0) / expo3 + coef4 = coef3 * ao_coef_cgtos_norm_ord_transp(s,l) + expo4 = ao_expo_cgtos_ord_transp(s,l) + expo4_inv = (1.d0, 0.d0) / expo4 do m = 1, 3 - K_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo3_inv * ao_expo_pw_ord_transp(m,r,k) + Lp_center(m) = nucl_coord(ll,m) + Le_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo4_inv * ao_expo_pw_ord_transp(m,s,l) enddo - phiK = ao_expo_phase_ord_transp(4,r,k) - KK2 = ao_expo_pw_ord_transp(4,r,k) - - do s = 1, ao_prim_num(l) - - coef4 = coef3 * ao_coef_cgtos_norm_ord_transp(s,l) - expo4 = ao_expo_cgtos_ord_transp(s,l) - expo4_inv = (1.d0, 0.d0) / expo4 - do m = 1, 3 - L_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo4_inv * ao_expo_pw_ord_transp(m,s,l) - enddo - phiL = ao_expo_phase_ord_transp(4,s,l) - KL2 = ao_expo_pw_ord_transp(4,s,l) - - call give_explicit_cpoly_and_cgaussian(Q1_new, Q1_center, qq1, fact_q1, iorder_q1, & - expo3, expo4, K_power, L_power, K_center, L_center, dim1) - q1_inv = (1.d0, 0.d0) / qq1 - - call give_explicit_cpoly_and_cgaussian(Q2_new, Q2_center, qq2, fact_q2, iorder_q2, & - conjg(expo3), expo4, K_power, L_power, conjg(K_center), L_center, dim1) - q2_inv = (1.d0, 0.d0) / qq2 - - C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C2 = zexp((0.d0, 1.d0) * (-phiI - phiJ + phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C3 = zexp((0.d0, 1.d0) * ( phiI - phiJ - phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C4 = zexp((0.d0, 1.d0) * ( phiI - phiJ + phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C5 = zexp((0.d0, 1.d0) * (-phiI + phiJ - phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C6 = zexp((0.d0, 1.d0) * (-phiI + phiJ + phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C7 = zexp((0.d0, 1.d0) * ( phiI + phiJ - phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C8 = zexp((0.d0, 1.d0) * ( phiI + phiJ + phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - - int1 = general_primitive_integral_cgtos(dim1, & - P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p1, & - Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) - - int2 = general_primitive_integral_cgtos(dim1, & - P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p1, & - Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) - - int3 = general_primitive_integral_cgtos(dim1, & - P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p2, & - Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) - - int4 = general_primitive_integral_cgtos(dim1, & - P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p2, & - Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) - - int5 = general_primitive_integral_cgtos(dim1, & - conjg(P2_new), conjg(P2_center), conjg(fact_p2), conjg(pp2), conjg(p2_inv), iorder_p2, & - Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) - - int6 = general_primitive_integral_cgtos(dim1, & - conjg(P2_new), conjg(P2_center), conjg(fact_p2), conjg(pp2), conjg(p2_inv), iorder_p2, & - Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) - - int7 = general_primitive_integral_cgtos(dim1, & - conjg(P1_new), conjg(P1_center), conjg(fact_p1), conjg(pp1), conjg(p1_inv), iorder_p1, & - Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) - - int8 = general_primitive_integral_cgtos(dim1, & - conjg(P1_new), conjg(P1_center), conjg(fact_p1), conjg(pp1), conjg(p1_inv), iorder_p1, & - Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) - - int_tot = C1 * int1 + C2 * int2 + C3 * int3 + C4 * int4 + C5 * int5 + C6 * int6 + C7 * int7 + C8 * int8 - - ao_two_e_integral_cgtos = ao_two_e_integral_cgtos + coef4 * 2.d0 * real(int_tot) - enddo ! s - enddo ! r - enddo ! q - enddo ! p + phiL = ao_expo_phase_ord_transp(4,s,l) + KL2 = ao_expo_pw_ord_transp(4,s,l) - else + call give_explicit_cpoly_and_cgaussian(Q1_new, Q1_center, qq1, fact_q1, iorder_q1, & + expo3, expo4, K_power, L_power, Ke_center, Le_center, Kp_center, Lp_center, dim1) - do p = 1, ao_prim_num(i) + q1_inv = (1.d0, 0.d0) / qq1 - coef1 = ao_coef_cgtos_norm_ord_transp(p,i) - expo1 = ao_expo_cgtos_ord_transp(p,i) - expo1_inv = (1.d0, 0.d0) / expo1 - do m = 1, 3 - I_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,p,i) - enddo - phiI = ao_expo_phase_ord_transp(4,p,i) - KI2 = ao_expo_pw_ord_transp(4,p,i) + call give_explicit_cpoly_and_cgaussian(Q2_new, Q2_center, qq2, fact_q2, iorder_q2, & + conjg(expo3), expo4, K_power, L_power, conjg(Ke_center), Le_center, conjg(Kp_center), Lp_center, dim1) - do q = 1, ao_prim_num(j) + q2_inv = (1.d0, 0.d0) / qq2 - coef2 = coef1 * ao_coef_cgtos_norm_ord_transp(q,j) - expo2 = ao_expo_cgtos_ord_transp(q,j) - expo2_inv = (1.d0, 0.d0) / expo2 - do m = 1, 3 - J_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,q,j) - enddo - phiJ = ao_expo_phase_ord_transp(4,q,j) - KJ2 = ao_expo_pw_ord_transp(4,q,j) + C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL) & + - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) + C2 = zexp((0.d0, 1.d0) * (-phiI - phiJ + phiK - phiL) & + - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) + C3 = zexp((0.d0, 1.d0) * ( phiI - phiJ - phiK - phiL) & + - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) + C4 = zexp((0.d0, 1.d0) * ( phiI - phiJ + phiK - phiL) & + - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) + C5 = zexp((0.d0, 1.d0) * (-phiI + phiJ - phiK - phiL) & + - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) + C6 = zexp((0.d0, 1.d0) * (-phiI + phiJ + phiK - phiL) & + - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) + C7 = zexp((0.d0, 1.d0) * ( phiI + phiJ - phiK - phiL) & + - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) + C8 = zexp((0.d0, 1.d0) * ( phiI + phiJ + phiK - phiL) & + - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - do r = 1, ao_prim_num(k) + int1 = general_primitive_integral_cgtos(dim1, & + P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p1, & + Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) - coef3 = coef2 * ao_coef_cgtos_norm_ord_transp(r,k) - expo3 = ao_expo_cgtos_ord_transp(r,k) - expo3_inv = (1.d0, 0.d0) / expo3 - do m = 1, 3 - K_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo3_inv * ao_expo_pw_ord_transp(m,r,k) - enddo - phiK = ao_expo_phase_ord_transp(4,r,k) - KK2 = ao_expo_pw_ord_transp(4,r,k) - - do s = 1, ao_prim_num(l) - - coef4 = coef3 * ao_coef_cgtos_norm_ord_transp(s,l) - expo4 = ao_expo_cgtos_ord_transp(s,l) - expo4_inv = (1.d0, 0.d0) / expo4 - do m = 1, 3 - L_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo4_inv * ao_expo_pw_ord_transp(m,s,l) - enddo - phiL = ao_expo_phase_ord_transp(4,s,l) - KL2 = ao_expo_pw_ord_transp(4,s,l) - - C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C2 = zexp((0.d0, 1.d0) * (-phiI - phiJ + phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C3 = zexp((0.d0, 1.d0) * ( phiI - phiJ - phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C4 = zexp((0.d0, 1.d0) * ( phiI - phiJ + phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C5 = zexp((0.d0, 1.d0) * (-phiI + phiJ - phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C6 = zexp((0.d0, 1.d0) * (-phiI + phiJ + phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C7 = zexp((0.d0, 1.d0) * ( phiI + phiJ - phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C8 = zexp((0.d0, 1.d0) * ( phiI + phiJ + phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - - int1 = ERI_cgtos(expo1, expo2, expo3, expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int2 = ERI_cgtos(expo1, expo2, conjg(expo3), expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int3 = ERI_cgtos(conjg(expo1), expo2, expo3, expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int4 = ERI_cgtos(conjg(expo1), expo2, conjg(expo3), expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int5 = ERI_cgtos(expo1, conjg(expo2), expo3, expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int6 = ERI_cgtos(expo1, conjg(expo2), conjg(expo3), expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int7 = ERI_cgtos(conjg(expo1), conjg(expo2), expo3, expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int8 = ERI_cgtos(conjg(expo1), conjg(expo2), conjg(expo3), expo4, & - I_power(1), J_power(1), K_power(1), L_power(1), & - I_power(2), J_power(2), K_power(2), L_power(2), & - I_power(3), J_power(3), K_power(3), L_power(3)) - - int_tot = C1 * int1 + C2 * int2 + C3 * int3 + C4 * int4 & - + C5 * int5 + C6 * int6 + C7 * int7 + C8 * int8 - - ao_two_e_integral_cgtos = ao_two_e_integral_cgtos + coef4 * 2.d0 * real(int_tot) - enddo ! s - enddo ! r - enddo ! q - enddo ! p - - endif ! same centers - endif ! do schwartz + int2 = general_primitive_integral_cgtos(dim1, & + P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p1, & + Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) + + int3 = general_primitive_integral_cgtos(dim1, & + P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p2, & + Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) + + int4 = general_primitive_integral_cgtos(dim1, & + P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p2, & + Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) + + int5 = general_primitive_integral_cgtos(dim1, & + conjg(P2_new), conjg(P2_center), conjg(fact_p2), conjg(pp2), conjg(p2_inv), iorder_p2, & + Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) + + int6 = general_primitive_integral_cgtos(dim1, & + conjg(P2_new), conjg(P2_center), conjg(fact_p2), conjg(pp2), conjg(p2_inv), iorder_p2, & + Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) + + int7 = general_primitive_integral_cgtos(dim1, & + conjg(P1_new), conjg(P1_center), conjg(fact_p1), conjg(pp1), conjg(p1_inv), iorder_p1, & + Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q1) + + int8 = general_primitive_integral_cgtos(dim1, & + conjg(P1_new), conjg(P1_center), conjg(fact_p1), conjg(pp1), conjg(p1_inv), iorder_p1, & + Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q2) + + int_tot = C1 * int1 + C2 * int2 + C3 * int3 + C4 * int4 + C5 * int5 + C6 * int6 + C7 * int7 + C8 * int8 + + ao_two_e_integral_cgtos = ao_two_e_integral_cgtos + coef4 * 2.d0 * real(int_tot) + enddo ! s + enddo ! r + enddo ! q + enddo ! p + + else + + do p = 1, ao_prim_num(i) + + coef1 = ao_coef_cgtos_norm_ord_transp(p,i) + expo1 = ao_expo_cgtos_ord_transp(p,i) + phiI = ao_expo_phase_ord_transp(4,p,i) + + do q = 1, ao_prim_num(j) + + coef2 = coef1 * ao_coef_cgtos_norm_ord_transp(q,j) + expo2 = ao_expo_cgtos_ord_transp(q,j) + phiJ = ao_expo_phase_ord_transp(4,q,j) + + do r = 1, ao_prim_num(k) + + coef3 = coef2 * ao_coef_cgtos_norm_ord_transp(r,k) + expo3 = ao_expo_cgtos_ord_transp(r,k) + phiK = ao_expo_phase_ord_transp(4,r,k) + + do s = 1, ao_prim_num(l) + + coef4 = coef3 * ao_coef_cgtos_norm_ord_transp(s,l) + expo4 = ao_expo_cgtos_ord_transp(s,l) + phiL = ao_expo_phase_ord_transp(4,s,l) + + C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL)) + C2 = zexp((0.d0, 1.d0) * (-phiI - phiJ + phiK - phiL)) + C3 = zexp((0.d0, 1.d0) * ( phiI - phiJ - phiK - phiL)) + C4 = zexp((0.d0, 1.d0) * ( phiI - phiJ + phiK - phiL)) + C5 = zexp((0.d0, 1.d0) * (-phiI + phiJ - phiK - phiL)) + C6 = zexp((0.d0, 1.d0) * (-phiI + phiJ + phiK - phiL)) + C7 = zexp((0.d0, 1.d0) * ( phiI + phiJ - phiK - phiL)) + C8 = zexp((0.d0, 1.d0) * ( phiI + phiJ + phiK - phiL)) + + int1 = ERI_cgtos(expo1, expo2, expo3, expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int2 = ERI_cgtos(expo1, expo2, conjg(expo3), expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int3 = ERI_cgtos(conjg(expo1), expo2, expo3, expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int4 = ERI_cgtos(conjg(expo1), expo2, conjg(expo3), expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int5 = ERI_cgtos(expo1, conjg(expo2), expo3, expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int6 = ERI_cgtos(expo1, conjg(expo2), conjg(expo3), expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int7 = ERI_cgtos(conjg(expo1), conjg(expo2), expo3, expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int8 = ERI_cgtos(conjg(expo1), conjg(expo2), conjg(expo3), expo4, & + I_power(1), J_power(1), K_power(1), L_power(1), & + I_power(2), J_power(2), K_power(2), L_power(2), & + I_power(3), J_power(3), K_power(3), L_power(3)) + + int_tot = C1 * int1 + C2 * int2 + C3 * int3 + C4 * int4 & + + C5 * int5 + C6 * int6 + C7 * int7 + C8 * int8 + + ao_two_e_integral_cgtos = ao_two_e_integral_cgtos + coef4 * 2.d0 * real(int_tot) + enddo ! s + enddo ! r + enddo ! q + enddo ! p + + endif end @@ -321,10 +301,10 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) double precision :: KJ2, phiJ double precision :: KK2, phiK double precision :: KL2, phiL - complex*16 :: expo1, expo1_inv, I_center(3) - complex*16 :: expo2, expo2_inv, J_center(3) - complex*16 :: expo3, expo3_inv, K_center(3) - complex*16 :: expo4, expo4_inv, L_center(3) + complex*16 :: expo1, expo1_inv, Ie_center(3), Ip_center(3) + complex*16 :: expo2, expo2_inv, Je_center(3), Jp_center(3) + complex*16 :: expo3, expo3_inv, Ke_center(3), Kp_center(3) + complex*16 :: expo4, expo4_inv, Le_center(3), Lp_center(3) complex*16 :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv complex*16 :: P2_new(0:max_dim,3), P2_center(3), fact_p2, pp2, p2_inv complex*16 :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv @@ -362,7 +342,7 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) allocate(schwartz_kl(0:ao_prim_num(l),0:ao_prim_num(k))) - if(ii /= jj .or. kk /= ll .or. jj /= kk) then + if(use_pw .or. ii /= jj .or. kk /= ll .or. jj /= kk) then schwartz_kl(0,0) = 0.d0 do r = 1, ao_prim_num(k) @@ -371,7 +351,8 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) expo1 = ao_expo_cgtos_ord_transp(r,k) expo1_inv = (1.d0, 0.d0) / expo1 do m = 1, 3 - K_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,r,k) + Kp_center(m) = nucl_coord(kk,m) + Ke_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,r,k) enddo phiK = ao_expo_phase_ord_transp(4,r,k) KK2 = ao_expo_pw_ord_transp(4,r,k) @@ -383,17 +364,20 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) expo2 = ao_expo_cgtos_ord_transp(s,l) expo2_inv = (1.d0, 0.d0) / expo2 do m = 1, 3 - L_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,s,l) + Lp_center(m) = nucl_coord(ll,m) + Le_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,s,l) enddo phiL = ao_expo_phase_ord_transp(4,s,l) KL2 = ao_expo_pw_ord_transp(4,s,l) call give_explicit_cpoly_and_cgaussian(P1_new, P1_center, pp1, fact_p1, iorder_p1, & - expo1, expo2, K_power, L_power, K_center, L_center, dim1) + expo1, expo2, K_power, L_power, Ke_center, Le_center, Kp_center, Lp_center, dim1) + p1_inv = (1.d0, 0.d0) / pp1 call give_explicit_cpoly_and_cgaussian(P2_new, P2_center, pp2, fact_p2, iorder_p2, & - conjg(expo1), expo2, K_power, L_power, conjg(K_center), L_center, dim1) + conjg(expo1), expo2, K_power, L_power, conjg(Ke_center), Le_center, conjg(Kp_center), Lp_center, dim1) + p2_inv = (1.d0, 0.d0) / pp2 C1 = zexp(-(0.d0, 2.d0) * (phiK + phiL) - 0.5d0 * (expo1_inv * KK2 + expo2_inv * KL2)) @@ -457,7 +441,8 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) expo1 = ao_expo_cgtos_ord_transp(p,i) expo1_inv = (1.d0, 0.d0) / expo1 do m = 1, 3 - I_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,p,i) + Ip_center(m) = nucl_coord(ii,m) + Ie_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,p,i) enddo phiI = ao_expo_phase_ord_transp(4,p,i) KI2 = ao_expo_pw_ord_transp(4,p,i) @@ -468,17 +453,19 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) expo2 = ao_expo_cgtos_ord_transp(q,j) expo2_inv = (1.d0, 0.d0) / expo2 do m = 1, 3 - J_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,q,j) + Jp_center(m) = nucl_coord(jj,m) + Je_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,q,j) enddo phiJ = ao_expo_phase_ord_transp(4,q,j) KJ2 = ao_expo_pw_ord_transp(4,q,j) call give_explicit_cpoly_and_cgaussian(P1_new, P1_center, pp1, fact_p1, iorder_p1, & - expo1, expo2, I_power, J_power, I_center, J_center, dim1) + expo1, expo2, I_power, J_power, Ie_center, Je_center, Ip_center, Jp_center, dim1) + p1_inv = (1.d0, 0.d0) / pp1 call give_explicit_cpoly_and_cgaussian(P2_new, P2_center, pp2, fact_p2, iorder_p2, & - conjg(expo1), expo2, I_power, J_power, conjg(I_center), J_center, dim1) + conjg(expo1), expo2, I_power, J_power, conjg(Ie_center), Je_center, conjg(Ip_center), Jp_center, dim1) p2_inv = (1.d0, 0.d0) / pp2 C1 = zexp(-(0.d0, 2.d0) * (phiI + phiJ) - 0.5d0 * (expo1_inv * KI2 + expo2_inv * KJ2)) @@ -538,7 +525,8 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) expo3 = ao_expo_cgtos_ord_transp(r,k) expo3_inv = (1.d0, 0.d0) / expo3 do m = 1, 3 - K_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo3_inv * ao_expo_pw_ord_transp(m,r,k) + Kp_center(m) = nucl_coord(kk,m) + Ke_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo3_inv * ao_expo_pw_ord_transp(m,r,k) enddo phiK = ao_expo_phase_ord_transp(4,r,k) KK2 = ao_expo_pw_ord_transp(4,r,k) @@ -550,17 +538,20 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) expo4 = ao_expo_cgtos_ord_transp(s,l) expo4_inv = (1.d0, 0.d0) / expo4 do m = 1, 3 - L_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo4_inv * ao_expo_pw_ord_transp(m,s,l) + Lp_center(m) = nucl_coord(ll,m) + Le_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo4_inv * ao_expo_pw_ord_transp(m,s,l) enddo phiL = ao_expo_phase_ord_transp(4,s,l) KL2 = ao_expo_pw_ord_transp(4,s,l) call give_explicit_cpoly_and_cgaussian(Q1_new, Q1_center, qq1, fact_q1, iorder_q1, & - expo3, expo4, K_power, L_power, K_center, L_center, dim1) + expo3, expo4, K_power, L_power, Ke_center, Le_center, Kp_center, Lp_center, dim1) + q1_inv = (1.d0, 0.d0) / qq1 call give_explicit_cpoly_and_cgaussian(Q2_new, Q2_center, qq2, fact_q2, iorder_q2, & - conjg(expo3), expo4, K_power, L_power, conjg(K_center), L_center, dim1) + conjg(expo3), expo4, K_power, L_power, conjg(Ke_center), Le_center, conjg(Kp_center), Lp_center, dim1) + q2_inv = (1.d0, 0.d0) / qq2 C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL) & @@ -627,31 +618,21 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) coef1 = ao_coef_cgtos_norm_ord_transp(r,k) * ao_coef_cgtos_norm_ord_transp(r,k) expo1 = ao_expo_cgtos_ord_transp(r,k) - expo1_inv = (1.d0, 0.d0) / expo1 - do m = 1, 3 - K_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,r,k) - enddo phiK = ao_expo_phase_ord_transp(4,r,k) - KK2 = ao_expo_pw_ord_transp(4,r,k) schwartz_kl(0,r) = 0.d0 do s = 1, ao_prim_num(l) coef2 = coef1 * ao_coef_cgtos_norm_ord_transp(s,l) * ao_coef_cgtos_norm_ord_transp(s,l) expo2 = ao_expo_cgtos_ord_transp(s,l) - expo2_inv = (1.d0, 0.d0) / expo2 - do m = 1, 3 - L_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,s,l) - enddo phiL = ao_expo_phase_ord_transp(4,s,l) - KL2 = ao_expo_pw_ord_transp(4,s,l) - C1 = zexp(-(0.d0, 2.d0) * (phiK + phiL) - 0.5d0 * (expo1_inv * KK2 + expo2_inv * KL2)) - C2 = zexp(-(0.d0, 2.d0) * phiL - 0.5d0 * (real(expo1_inv) * KK2 + expo2_inv * KL2)) + C1 = zexp(-(0.d0, 2.d0) * (phiK + phiL)) + C2 = zexp(-(0.d0, 2.d0) * phiL) !C3 = C2 - C4 = zexp((0.d0, 2.d0) * (phiK - phiL) - 0.5d0 * (conjg(expo1_inv) * KK2 + expo2_inv * KL2)) - C5 = zexp(-(0.d0, 2.d0) * phiK - 0.5d0 * (expo1_inv * KK2 + real(expo2_inv) * KL2)) - C6 = zexp(-(0.5d0, 0.d0) * (real(expo1_inv) * KK2 + real(expo2_inv) * KL2)) + C4 = zexp((0.d0, 2.d0) * (phiK - phiL)) + C5 = zexp(-(0.d0, 2.d0) * phiK) + C6 = (1.d0, 0.d0) !C7 = C6 !C8 = conjg(C5) @@ -711,30 +692,20 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) coef1 = ao_coef_cgtos_norm_ord_transp(p,i) expo1 = ao_expo_cgtos_ord_transp(p,i) - expo1_inv = (1.d0, 0.d0) / expo1 - do m = 1, 3 - I_center(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo1_inv * ao_expo_pw_ord_transp(m,p,i) - enddo phiI = ao_expo_phase_ord_transp(4,p,i) - KI2 = ao_expo_pw_ord_transp(4,p,i) do q = 1, ao_prim_num(j) coef2 = coef1 * ao_coef_cgtos_norm_ord_transp(q,j) expo2 = ao_expo_cgtos_ord_transp(q,j) - expo2_inv = (1.d0, 0.d0) / expo2 - do m = 1, 3 - J_center(m) = nucl_coord(jj,m) - (0.d0, 0.5d0) * expo2_inv * ao_expo_pw_ord_transp(m,q,j) - enddo phiJ = ao_expo_phase_ord_transp(4,q,j) - KJ2 = ao_expo_pw_ord_transp(4,q,j) - C1 = zexp(-(0.d0, 2.d0) * (phiI + phiJ) - 0.5d0 * (expo1_inv * KI2 + expo2_inv * KJ2)) - C2 = zexp(-(0.d0, 2.d0) * phiJ - 0.5d0 * (real(expo1_inv) * KI2 + expo2_inv * KJ2)) + C1 = zexp(-(0.d0, 2.d0) * (phiI + phiJ)) + C2 = zexp(-(0.d0, 2.d0) * phiJ) !C3 = C2 - C4 = zexp((0.d0, 2.d0) * (phiI - phiJ) - 0.5d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2)) - C5 = zexp(-(0.d0, 2.d0) * phiI - 0.5d0 * (expo1_inv * KI2 + real(expo2_inv) * KJ2)) - C6 = zexp(-(0.5d0, 0.d0) * (real(expo1_inv) * KI2 + real(expo2_inv) * KJ2)) + C4 = zexp((0.d0, 2.d0) * (phiI - phiJ)) + C5 = zexp(-(0.d0, 2.d0) * phiI) + C6 = (1.d0, 0.d0) !C7 = C6 !C8 = conjg(C5) @@ -791,41 +762,23 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) coef3 = coef2 * ao_coef_cgtos_norm_ord_transp(r,k) expo3 = ao_expo_cgtos_ord_transp(r,k) - expo3_inv = (1.d0, 0.d0) / expo3 - do m = 1, 3 - K_center(m) = nucl_coord(kk,m) - (0.d0, 0.5d0) * expo3_inv * ao_expo_pw_ord_transp(m,r,k) - enddo phiK = ao_expo_phase_ord_transp(4,r,k) - KK2 = ao_expo_pw_ord_transp(4,r,k) do s = 1, ao_prim_num(l) if(schwartz_kl(s,r)*schwartz_ij < thr) cycle coef4 = coef3 * ao_coef_cgtos_norm_ord_transp(s,l) expo4 = ao_expo_cgtos_ord_transp(s,l) - expo4_inv = (1.d0, 0.d0) / expo4 - do m = 1, 3 - L_center(m) = nucl_coord(ll,m) - (0.d0, 0.5d0) * expo4_inv * ao_expo_pw_ord_transp(m,s,l) - enddo phiL = ao_expo_phase_ord_transp(4,s,l) - KL2 = ao_expo_pw_ord_transp(4,s,l) - C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C2 = zexp((0.d0, 1.d0) * (-phiI - phiJ + phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C3 = zexp((0.d0, 1.d0) * ( phiI - phiJ - phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C4 = zexp((0.d0, 1.d0) * ( phiI - phiJ + phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + expo2_inv * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C5 = zexp((0.d0, 1.d0) * (-phiI + phiJ - phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C6 = zexp((0.d0, 1.d0) * (-phiI + phiJ + phiK - phiL) & - - 0.25d0 * (expo1_inv * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) - C7 = zexp((0.d0, 1.d0) * ( phiI + phiJ - phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + expo3_inv * KK2 + expo4_inv * KL2)) - C8 = zexp((0.d0, 1.d0) * ( phiI + phiJ + phiK - phiL) & - - 0.25d0 * (conjg(expo1_inv) * KI2 + conjg(expo2_inv) * KJ2 + conjg(expo3_inv) * KK2 + expo4_inv * KL2)) + C1 = zexp((0.d0, 1.d0) * (-phiI - phiJ - phiK - phiL)) + C2 = zexp((0.d0, 1.d0) * (-phiI - phiJ + phiK - phiL)) + C3 = zexp((0.d0, 1.d0) * ( phiI - phiJ - phiK - phiL)) + C4 = zexp((0.d0, 1.d0) * ( phiI - phiJ + phiK - phiL)) + C5 = zexp((0.d0, 1.d0) * (-phiI + phiJ - phiK - phiL)) + C6 = zexp((0.d0, 1.d0) * (-phiI + phiJ + phiK - phiL)) + C7 = zexp((0.d0, 1.d0) * ( phiI + phiJ - phiK - phiL)) + C8 = zexp((0.d0, 1.d0) * ( phiI + phiJ + phiK - phiL)) int1 = ERI_cgtos(expo1, expo2, expo3, expo4, & I_power(1), J_power(1), K_power(1), L_power(1), & @@ -937,7 +890,7 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) complex*16 :: dx(0:max_dim), Ix_pol(0:max_dim), dy(0:max_dim), Iy_pol(0:max_dim), dz(0:max_dim), Iz_pol(0:max_dim) complex*16 :: d1(0:max_dim), d_poly(0:max_dim) - complex*16 :: crint_sum_2 + complex*16 :: crint_sum !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx, Ix_pol, dy, Iy_pol, dz, Iz_pol @@ -1076,7 +1029,7 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) !DIR$ FORCEINLINE call multiply_cpoly(d_poly, n_pt_tmp, Iz_pol, n_Iz, d1, n_pt_out) - accu = crint_sum_2(n_pt_out, const, d1) + accu = crint_sum(n_pt_out, const, d1) general_primitive_integral_cgtos = fact_p * fact_q * accu * pi_5_2 * p_inv * q_inv / sq_ppq @@ -1108,25 +1061,25 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) ERI_cgtos = (0.d0, 0.d0) - ASSERT (REAL(alpha) >= 0.d0) - ASSERT (REAL(beta ) >= 0.d0) - ASSERT (REAL(delta) >= 0.d0) - ASSERT (REAL(gama ) >= 0.d0) + ASSERT (real(alpha) >= 0.d0) + ASSERT (real(beta ) >= 0.d0) + ASSERT (real(delta) >= 0.d0) + ASSERT (real(gama ) >= 0.d0) nx = a_x + b_x + c_x + d_x - if(iand(nx,1) == 1) then + if(iand(nx, 1) == 1) then ERI_cgtos = (0.d0, 0.d0) return endif ny = a_y + b_y + c_y + d_y - if(iand(ny,1) == 1) then + if(iand(ny, 1) == 1) then ERI_cgtos = (0.d0, 0.d0) return endif nz = a_z + b_z + c_z + d_z - if(iand(nz,1) == 1) then + if(iand(nz, 1) == 1) then ERI_cgtos = (0.d0, 0.d0) return endif @@ -1727,3 +1680,21 @@ recursive subroutine I_x2_pol_mult_cgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, ! --- +BEGIN_PROVIDER [logical, use_pw] + + implicit none + + logical :: exist + + use_pw = .false. + + call ezfio_has_ao_basis_ao_expo_pw(exist) + if(exist) then + PROVIDE ao_expo_pw + if(maxval(dabs(ao_expo_pw(4,:,:))) .gt. 1d-15) use_pw = .true. + endif + +END_PROVIDER + +! --- + diff --git a/src/hartree_fock/deb_ao_2e_int.irp.f b/src/hartree_fock/deb_ao_2e_int.irp.f index 94dc0bda..99b5b36a 100644 --- a/src/hartree_fock/deb_ao_2e_int.irp.f +++ b/src/hartree_fock/deb_ao_2e_int.irp.f @@ -7,7 +7,9 @@ program deb_ao_2e_int !call check_crint1() !call check_crint2() !call check_crint3() - call check_crint4() + !call check_crint4() + call check_crint5() + !call check_crint6() end @@ -354,7 +356,6 @@ subroutine check_crint4() double precision :: xr(1), x, shift double precision :: yr(1), y double precision :: dif_re, dif_im, acc_re, nrm_re, acc_im, nrm_im - double precision :: delta_ref double precision :: t1, t2, t_int1, t_int2 complex*16 :: rho complex*16 :: int1, int2, int3 @@ -444,3 +445,193 @@ subroutine check_crint4() ! --- +subroutine check_crint5() + + implicit none + + integer :: i_test, n_test + integer :: i, seed_size, clock_time + integer :: n + double precision :: xr(1), yr(1), nr(1), x, shift, y + double precision :: dif1_re, dif1_im, acc1_re, acc1_im + double precision :: dif2_re, dif2_im, acc2_re, acc2_im + double precision :: nrm_re, nrm_im + double precision :: t1, t2, t_int1, t_int2 + complex*16 :: rho + complex*16 :: int1, int2, int_ref + integer, allocatable :: seed(:) + + complex*16, external :: crint_1, crint_2 + + + + call random_seed(size=seed_size) + allocate(seed(seed_size)) + call system_clock(count=clock_time) + seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) + !seed = 123456789 + call random_seed(put=seed) + + + t_int1 = 0.d0 + t_int2 = 0.d0 + + n_test = 100 + + acc1_re = 0.d0 + acc1_im = 0.d0 + acc2_re = 0.d0 + acc2_im = 0.d0 + nrm_re = 0.d0 + nrm_im = 0.d0 + do i_test = 1, n_test + + call random_number(xr) + call random_number(yr) + call random_number(nr) + + x = 1.d+1 * (30.d0 * xr(1) - 15.d0) + y = 1.d+1 * (30.d0 * yr(1) - 15.d0) + n = int(16.d0 * nr(1)) + + rho = x + (0.d0, 1.d0) * y + + call wall_time(t1) + int1 = crint_1(n, rho) + call wall_time(t2) + t_int1 = t_int1 + t2 - t1 + + call wall_time(t1) + int2 = crint_2(n, rho) + call wall_time(t2) + t_int2 = t_int2 + t2 - t1 + + call crint_quad_12(n, rho, 10000000, int_ref) + + dif1_re = dabs(real(int1) - real(int_ref)) + dif1_im = dabs(aimag(int1) - aimag(int_ref)) + + dif2_re = dabs(real(int2) - real(int_ref)) + dif2_im = dabs(aimag(int2) - aimag(int_ref)) + + if((dif2_re .gt. 1d-7) .or. (dif2_im .gt. 1d-7)) then + print*, ' important error found: ' + print*, " n, rho = ", n, x, y + print*, real(int1), real(int2), real(int_ref) + print*, aimag(int1), aimag(int2), aimag(int_ref) + !stop + endif + + acc1_re += dif1_re + acc1_im += dif1_im + + acc2_re += dif2_re + acc2_im += dif2_im + + nrm_re += dabs(real(int_ref)) + nrm_im += dabs(aimag(int_ref)) + enddo + + print*, "accuracy on boys_1 (%):", 100.d0 * acc1_re / (nrm_re + 1d-15), 100.d0 * acc1_im / (nrm_im + 1d-15) + print*, "accuracy on boys_2 (%):", 100.d0 * acc1_re / (nrm_re + 1d-15), 100.d0 * acc2_im / (nrm_im + 1d-15) + + print*, "boys_1 wall time (sec) = ", t_int1 + print*, "boys_2 wall time (sec) = ", t_int2 + + + deallocate(seed) + +end + +! --- + +subroutine check_crint6() + + implicit none + + integer :: i_test, n_test + integer :: i, seed_size, clock_time + integer :: n + double precision :: xr(1), yr(1), nr(1), x, shift, y + double precision :: dif_re, dif_im, acc_re, acc_im + double precision :: nrm_re, nrm_im + double precision :: t1, t2, t_int1, t_int2 + complex*16 :: rho + complex*16 :: int1, int2, int3 + integer, allocatable :: seed(:) + + complex*16, external :: crint_1, crint_2 + + + + call random_seed(size=seed_size) + allocate(seed(seed_size)) + call system_clock(count=clock_time) + seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) + !seed = 123456789 + call random_seed(put=seed) + + + t_int1 = 0.d0 + t_int2 = 0.d0 + + n_test = 100 + + acc_re = 0.d0 + acc_im = 0.d0 + nrm_re = 0.d0 + nrm_im = 0.d0 + do i_test = 1, n_test + + call random_number(xr) + call random_number(yr) + call random_number(nr) + + x = 1.d0 * (30.d0 * xr(1) - 15.d0) + y = 1.d0 * (30.d0 * yr(1) - 15.d0) + n = int(16.d0 * nr(1)) + + rho = x + (0.d0, 1.d0) * y + + call wall_time(t1) + int1 = crint_1(n, rho) + call wall_time(t2) + t_int1 = t_int1 + t2 - t1 + + call wall_time(t1) + int2 = crint_2(n, rho) + call wall_time(t2) + t_int2 = t_int2 + t2 - t1 + + dif_re = dabs(real(int1) - real(int2)) + dif_im = dabs(aimag(int1) - aimag(int2)) + + if((dif_re .gt. 1d-10) .or. (dif_im .gt. 1d-10)) then + print*, ' important error found: ' + print*, " n, rho = ", n, x, y + print*, real(int1), real(int2), dif_re + print*, aimag(int1), aimag(int2), dif_im + call crint_quad_12(n, rho, 100000000, int3) + print*, ' quad 100000000:', real(int3), aimag(int3) + !print*, ' quad 100000000:', dabs(real(int1) - real(int3)), dabs(aimag(int1) - aimag(int3)) + !stop + endif + + acc_re += dif_re + acc_im += dif_im + nrm_re += dabs(real(int1)) + nrm_im += dabs(aimag(int1)) + enddo + + print*, "diff (%):", 100.d0 * acc_re / (nrm_re + 1d-15), 100.d0 * acc_im / (nrm_im + 1d-15) + + print*, "boys_1 wall time (sec) = ", t_int1 + print*, "boys_2 wall time (sec) = ", t_int2 + + + deallocate(seed) + +end + +! --- + diff --git a/src/utils/cgtos_one_e.irp.f b/src/utils/cgtos_one_e.irp.f index 80b82eaf..a8773ce0 100644 --- a/src/utils/cgtos_one_e.irp.f +++ b/src/utils/cgtos_one_e.irp.f @@ -1,11 +1,12 @@ ! --- -complex*16 function overlap_cgaussian_x(A_center, B_center, alpha, beta, power_A, power_B, dim) +complex*16 function overlap_cgaussian_x(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, dim) BEGIN_DOC ! - ! \int_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha (x-A_x)^2) exp(- beta(x-B_X)^2) dx + ! \int_{-infty}^{+infty} (x - Ap_x)^ax (x - Bp_x)^bx exp(-alpha (x - Ae_x)^2) exp(-beta (x - Be_X)^2) dx + ! ! with complex arguments ! END_DOC @@ -14,20 +15,19 @@ include 'constants.include.F' integer, intent(in) :: dim, power_A, power_B - complex*16, intent(in) :: A_center, B_center, alpha, beta + complex*16, intent(in) :: Ae_center, alpha, Ap_center + complex*16, intent(in) :: Be_center, beta, Bp_center integer :: i, iorder_p - double precision :: fact_p_mod complex*16 :: P_new(0:max_dim), P_center, fact_p, p, inv_sq_p complex*16 :: Fc_integral - call give_explicit_cpoly_and_cgaussian_x( P_new, P_center, p, fact_p, iorder_p & - , alpha, beta, power_A, power_B, A_center, B_center, dim) + call give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_p, iorder_p, & + alpha, beta, power_A, power_B, Ae_center, Be_center, Ap_center, Bp_center, dim) - fact_p_mod = dsqrt(real(fact_p)*real(fact_p) + aimag(fact_p)*aimag(fact_p)) - if(fact_p_mod .lt. 1.d-14) then + if(zabs(fact_p) .lt. 1.d-14) then overlap_cgaussian_x = (0.d0, 0.d0) return endif @@ -37,22 +37,24 @@ overlap_cgaussian_x = (0.d0, 0.d0) do i = 0, iorder_p - overlap_cgaussian_x += P_new(i) * Fc_integral(i, inv_sq_p) + overlap_cgaussian_x = overlap_cgaussian_x + P_new(i) * Fc_integral(i, inv_sq_p) enddo - overlap_cgaussian_x *= fact_p + overlap_cgaussian_x = overlap_cgaussian_x * fact_p end ! --- -subroutine overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, & - overlap_x, overlap_y, overlap_z, overlap, dim ) +subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & + overlap_x, overlap_y, overlap_z, overlap, dim) BEGIN_DOC ! - ! S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx + ! S_x = \int (x - Ap_x)^{a_x} exp(-\alpha (x - Ae_x)^2) (x - Bp_x)^{b_x} exp(-beta (x - Be_x)^2) dx + ! ! S = S_x S_y S_z + ! ! for complex arguments ! END_DOC @@ -61,20 +63,20 @@ subroutine overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power include 'constants.include.F' integer, intent(in) :: dim, power_A(3), power_B(3) - complex*16, intent(in) :: A_center(3), B_center(3), alpha, beta + complex*16, intent(in) :: Ae_center(3), alpha, Ap_center(3) + complex*16, intent(in) :: Be_center(3), beta, Bp_center(3) complex*16, intent(out) :: overlap_x, overlap_y, overlap_z, overlap integer :: i, nmax, iorder_p(3) - double precision :: fact_p_mod complex*16 :: P_new(0:max_dim,3), P_center(3), fact_p, p, inv_sq_p complex*16 :: F_integral_tab(0:max_dim) complex*16 :: Fc_integral - call give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_p, iorder_p, alpha, beta, power_A, power_B, A_center, B_center, dim) + call give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_p, iorder_p, & + alpha, beta, power_A, power_B, Ae_center, Be_center, Ap_center, Bp_center, dim) - fact_p_mod = dsqrt(real(fact_p)*real(fact_p) + aimag(fact_p)*aimag(fact_p)) - if(fact_p_mod .lt. 1.d-14) then + if(zabs(fact_p) .lt. 1.d-14) then overlap_x = (1.d-10, 0.d0) overlap_y = (1.d-10, 0.d0) overlap_z = (1.d-10, 0.d0) @@ -96,19 +98,19 @@ subroutine overlap_cgaussian_xyz(A_center, B_center, alpha, beta, power_A, power do i = 1, iorder_p(1) overlap_x = overlap_x + P_new(i,1) * F_integral_tab(i) enddo - call cgaussian_product_x(alpha, A_center(1), beta, B_center(1), fact_p, p, P_center(1)) + call cgaussian_product_x(alpha, Ap_center(1), beta, Bp_center(1), fact_p, p, P_center(1)) overlap_x *= fact_p do i = 1, iorder_p(2) overlap_y = overlap_y + P_new(i,2) * F_integral_tab(i) enddo - call cgaussian_product_x(alpha, A_center(2), beta, B_center(2), fact_p, p, P_center(2)) + call cgaussian_product_x(alpha, Ap_center(2), beta, Bp_center(2), fact_p, p, P_center(2)) overlap_y *= fact_p do i = 1, iorder_p(3) overlap_z = overlap_z + P_new(i,3) * F_integral_tab(i) enddo - call cgaussian_product_x(alpha, A_center(3), beta, B_center(3), fact_p, p, P_center(3)) + call cgaussian_product_x(alpha, Ap_center(3), beta, Bp_center(3), fact_p, p, P_center(3)) overlap_z *= fact_p overlap = overlap_x * overlap_y * overlap_z diff --git a/src/utils/cgtos_utils.irp.f b/src/utils/cgtos_utils.irp.f index 76e96107..40c8a838 100644 --- a/src/utils/cgtos_utils.irp.f +++ b/src/utils/cgtos_utils.irp.f @@ -1,13 +1,19 @@ ! --- -subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorder, alpha, beta, a, b, A_center, B_center, dim) +subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorder, & + alpha, beta, a, b, Ae_center, Be_center, Ap_center, Bp_center, dim) BEGIN_DOC + ! ! Transform the product of - ! (x-x_A)^a (x-x_B)^b exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + ! + ! (x - x_Ap)^a (x - x_Bp)^b exp(-alpha (r - Ae)^2) exp(-beta (r - Be)^2) + ! ! into - ! fact_k \sum_{i=0}^{iorder} (x-x_P)^i exp(-p(r-P)^2) + ! + ! fact_k \sum_{i=0}^{iorder} (x - x_P)^i exp(-p (r - P)^2) + ! END_DOC implicit none @@ -15,13 +21,13 @@ subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorde integer, intent(in) :: dim integer, intent(in) :: a, b - complex*16, intent(in) :: alpha, beta, A_center, B_center + complex*16, intent(in) :: alpha, Ae_center, Ap_center + complex*16, intent(in) :: beta, Be_center, Bp_center integer, intent(out) :: iorder complex*16, intent(out) :: p, P_center, fact_k complex*16, intent(out) :: P_new(0:max_dim) integer :: n_new, i, j - double precision :: tmp_mod complex*16 :: P_a(0:max_dim), P_b(0:max_dim) complex*16 :: p_inv, ab, d_AB, tmp @@ -35,13 +41,12 @@ subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorde ! new center p_inv = (1.d0, 0.d0) / p ab = alpha * beta - P_center = (alpha * A_center + beta * B_center) * p_inv + P_center = (alpha * Ae_center + beta * Be_center) * p_inv ! get the factor - d_AB = (A_center - B_center) * (A_center - B_center) - tmp = ab * p_inv * d_AB - tmp_mod = dsqrt(REAL(tmp)*REAL(tmp) + AIMAG(tmp)*AIMAG(tmp)) - if(tmp_mod .lt. 50.d0) then + d_AB = (Ae_center - Be_center) * (Ae_center - Be_center) + tmp = ab * p_inv * d_AB + if(zabs(tmp) .lt. 50.d0) then fact_k = zexp(-tmp) else fact_k = (0.d0, 0.d0) @@ -49,7 +54,7 @@ subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorde ! Recenter the polynomials P_a and P_b on P_center !DIR$ FORCEINLINE - call recentered_cpoly2(P_a(0), A_center, P_center, a, P_b(0), B_center, P_center, b) + call recentered_cpoly2(P_a(0), Ap_center, P_center, a, P_b(0), Bp_center, P_center, b) n_new = 0 !DIR$ FORCEINLINE @@ -60,31 +65,38 @@ subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorde ! --- -subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, alpha, beta, a, b, A_center, B_center, dim) +subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, & + alpha, beta, a, b, Ae_center, Be_center, Ap_center, Bp_center, dim) BEGIN_DOC + ! ! Transforms the product of - ! (x-x_A)^a(1) (x-x_B)^b(1) (y-y_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + ! + ! (x - x_Ap)^a(1) (x - x_Bp)^b(1) exp(-alpha (x - x_Ae)^2) exp(-beta (x - x_Be)^2) x + ! (y - y_Ap)^a(2) (y - y_Bp)^b(2) exp(-alpha (y - y_Ae)^2) exp(-beta (y - y_Be)^2) x + ! (z - z_Ap)^a(3) (z - z_Bp)^b(3) exp(-alpha (z - z_Ae)^2) exp(-beta (z - z_Be)^2) + ! ! into - ! fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) - ! * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) - ! * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + ! fact_k * [sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x] exp (-p (x-P_center(1))^2) + ! * [sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y] exp (-p (y-P_center(2))^2) + ! * [sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z] exp (-p (z-P_center(3))^2) ! ! WARNING ::: IF fact_k is too smal then: ! returns a "s" function centered in zero ! with an inifinite exponent and a zero polynom coef + ! END_DOC implicit none include 'constants.include.F' integer, intent(in) :: dim, a(3), b(3) - complex*16, intent(in) :: alpha, beta, A_center(3), B_center(3) + complex*16, intent(in) :: alpha, Ap_center(3), Ae_center(3) + complex*16, intent(in) :: beta, Bp_center(3), Be_center(3) integer, intent(out) :: iorder(3) complex*16, intent(out) :: p, P_center(3), fact_k, P_new(0:max_dim,3) integer :: n_new, i, j - double precision :: tmp_mod complex*16 :: P_a(0:max_dim,3), P_b(0:max_dim,3) !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: P_a, P_b @@ -97,12 +109,11 @@ subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, P_new(0,3) = (0.d0, 0.d0) !DIR$ FORCEINLINE - call cgaussian_product(alpha, A_center, beta, B_center, fact_k, p, P_center) + call cgaussian_product(alpha, Ae_center, beta, Be_center, fact_k, p, P_center) ! IF fact_k is too smal then: returns a "s" function centered in zero ! with an inifinite exponent and a zero polynom coef - tmp_mod = dsqrt(real(fact_k)*real(fact_k) + aimag(fact_k)*aimag(fact_k)) - if(tmp_mod < 1d-14) then + if(zabs(fact_k) < 1d-14) then iorder = 0 p = (1.d+14, 0.d0) fact_k = (0.d0 , 0.d0) @@ -112,7 +123,7 @@ subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, endif !DIR$ FORCEINLINE - call recentered_cpoly2(P_a(0,1), A_center(1), P_center(1), a(1), P_b(0,1), B_center(1), P_center(1), b(1)) + call recentered_cpoly2(P_a(0,1), Ap_center(1), P_center(1), a(1), P_b(0,1), Bp_center(1), P_center(1), b(1)) iorder(1) = a(1) + b(1) do i = 0, iorder(1) P_new(i,1) = 0.d0 @@ -122,7 +133,7 @@ subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, call multiply_cpoly(P_a(0,1), a(1), P_b(0,1), b(1), P_new(0,1), n_new) !DIR$ FORCEINLINE - call recentered_cpoly2(P_a(0,2), A_center(2), P_center(2), a(2), P_b(0,2), B_center(2), P_center(2), b(2)) + call recentered_cpoly2(P_a(0,2), Ap_center(2), P_center(2), a(2), P_b(0,2), Bp_center(2), P_center(2), b(2)) iorder(2) = a(2) + b(2) do i = 0, iorder(2) P_new(i,2) = 0.d0 @@ -132,7 +143,7 @@ subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, call multiply_cpoly(P_a(0,2), a(2), P_b(0,2), b(2), P_new(0,2), n_new) !DIR$ FORCEINLINE - call recentered_cpoly2(P_a(0,3), A_center(3), P_center(3), a(3), P_b(0,3), B_center(3), P_center(3), b(3)) + call recentered_cpoly2(P_a(0,3), Ap_center(3), P_center(3), a(3), P_b(0,3), Bp_center(3), P_center(3), b(3)) iorder(3) = a(3) + b(3) do i = 0, iorder(3) P_new(i,3) = 0.d0 @@ -199,15 +210,15 @@ subroutine cgaussian_product_x(a, xa, b, xb, k, p, xp) END_DOC implicit none + complex*16, intent(in) :: a, b, xa, xb complex*16, intent(out) :: p, k, xp - double precision :: tmp_mod complex*16 :: p_inv complex*16 :: xab, ab - ASSERT (REAL(a) > 0.) - ASSERT (REAL(b) > 0.) + ASSERT (real(a) > 0.) + ASSERT (real(b) > 0.) ! new center p = a + b @@ -217,9 +228,8 @@ subroutine cgaussian_product_x(a, xa, b, xb, k, p, xp) p_inv = (1.d0, 0.d0) / p ab = a * b * p_inv - k = ab * xab*xab - tmp_mod = dsqrt(REAL(k)*REAL(k) + AIMAG(k)*AIMAG(k)) - if(tmp_mod > 40.d0) then + k = ab * xab*xab + if(zabs(k) > 40.d0) then k = (0.d0, 0.d0) xp = (0.d0, 0.d0) return @@ -337,7 +347,7 @@ subroutine add_cpoly_multiply(b, nb, cst, d, nd) enddo tmp = d(nd) - tmp_mod = dsqrt(REAL(tmp)*REAL(tmp) + AIMAG(tmp)*AIMAG(tmp)) + tmp_mod = dsqrt(real(tmp)*real(tmp) + aimag(tmp)*aimag(tmp)) do while(tmp_mod .lt. 1.d-15) nd -= 1 if(nd < 0) exit diff --git a/src/utils/cpx_boys.irp.f b/src/utils/cpx_boys.irp.f index acac1f6f..844a86a4 100644 --- a/src/utils/cpx_boys.irp.f +++ b/src/utils/cpx_boys.irp.f @@ -12,7 +12,7 @@ integer :: i, mmax double precision :: rho_mod double precision :: tmp - complex*16 :: sq_rho, rho_inv, rho_exp + complex*16 :: rho_inv, rho_exp complex*16 :: crint_smallz @@ -94,24 +94,14 @@ else - if(rho_mod .gt. 40.d0) then + rho_exp = 0.5d0 * zexp(-rho) + rho_inv = (1.d0, 0.d0) / rho - crint_1 = 0.5d0 * gamma(dble(n) + 0.5d0) / (rho**n * zsqrt(rho)) - - else - - rho_exp = 0.5d0 * zexp(-rho) - rho_inv = (1.d0, 0.d0) / rho - - call zboysfun00_1(rho, crint_1) - mmax = n - if(mmax .gt. 0) then - do i = 0, mmax-1 - crint_1 = ((dble(i) + 0.5d0) * crint_1 - rho_exp) * rho_inv - enddo - endif + call zboysfun00_1(rho, crint_1) + do i = 1, n + crint_1 = ((dble(i) - 0.5d0) * crint_1 - rho_exp) * rho_inv + enddo - endif endif return @@ -119,91 +109,120 @@ ! --- -complex*16 function crint_sum_1(n_pt_out, rho, d1) +subroutine crint_1_vec(n_max, rho, vals) implicit none include 'constants.include.F' - integer, intent(in) :: n_pt_out - complex*16, intent(in) :: rho, d1(0:n_pt_out) - - integer :: n, i, mmax - double precision :: rho_mod - complex*16 :: sq_rho, F0 - complex*16 :: rho_tmp, rho_inv, rho_exp - complex*16, allocatable :: Fm(:) + integer, intent(in) :: n_max + complex*16, intent(in) :: rho + complex*16, intent(out) :: vals(0:n_max) - complex*16 :: crint_smallz + integer :: n + double precision :: rho_mod + double precision :: tmp + complex*16 :: rho_inv, rho_exp + complex*16 :: crint_smallz rho_mod = zabs(rho) - if(rho_mod < 10.d0) then - ! small z + if(rho_mod < 3.5d0) then - if(rho_mod .lt. 1.d-15) then + if(rho_mod .lt. 0.35d0) then - crint_sum_1 = d1(0) - do i = 2, n_pt_out, 2 - n = shiftr(i, 1) - crint_sum_1 = crint_sum_1 + d1(i) / dble(n+n+1) - enddo + vals(0) = (((((((((1.3122532963802805073d-08 * rho & + - 1.450385222315046877d-07) * rho & + + 1.458916900093370682d-06) * rho & + - 0.132275132275132275d-04) * rho & + + 0.106837606837606838d-03) * rho & + - 0.757575757575757576d-03) * rho & + + 0.462962962962962963d-02) * rho & + - 0.238095238095238095d-01) * rho & + + 0.10000000000000000000d0) * rho & + - 0.33333333333333333333d0) * rho & + + 1.0d0 - else + if(n > 0) then - crint_sum_1 = d1(0) * crint_smallz(0, rho) - do i = 2, n_pt_out, 2 - n = shiftr(i, 1) - crint_sum_1 = crint_sum_1 + d1(i) * crint_smallz(n, rho) - enddo + vals(1) = (((((((((1.198144314086343d-08 * rho & + - 1.312253296380281d-07) * rho & + + 1.305346700083542d-06) * rho & + - 1.167133520074696d-05) * rho & + + 9.259259259259259d-05) * rho & + - 6.410256410256410d-04) * rho & + + 3.787878787878788d-03) * rho & + - 1.851851851851852d-02) * rho & + + 7.142857142857142d-02) * rho & + - 2.000000000000000d-01) * rho & + + 3.333333333333333d-01 - endif + if(n > 1) then - else - ! large z + vals(2) = (((((((((1.102292768959436d-08 * rho & + - 1.198144314086343d-07) * rho & + + 1.181027966742252d-06) * rho & + - 1.044277360066834d-05) * rho & + + 8.169934640522875d-05) * rho & + - 5.555555555555556d-04) * rho & + + 3.205128205128205d-03) * rho & + - 1.515151515151515d-02) * rho & + + 5.555555555555555d-02) * rho & + - 1.428571428571428d-01) * rho & + + 2.000000000000000d-01 - if(rho_mod .gt. 40.d0) then + if(n > 2) then - rho_inv = (1.d0, 0.d0) / rho - rho_tmp = 0.5d0 * sqpi * zsqrt(rho_inv) + vals(3) = (((((((((1.020641452740218d-08 * rho & + - 1.102292768959436d-07) * rho & + + 1.078329882677709d-06) * rho & + - 9.448223733938020d-06) * rho & + + 7.309941520467836d-05) * rho & + - 4.901960784313725d-04) * rho & + + 2.777777777777778d-03) * rho & + - 1.282051282051282d-02) * rho & + + 4.545454545454546d-02) * rho & + - 1.111111111111111d-01) * rho & + + 1.428571428571428d-01 - crint_sum_1 = rho_tmp * d1(0) - do i = 2, n_pt_out, 2 - n = shiftr(i, 1) - rho_tmp = rho_tmp * (dble(n) + 0.5d0) * rho_inv - crint_sum_1 = crint_sum_1 + rho_tmp * d1(i) - enddo + do n = 4, n_max + tmp = dble(n + n + 1) + vals(n) = (((((((((2.755731922398589d-07 * rho / (tmp + 20.d0) & + - 2.755731922398589d-06 / (tmp + 18.d0)) * rho & + + 2.480158730158730d-05 / (tmp + 16.d0)) * rho & + - 1.984126984126984d-04 / (tmp + 14.d0)) * rho & + + 1.388888888888889d-03 / (tmp + 12.d0)) * rho & + - 8.333333333333333d-03 / (tmp + 10.d0)) * rho & + + 4.166666666666666d-02 / (tmp + 8.d0)) * rho & + - 1.666666666666667d-01 / (tmp + 6.d0)) * rho & + + 5.000000000000000d-01 / (tmp + 4.d0)) * rho & + - 1.000000000000000d+00 / (tmp + 2.d0)) * rho & + + 1.0d0 / tmp + enddo - else + endif ! n > 2 + endif ! n > 1 + endif ! n > 0 - call zboysfun00_1(rho, F0) - crint_sum_1 = F0 * d1(0) + else - rho_exp = 0.5d0 * zexp(-rho) - rho_inv = (1.d0, 0.d0) / rho + call crint_smallz_vec(n_max, rho, vals) - mmax = shiftr(n_pt_out, 1) - if(mmax .gt. 0) then + endif - allocate(Fm(mmax)) - Fm(1:mmax) = (0.d0, 0.d0) + else - do n = 0, mmax-1 - F0 = ((dble(n) + 0.5d0) * F0 - rho_exp) * rho_inv - Fm(n+1) = F0 - enddo - - do i = 2, n_pt_out, 2 - n = shiftr(i, 1) - crint_sum_1 = crint_sum_1 + Fm(n) * d1(i) - enddo + rho_exp = 0.5d0 * zexp(-rho) + rho_inv = (1.d0, 0.d0) / rho - deallocate(Fm) - endif + call zboysfun00_1(rho, vals(0)) + do n = 1, n_max + vals(n) = ((dble(n) - 0.5d0) * vals(n-1) - rho_exp) * rho_inv + enddo - endif ! rho_mod - endif ! rho_mod + endif + return end ! --- @@ -433,7 +452,7 @@ subroutine zboysfunnrp(n_max, x, vals) ! --- -complex*16 function crint_sum_2(n_pt_out, rho, d1) +complex*16 function crint_sum(n_pt_out, rho, d1) implicit none @@ -448,13 +467,14 @@ subroutine zboysfunnrp(n_max, x, vals) n_max = shiftr(n_pt_out, 1) allocate(vals(0:n_max)) + call crint_1_vec(n_max, rho, vals) !call crint_2_vec(n_max, rho, vals) ! FOR DEBUG - call crint_quad_12_vec(n_max, rho, vals) + !call crint_quad_12_vec(n_max, rho, vals) - crint_sum_2 = d1(0) * vals(0) + crint_sum = d1(0) * vals(0) do i = 2, n_pt_out, 2 - crint_sum_2 += d1(i) * vals(shiftr(i, 1)) + crint_sum += d1(i) * vals(shiftr(i, 1)) enddo deallocate(vals) From 4da6a2aea07465e56dcea04a0a1d5b362447e788 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Fri, 18 Oct 2024 09:50:39 +0200 Subject: [PATCH 003/175] fixed bug in cGTOS overlaps --- src/ao_basis/aos.irp.f | 4 -- src/ao_one_e_ints/aos_cgtos.irp.f | 13 ++++-- src/utils/cgtos_one_e.irp.f | 68 +++++++++++++++++++------------ src/utils/cgtos_utils.irp.f | 38 +++++++---------- 4 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index 1cbd3976..09604487 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -75,10 +75,6 @@ enddo endif - powA(1) = ao_power(i,1) - powA(2) = ao_power(i,2) - powA(3) = ao_power(i,3) - ! Normalization of the contracted basis functions if (ao_normalized) then norm = 0.d0 diff --git a/src/ao_one_e_ints/aos_cgtos.irp.f b/src/ao_one_e_ints/aos_cgtos.irp.f index b5dd5263..f89dfd09 100644 --- a/src/ao_one_e_ints/aos_cgtos.irp.f +++ b/src/ao_one_e_ints/aos_cgtos.irp.f @@ -4,6 +4,7 @@ BEGIN_PROVIDER [double precision, ao_coef_cgtos_norm_ord_transp, (ao_prim_num_max, ao_num)] implicit none + integer :: i, j do j = 1, ao_num @@ -62,9 +63,9 @@ powA(2) = ao_power(i,2) powA(3) = ao_power(i,3) - ! Normalization of the primitives if(primitives_normalized) then + ! Normalization of the primitives do j = 1, ao_prim_num(i) expo = ao_expo(i,j) + (0.d0, 1.d0) * ao_expo_im(i,j) @@ -81,11 +82,15 @@ C1 = zexp(-(0.d0, 2.d0) * phiA - 0.5d0 * expo_inv * KA2) C2 = zexp(-(0.5d0, 0.d0) * real(expo_inv) * KA2) - call overlap_cgaussian_xyz(C_Ae, C_Ae, expo, expo, powA, powA, C_Ap, C_Ap, overlap_x, overlap_y, overlap_z, integ1, nz) - call overlap_cgaussian_xyz(conjg(C_Ae), C_Ae, conjg(expo), expo, powA, powA, conjg(C_Ap), C_Ap, overlap_x, overlap_y, overlap_z, integ2, nz) + call overlap_cgaussian_xyz(C_Ae, C_Ae, expo, expo, powA, powA, & + C_Ap, C_Ap, overlap_x, overlap_y, overlap_z, integ1, nz) + + call overlap_cgaussian_xyz(conjg(C_Ae), C_Ae, conjg(expo), expo, powA, powA, & + conjg(C_Ap), C_Ap, overlap_x, overlap_y, overlap_z, integ2, nz) norm = 2.d0 * real(C1 * integ1 + C2 * integ2) + !ao_coef_norm_cgtos(i,j) = 1.d0 / dsqrt(norm) ao_coef_norm_cgtos(i,j) = ao_coef(i,j) / dsqrt(norm) enddo @@ -95,7 +100,7 @@ ao_coef_norm_cgtos(i,j) = ao_coef(i,j) enddo - endif + endif ! primitives_normalized enddo diff --git a/src/utils/cgtos_one_e.irp.f b/src/utils/cgtos_one_e.irp.f index a8773ce0..dffb4e47 100644 --- a/src/utils/cgtos_one_e.irp.f +++ b/src/utils/cgtos_one_e.irp.f @@ -46,12 +46,13 @@ ! --- -subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x, overlap_y, overlap_z, overlap, dim) +subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_y, overlap_z, overlap, dim) BEGIN_DOC ! - ! S_x = \int (x - Ap_x)^{a_x} exp(-\alpha (x - Ae_x)^2) (x - Bp_x)^{b_x} exp(-beta (x - Be_x)^2) dx + ! S_x = \int (x - Ap_x)^{a_x} exp(-\alpha (x - Ae_x)^2) + ! (x - Bp_x)^{b_x} exp(-\beta (x - Be_x)^2) dx ! ! S = S_x S_y S_z ! @@ -70,11 +71,12 @@ subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, pow integer :: i, nmax, iorder_p(3) complex*16 :: P_new(0:max_dim,3), P_center(3), fact_p, p, inv_sq_p complex*16 :: F_integral_tab(0:max_dim) + complex*16 :: ab, arg - complex*16 :: Fc_integral + complex*16, external :: Fc_integral call give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_p, iorder_p, & - alpha, beta, power_A, power_B, Ae_center, Be_center, Ap_center, Bp_center, dim) + alpha, beta, power_A, power_B, Ae_center, Be_center, Ap_center, Bp_center, dim) if(zabs(fact_p) .lt. 1.d-14) then overlap_x = (1.d-10, 0.d0) @@ -85,36 +87,52 @@ subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, pow endif nmax = maxval(iorder_p) - inv_sq_p = (1.d0, 0.d0) / zsqrt(p) do i = 0, nmax F_integral_tab(i) = Fc_integral(i, inv_sq_p) enddo - overlap_x = P_new(0,1) * F_integral_tab(0) - overlap_y = P_new(0,2) * F_integral_tab(0) - overlap_z = P_new(0,3) * F_integral_tab(0) - - do i = 1, iorder_p(1) - overlap_x = overlap_x + P_new(i,1) * F_integral_tab(i) - enddo - call cgaussian_product_x(alpha, Ap_center(1), beta, Bp_center(1), fact_p, p, P_center(1)) - overlap_x *= fact_p + ab = alpha * beta * inv_sq_p + + arg = ab * (Ae_center(1) - Be_center(1)) & + * (Ae_center(1) - Be_center(1)) + if(real(arg) > 40.d0) then + overlap_x = (0.d0, 0.d0) + else + overlap_x = P_new(0,1) * F_integral_tab(0) + do i = 1, iorder_p(1) + overlap_x = overlap_x + P_new(i,1) * F_integral_tab(i) + enddo + overlap_x = overlap_x * zexp(-arg) + endif - do i = 1, iorder_p(2) - overlap_y = overlap_y + P_new(i,2) * F_integral_tab(i) - enddo - call cgaussian_product_x(alpha, Ap_center(2), beta, Bp_center(2), fact_p, p, P_center(2)) - overlap_y *= fact_p + arg = ab * (Ae_center(2) - Be_center(2)) & + * (Ae_center(2) - Be_center(2)) + if(real(arg) > 40.d0) then + overlap_y = (0.d0, 0.d0) + else + overlap_y = P_new(0,2) * F_integral_tab(0) + do i = 1, iorder_p(2) + overlap_y = overlap_y + P_new(i,2) * F_integral_tab(i) + enddo + overlap_y = overlap_y * zexp(-arg) + endif - do i = 1, iorder_p(3) - overlap_z = overlap_z + P_new(i,3) * F_integral_tab(i) - enddo - call cgaussian_product_x(alpha, Ap_center(3), beta, Bp_center(3), fact_p, p, P_center(3)) - overlap_z *= fact_p + arg = ab * (Ae_center(3) - Be_center(3)) & + * (Ae_center(3) - Be_center(3)) + if(real(arg) > 40.d0) then + overlap_z = (0.d0, 0.d0) + else + overlap_z = P_new(0,3) * F_integral_tab(0) + do i = 1, iorder_p(3) + overlap_z = overlap_z + P_new(i,3) * F_integral_tab(i) + enddo + overlap_z = overlap_z * zexp(-arg) + endif overlap = overlap_x * overlap_y * overlap_z + return end ! --- diff --git a/src/utils/cgtos_utils.irp.f b/src/utils/cgtos_utils.irp.f index 40c8a838..075d9bbc 100644 --- a/src/utils/cgtos_utils.irp.f +++ b/src/utils/cgtos_utils.irp.f @@ -66,7 +66,7 @@ subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorde ! --- subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, & - alpha, beta, a, b, Ae_center, Be_center, Ap_center, Bp_center, dim) + alpha, beta, a, b, Ae_center, Be_center, Ap_center, Bp_center, dim) BEGIN_DOC ! @@ -91,8 +91,8 @@ subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, include 'constants.include.F' integer, intent(in) :: dim, a(3), b(3) - complex*16, intent(in) :: alpha, Ap_center(3), Ae_center(3) - complex*16, intent(in) :: beta, Bp_center(3), Be_center(3) + complex*16, intent(in) :: alpha, Ae_center(3), Ap_center(3) + complex*16, intent(in) :: beta, Be_center(3), Bp_center(3) integer, intent(out) :: iorder(3) complex*16, intent(out) :: p, P_center(3), fact_k, P_new(0:max_dim,3) @@ -167,13 +167,12 @@ subroutine cgaussian_product(a, xa, b, xb, k, p, xp) complex*16, intent(in) :: a, b, xa(3), xb(3) complex*16, intent(out) :: p, k, xp(3) - double precision :: tmp_mod complex*16 :: p_inv, xab(3), ab !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: xab - ASSERT (REAL(a) > 0.) - ASSERT (REAL(b) > 0.) + ASSERT (real(a) > 0.) + ASSERT (real(b) > 0.) ! new exponent p = a + b @@ -185,9 +184,8 @@ subroutine cgaussian_product(a, xa, b, xb, k, p, xp) p_inv = (1.d0, 0.d0) / p ab = a * b * p_inv - k = ab * (xab(1)*xab(1) + xab(2)*xab(2) + xab(3)*xab(3)) - tmp_mod = dsqrt(real(k)*real(k) + aimag(k)*aimag(k)) - if(tmp_mod .gt. 40.d0) then + k = ab * (xab(1)*xab(1) + xab(2)*xab(2) + xab(3)*xab(3)) + if(real(k) .gt. 40.d0) then k = (0.d0, 0.d0) xp(1:3) = (0.d0, 0.d0) return @@ -228,8 +226,8 @@ subroutine cgaussian_product_x(a, xa, b, xb, k, p, xp) p_inv = (1.d0, 0.d0) / p ab = a * b * p_inv - k = ab * xab*xab - if(zabs(k) > 40.d0) then + k = ab * xab * xab + if(real(k) > 40.d0) then k = (0.d0, 0.d0) xp = (0.d0, 0.d0) return @@ -300,7 +298,6 @@ subroutine add_cpoly(b, nb, c, nc, d, nd) complex*16, intent(out) :: d(0:nb+nc) integer :: ib - double precision :: tmp_mod complex*16 :: tmp nd = nb + nc @@ -308,12 +305,10 @@ subroutine add_cpoly(b, nb, c, nc, d, nd) d(ib) = d(ib) + c(ib) + b(ib) enddo - tmp = d(nd) - tmp_mod = dsqrt(REAL(tmp)*REAL(tmp) + AIMAG(tmp)*AIMAG(tmp)) - do while( (tmp_mod .lt. 1.d-15) .and. (nd >= 0) ) + tmp = d(nd) + do while( (zabs(tmp) .lt. 1.d-15) .and. (nd >= 0) ) nd -= 1 - tmp = d(nd) - tmp_mod = dsqrt(REAL(tmp)*REAL(tmp) + AIMAG(tmp)*AIMAG(tmp)) + tmp = d(nd) if(nd < 0) exit enddo @@ -336,7 +331,6 @@ subroutine add_cpoly_multiply(b, nb, cst, d, nd) complex*16, intent(inout) :: d(0:max(nb, nd)) integer :: ib - double precision :: tmp_mod complex*16 :: tmp nd = max(nd, nb) @@ -346,13 +340,11 @@ subroutine add_cpoly_multiply(b, nb, cst, d, nd) d(ib) = d(ib) + cst * b(ib) enddo - tmp = d(nd) - tmp_mod = dsqrt(real(tmp)*real(tmp) + aimag(tmp)*aimag(tmp)) - do while(tmp_mod .lt. 1.d-15) + tmp = d(nd) + do while(zabs(tmp) .lt. 1.d-15) nd -= 1 if(nd < 0) exit - tmp = d(nd) - tmp_mod = dsqrt(REAL(tmp)*REAL(tmp) + AIMAG(tmp)*AIMAG(tmp)) + tmp = d(nd) enddo endif From 45481ac08e3b8377161650ff57b7972108f0a7d3 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Fri, 18 Oct 2024 13:42:51 +0200 Subject: [PATCH 004/175] fixed pw-centering-related bug in cGTOs kinetic integrals --- src/ao_one_e_ints/aos_cgtos.irp.f | 8 +- .../one_e_kin_integrals_cgtos.irp.f | 236 +++++++++++------- src/utils/cgtos_one_e.irp.f | 8 +- 3 files changed, 159 insertions(+), 93 deletions(-) diff --git a/src/ao_one_e_ints/aos_cgtos.irp.f b/src/ao_one_e_ints/aos_cgtos.irp.f index f89dfd09..f926c846 100644 --- a/src/ao_one_e_ints/aos_cgtos.irp.f +++ b/src/ao_one_e_ints/aos_cgtos.irp.f @@ -246,11 +246,11 @@ C2(3) = zexp((0.d0, 1.d0) * (phiA(3) - phiB(3)) - 0.25d0 * (conjg(alpha_inv) * KA2(3) + beta_inv * KB2(3))) C2(4) = C2(1) * C2(2) * C2(3) - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x1, overlap_y1, overlap_z1, overlap1, dim1) + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x1, overlap_y1, overlap_z1, overlap1, dim1) - call overlap_cgaussian_xyz(conjg(Ae_center), Be_center, conjg(alpha), beta, power_A, power_B, conjg(Ap_center), Bp_center, & - overlap_x2, overlap_y2, overlap_z2, overlap2, dim1) + call overlap_cgaussian_xyz(conjg(Ae_center), Be_center, conjg(alpha), beta, power_A, power_B, & + conjg(Ap_center), Bp_center, overlap_x2, overlap_y2, overlap_z2, overlap2, dim1) overlap_x = 2.d0 * real(C1(1) * overlap_x1 + C2(1) * overlap_x2) overlap_y = 2.d0 * real(C1(2) * overlap_y1 + C2(2) * overlap_y2) diff --git a/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f b/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f index b55c37f8..f2557fc3 100644 --- a/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f +++ b/src/ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f @@ -10,13 +10,15 @@ double precision :: c, deriv_tmp double precision :: KA2, phiA double precision :: KB2, phiB + double precision :: aa complex*16 :: alpha, alpha_inv, Ae_center(3), Ap_center(3), C1 complex*16 :: beta, beta_inv, Be_center(3), Bp_center(3), C2 + complex*16 :: xa complex*16 :: overlap_x, overlap_y, overlap_z, overlap complex*16 :: overlap_x0_1, overlap_y0_1, overlap_z0_1 complex*16 :: overlap_x0_2, overlap_y0_2, overlap_z0_2 - complex*16 :: overlap_m2_1, overlap_p2_1 - complex*16 :: overlap_m2_2, overlap_p2_2 + complex*16 :: overlap_m2_1, overlap_m1_1, overlap_p1_1, overlap_p2_1 + complex*16 :: overlap_m2_2, overlap_m1_2, overlap_p1_2, overlap_p2_2 complex*16 :: deriv_tmp_1, deriv_tmp_2 @@ -32,26 +34,27 @@ beta = (0.1d0, 0.d0) power_A = 1 power_B = 0 - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap, dim1) ! --- - !$OMP PARALLEL DO SCHEDULE(GUIDED) & - !$OMP DEFAULT(NONE) & - !$OMP PRIVATE(i, j, m, n, l, ii, jj, c, C1, C2, & - !$OMP Ae_center, power_A, alpha, alpha_inv, KA2, phiA, Ap_center, & - !$OMP Be_center, power_B, beta, beta_inv, KB2, phiB, Bp_center, & - !$OMP deriv_tmp, deriv_tmp_1, deriv_tmp_2, & - !$OMP overlap_x, overlap_y, overlap_z, overlap, & - !$OMP overlap_m2_1, overlap_p2_1, overlap_m2_2, overlap_p2_2, & - !$OMP overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap_x0_2, & - !$OMP overlap_y0_2, overlap_z0_2) & - !$OMP SHARED(nucl_coord, ao_power, ao_prim_num, ao_num, ao_nucl, dim1, & - !$OMP ao_coef_cgtos_norm_ord_transp, ao_expo_cgtos_ord_transp, & - !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & - !$OMP ao_deriv2_cgtos_x, ao_deriv2_cgtos_y, ao_deriv2_cgtos_z) - + !$OMP PARALLEL & + !$OMP DEFAULT(NONE) & + !$OMP PRIVATE(i, j, m, n, l, ii, jj, c, aa, xa, C1, C2, & + !$OMP Ae_center, power_A, alpha, alpha_inv, KA2, phiA, Ap_center, & + !$OMP Be_center, power_B, beta, beta_inv, KB2, phiB, Bp_center, & + !$OMP deriv_tmp, deriv_tmp_1, deriv_tmp_2, & + !$OMP overlap_x, overlap_y, overlap_z, overlap, & + !$OMP overlap_m2_1, overlap_m1_1, overlap_p1_1, overlap_p2_1, & + !$OMP overlap_m2_2, overlap_m1_2, overlap_p1_2, overlap_p2_2, & + !$OMP overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap_x0_2, & + !$OMP overlap_y0_2, overlap_z0_2) & + !$OMP SHARED(nucl_coord, ao_power, ao_prim_num, ao_num, ao_nucl, dim1, & + !$OMP ao_coef_cgtos_norm_ord_transp, ao_expo_cgtos_ord_transp, & + !$OMP ao_expo_pw_ord_transp, ao_expo_phase_ord_transp, & + !$OMP ao_deriv2_cgtos_x, ao_deriv2_cgtos_y, ao_deriv2_cgtos_z) + !$OMP DO SCHEDULE(GUIDED) do j = 1, ao_num jj = ao_nucl(j) @@ -97,42 +100,62 @@ C1 = zexp((0.d0, 1.d0) * (-phiA - phiB) - 0.25d0 * (alpha_inv * KA2 + beta_inv * KB2)) C2 = zexp((0.d0, 1.d0) * (-phiA + phiB) - 0.25d0 * (alpha_inv * KA2 + conjg(beta_inv) * KB2)) - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_x0_2, overlap_y0_2, overlap_z0_2, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x0_1, overlap_y0_1, overlap_z0_1, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x0_2, overlap_y0_2, overlap_z0_2, overlap, dim1) ! --- - power_A(1) = power_A(1) - 2 + power_A(1) = power_A(1) - 1 if(power_A(1) > -1) then - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_m2_1, overlap_y, overlap_z, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_m2_2, overlap_y, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_m1_1, overlap_y, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_m1_2, overlap_y, overlap_z, overlap, dim1) + power_A(1) = power_A(1) - 1 + if(power_A(1) > -1) then + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_m2_1, overlap_y, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_m2_2, overlap_y, overlap_z, overlap, dim1) + else + overlap_m2_1 = (0.d0, 0.d0) + overlap_m2_2 = (0.d0, 0.d0) + endif + power_A(1) = power_A(1) + 1 else + overlap_m1_1 = (0.d0, 0.d0) + overlap_m1_2 = (0.d0, 0.d0) overlap_m2_1 = (0.d0, 0.d0) overlap_m2_2 = (0.d0, 0.d0) endif - - power_A(1) = power_A(1) + 4 - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_p2_1, overlap_y, overlap_z, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_p2_2, overlap_y, overlap_z, overlap, dim1) - + power_A(1) = power_A(1) + 1 + + power_A(1) = power_A(1) + 1 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_p1_1, overlap_y, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_p1_2, overlap_y, overlap_z, overlap, dim1) + power_A(1) = power_A(1) + 1 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_p2_1, overlap_y, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_p2_2, overlap_y, overlap_z, overlap, dim1) power_A(1) = power_A(1) - 2 - deriv_tmp_1 = ( -2.d0 * alpha * (2.d0 * dble(power_A(1)) + 1.d0) * overlap_x0_1 & - + dble(power_A(1)) * (dble(power_A(1)) - 1.d0) * overlap_m2_1 & - + 4.d0 * alpha * alpha * overlap_p2_1 ) * overlap_y0_1 * overlap_z0_1 + aa = dble(power_A(1)) + xa = Ap_center(1) - Ae_center(1) + + deriv_tmp_1 = aa * (aa - 1.d0) * overlap_m2_1 - 4.d0 * alpha * aa * xa * overlap_m1_1 & + + 4.d0 * alpha * (alpha * xa * xa - aa - 0.5d0) * overlap_x0_1 & + + 8.d0 * alpha * alpha * (xa * overlap_p1_1 + 0.5d0 * overlap_p2_1) + deriv_tmp_1 = deriv_tmp_1 * overlap_y0_1 * overlap_z0_1 - deriv_tmp_2 = ( -2.d0 * alpha * (2.d0 * dble(power_A(1)) + 1.d0) * overlap_x0_2 & - + dble(power_A(1)) * (dble(power_A(1)) - 1.d0) * overlap_m2_2 & - + 4.d0 * alpha * alpha * overlap_p2_2 ) * overlap_y0_2 * overlap_z0_2 + deriv_tmp_2 = aa * (aa - 1.d0) * overlap_m2_2 - 4.d0 * alpha * aa * xa * overlap_m1_2 & + + 4.d0 * alpha * (alpha * xa * xa - aa - 0.5d0) * overlap_x0_2 & + + 8.d0 * alpha * alpha * (xa * overlap_p1_2 + 0.5d0 * overlap_p2_2) + deriv_tmp_2 = deriv_tmp_2 * overlap_y0_2 * overlap_z0_2 deriv_tmp = 2.d0 * real(C1 * deriv_tmp_1 + C2 * deriv_tmp_2) @@ -140,34 +163,55 @@ ! --- - power_A(2) = power_A(2) - 2 + power_A(2) = power_A(2) - 1 if(power_A(2) > -1) then - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x, overlap_m2_1, overlap_y, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_x, overlap_m2_2, overlap_y, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_m1_1, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_m1_2, overlap_z, overlap, dim1) + power_A(2) = power_A(2) - 1 + if(power_A(2) > -1) then + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_m2_1, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_m2_2, overlap_z, overlap, dim1) + else + overlap_m2_1 = (0.d0, 0.d0) + overlap_m2_2 = (0.d0, 0.d0) + endif + power_A(2) = power_A(2) + 1 else + overlap_m1_1 = (0.d0, 0.d0) + overlap_m1_2 = (0.d0, 0.d0) overlap_m2_1 = (0.d0, 0.d0) overlap_m2_2 = (0.d0, 0.d0) endif - - power_A(2) = power_A(2) + 4 - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x, overlap_p2_1, overlap_y, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_x, overlap_p2_2, overlap_y, overlap, dim1) - + power_A(2) = power_A(2) + 1 + + power_A(2) = power_A(2) + 1 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_p1_1, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_p1_2, overlap_z, overlap, dim1) + power_A(2) = power_A(2) + 1 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_p2_1, overlap_z, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_p2_2, overlap_z, overlap, dim1) power_A(2) = power_A(2) - 2 - deriv_tmp_1 = ( -2.d0 * alpha * (2.d0 * dble(power_A(2)) + 1.d0) * overlap_y0_1 & - + dble(power_A(2)) * (dble(power_A(2)) - 1.d0) * overlap_m2_1 & - + 4.d0 * alpha * alpha * overlap_p2_1 ) * overlap_x0_1 * overlap_z0_1 + aa = dble(power_A(2)) + xa = Ap_center(2) - Ae_center(2) - deriv_tmp_2 = ( -2.d0 * alpha * (2.d0 * dble(power_A(2)) + 1.d0) * overlap_y0_2 & - + dble(power_A(2)) * (dble(power_A(2)) - 1.d0) * overlap_m2_2 & - + 4.d0 * alpha * alpha * overlap_p2_2 ) * overlap_x0_2 * overlap_z0_2 + deriv_tmp_1 = aa * (aa - 1.d0) * overlap_m2_1 - 4.d0 * alpha * aa * xa * overlap_m1_1 & + + 4.d0 * alpha * (alpha * xa * xa - aa - 0.5d0) * overlap_y0_1 & + + 8.d0 * alpha * alpha * (xa * overlap_p1_1 + 0.5d0 * overlap_p2_1) + deriv_tmp_1 = deriv_tmp_1 * overlap_x0_1 * overlap_z0_1 + + deriv_tmp_2 = aa * (aa - 1.d0) * overlap_m2_2 - 4.d0 * alpha * aa * xa * overlap_m1_2 & + + 4.d0 * alpha * (alpha * xa * xa - aa - 0.5d0) * overlap_y0_2 & + + 8.d0 * alpha * alpha * (xa * overlap_p1_2 + 0.5d0 * overlap_p2_2) + deriv_tmp_2 = deriv_tmp_2 * overlap_x0_2 * overlap_z0_2 deriv_tmp = 2.d0 * real(C1 * deriv_tmp_1 + C2 * deriv_tmp_2) @@ -175,34 +219,55 @@ ! --- - power_A(3) = power_A(3) - 2 + power_A(3) = power_A(3) - 1 if(power_A(3) > -1) then - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x, overlap_y, overlap_m2_1, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_x, overlap_y, overlap_m2_2, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_y, overlap_m1_1, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_y, overlap_m1_2, overlap, dim1) + power_A(3) = power_A(3) - 1 + if(power_A(3) > -1) then + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_y, overlap_m2_1, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_y, overlap_m2_2, overlap, dim1) + else + overlap_m2_1 = (0.d0, 0.d0) + overlap_m2_2 = (0.d0, 0.d0) + endif + power_A(3) = power_A(3) + 1 else + overlap_m1_1 = (0.d0, 0.d0) + overlap_m1_2 = (0.d0, 0.d0) overlap_m2_1 = (0.d0, 0.d0) overlap_m2_2 = (0.d0, 0.d0) endif + power_A(3) = power_A(3) + 1 + + power_A(3) = power_A(3) + 1 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_y, overlap_p1_1, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_y, overlap_p1_2, overlap, dim1) + power_A(3) = power_A(3) + 1 + call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_y, overlap_p2_1, overlap, dim1) + call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, & + Ap_center, conjg(Bp_center), overlap_x, overlap_y, overlap_p2_2, overlap, dim1) + power_A(3) = power_A(3) - 2 - power_A(3) = power_A(3) + 4 - call overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, & - overlap_x, overlap_y, overlap_p2_1, overlap, dim1) - - call overlap_cgaussian_xyz(Ae_center, conjg(Be_center), alpha, conjg(beta), power_A, power_B, Ap_center, conjg(Bp_center), & - overlap_x, overlap_y, overlap_p2_2, overlap, dim1) + aa = dble(power_A(3)) + xa = Ap_center(3) - Ae_center(3) - power_A(3) = power_A(3) - 2 - - deriv_tmp_1 = ( -2.d0 * alpha * (2.d0 * dble(power_A(3)) + 1.d0) * overlap_z0_1 & - + dble(power_A(3)) * (dble(power_A(3)) - 1.d0) * overlap_m2_1 & - + 4.d0 * alpha * alpha * overlap_p2_1 ) * overlap_x0_1 * overlap_y0_1 + deriv_tmp_1 = aa * (aa - 1.d0) * overlap_m2_1 - 4.d0 * alpha * aa * xa * overlap_m1_1 & + + 4.d0 * alpha * (alpha * xa * xa - aa - 0.5d0) * overlap_z0_1 & + + 8.d0 * alpha * alpha * (xa * overlap_p1_1 + 0.5d0 * overlap_p2_1) + deriv_tmp_1 = deriv_tmp_1 * overlap_x0_1 * overlap_y0_1 - deriv_tmp_2 = ( -2.d0 * alpha * (2.d0 * dble(power_A(3)) + 1.d0) * overlap_z0_2 & - + dble(power_A(3)) * (dble(power_A(3)) - 1.d0) * overlap_m2_2 & - + 4.d0 * alpha * alpha * overlap_p2_2 ) * overlap_x0_2 * overlap_y0_2 + deriv_tmp_2 = aa * (aa - 1.d0) * overlap_m2_2 - 4.d0 * alpha * aa * xa * overlap_m1_2 & + + 4.d0 * alpha * (alpha * xa * xa - aa - 0.5d0) * overlap_z0_2 & + + 8.d0 * alpha * alpha * (xa * overlap_p1_2 + 0.5d0 * overlap_p2_2) + deriv_tmp_2 = deriv_tmp_2 * overlap_x0_2 * overlap_y0_2 deriv_tmp = 2.d0 * real(C1 * deriv_tmp_1 + C2 * deriv_tmp_2) @@ -214,7 +279,8 @@ enddo enddo enddo - !$OMP END PARALLEL DO + !$OMP END DO + !$OMP END PARALLEL END_PROVIDER diff --git a/src/utils/cgtos_one_e.irp.f b/src/utils/cgtos_one_e.irp.f index dffb4e47..83616969 100644 --- a/src/utils/cgtos_one_e.irp.f +++ b/src/utils/cgtos_one_e.irp.f @@ -79,10 +79,10 @@ subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, pow alpha, beta, power_A, power_B, Ae_center, Be_center, Ap_center, Bp_center, dim) if(zabs(fact_p) .lt. 1.d-14) then - overlap_x = (1.d-10, 0.d0) - overlap_y = (1.d-10, 0.d0) - overlap_z = (1.d-10, 0.d0) - overlap = (1.d-10, 0.d0) + overlap_x = (0.d0, 0.d0) + overlap_y = (0.d0, 0.d0) + overlap_z = (0.d0, 0.d0) + overlap = (0.d0, 0.d0) return endif From ed6e77d45ee17fdd033dbf1321c7762cb988904d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Oct 2024 16:52:28 +0200 Subject: [PATCH 005/175] Fixed assert tooth width --- src/cipsi_utils/pt2_stoch_routines.irp.f | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cipsi_utils/pt2_stoch_routines.irp.f b/src/cipsi_utils/pt2_stoch_routines.irp.f index 100335f6..744c4006 100644 --- a/src/cipsi_utils/pt2_stoch_routines.irp.f +++ b/src/cipsi_utils/pt2_stoch_routines.irp.f @@ -894,9 +894,8 @@ integer function pt2_find_sample_lr(v, w, l_in, r_in) do t=1, pt2_N_teeth tooth_width = tilde_cW(pt2_n_0(t+1)) - tilde_cW(pt2_n_0(t)) if (tooth_width == 0.d0) then - tooth_width = sum(tilde_w(pt2_n_0(t):pt2_n_0(t+1))) + tooth_width = max(1.d-15,sum(tilde_w(pt2_n_0(t):pt2_n_0(t+1)))) endif - ASSERT(tooth_width > 0.d0) do i=pt2_n_0(t)+1, pt2_n_0(t+1) pt2_w(i) = tilde_w(i) * pt2_W_T / tooth_width end do From f6728533f988fefea323acdbded36a90d5ecaa62 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Fri, 18 Oct 2024 19:04:49 +0200 Subject: [PATCH 006/175] fixed index-4 bug in use_pw --- src/ao_one_e_ints/aos_cgtos.irp.f | 4 ++-- .../one_e_coul_integrals_cgtos.irp.f | 4 ++-- .../two_e_coul_integrals_cgtos.irp.f | 4 ++-- src/utils/cpx_boys.irp.f | 24 +++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ao_one_e_ints/aos_cgtos.irp.f b/src/ao_one_e_ints/aos_cgtos.irp.f index f926c846..62c312f8 100644 --- a/src/ao_one_e_ints/aos_cgtos.irp.f +++ b/src/ao_one_e_ints/aos_cgtos.irp.f @@ -18,8 +18,8 @@ ! --- BEGIN_PROVIDER [complex*16, ao_expo_cgtos_ord_transp, (ao_prim_num_max, ao_num)] -&BEGIN_PROVIDER [complex*16, ao_expo_pw_ord_transp, (4, ao_prim_num_max, ao_num)] -&BEGIN_PROVIDER [complex*16, ao_expo_phase_ord_transp, (4, ao_prim_num_max, ao_num)] +&BEGIN_PROVIDER [double precision, ao_expo_pw_ord_transp, (4, ao_prim_num_max, ao_num)] +&BEGIN_PROVIDER [double precision, ao_expo_phase_ord_transp, (4, ao_prim_num_max, ao_num)] implicit none diff --git a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f index fed5f29d..9294b139 100644 --- a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f +++ b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f @@ -129,6 +129,7 @@ complex*16, external :: V_n_e_cgtos complex*16, external :: crint_sum + complex*16, external :: crint_1 @@ -178,8 +179,7 @@ n_pt = 2 * ((power_A(1) + power_B(1)) + (power_A(2) + power_B(2)) + (power_A(3) + power_B(3))) if(n_pt == 0) then - !NAI_pol_mult_cgtos = coeff * crint_1(0, const) - NAI_pol_mult_cgtos = coeff * crint_sum(0, const, (1.d0, 0.d0)) + NAI_pol_mult_cgtos = coeff * crint_1(0, const) return endif diff --git a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f index 9414e851..3cdb6b73 100644 --- a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f +++ b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f @@ -1690,8 +1690,8 @@ recursive subroutine I_x2_pol_mult_cgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, call ezfio_has_ao_basis_ao_expo_pw(exist) if(exist) then - PROVIDE ao_expo_pw - if(maxval(dabs(ao_expo_pw(4,:,:))) .gt. 1d-15) use_pw = .true. + PROVIDE ao_expo_pw_ord_transp + if(maxval(dabs(ao_expo_pw_ord_transp(4,:,:))) .gt. 1d-15) use_pw = .true. endif END_PROVIDER diff --git a/src/utils/cpx_boys.irp.f b/src/utils/cpx_boys.irp.f index 844a86a4..6ddc15db 100644 --- a/src/utils/cpx_boys.irp.f +++ b/src/utils/cpx_boys.irp.f @@ -143,7 +143,7 @@ subroutine crint_1_vec(n_max, rho, vals) - 0.33333333333333333333d0) * rho & + 1.0d0 - if(n > 0) then + if(n_max > 0) then vals(1) = (((((((((1.198144314086343d-08 * rho & - 1.312253296380281d-07) * rho & @@ -157,7 +157,7 @@ subroutine crint_1_vec(n_max, rho, vals) - 2.000000000000000d-01) * rho & + 3.333333333333333d-01 - if(n > 1) then + if(n_max > 1) then vals(2) = (((((((((1.102292768959436d-08 * rho & - 1.198144314086343d-07) * rho & @@ -171,7 +171,7 @@ subroutine crint_1_vec(n_max, rho, vals) - 1.428571428571428d-01) * rho & + 2.000000000000000d-01 - if(n > 2) then + if(n_max > 2) then vals(3) = (((((((((1.020641452740218d-08 * rho & - 1.102292768959436d-07) * rho & @@ -200,9 +200,9 @@ subroutine crint_1_vec(n_max, rho, vals) + 1.0d0 / tmp enddo - endif ! n > 2 - endif ! n > 1 - endif ! n > 0 + endif ! n_max > 2 + endif ! n_max > 1 + endif ! n_max > 0 else @@ -515,7 +515,7 @@ subroutine crint_2_vec(n_max, rho, vals) - 0.33333333333333333333d0) * rho & + 1.0d0 - if(n > 0) then + if(n_max > 0) then vals(1) = (((((((((1.198144314086343d-08 * rho & - 1.312253296380281d-07) * rho & @@ -529,7 +529,7 @@ subroutine crint_2_vec(n_max, rho, vals) - 2.000000000000000d-01) * rho & + 3.333333333333333d-01 - if(n > 1) then + if(n_max > 1) then vals(2) = (((((((((1.102292768959436d-08 * rho & - 1.198144314086343d-07) * rho & @@ -543,7 +543,7 @@ subroutine crint_2_vec(n_max, rho, vals) - 1.428571428571428d-01) * rho & + 2.000000000000000d-01 - if(n > 2) then + if(n_max > 2) then vals(3) = (((((((((1.020641452740218d-08 * rho & - 1.102292768959436d-07) * rho & @@ -572,9 +572,9 @@ subroutine crint_2_vec(n_max, rho, vals) + 1.0d0 / tmp enddo - endif ! n > 2 - endif ! n > 1 - endif ! n > 0 + endif ! n_max > 2 + endif ! n_max > 1 + endif ! n_max > 0 else From 60c406a6595198712b4b36b66deb4f1dd142920f Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Sat, 19 Oct 2024 23:12:30 +0200 Subject: [PATCH 007/175] opt in Fc_integral --- src/utils/cgtos_one_e.irp.f | 2 +- src/utils/cgtos_utils.irp.f | 35 ++++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/utils/cgtos_one_e.irp.f b/src/utils/cgtos_one_e.irp.f index 83616969..1193e126 100644 --- a/src/utils/cgtos_one_e.irp.f +++ b/src/utils/cgtos_one_e.irp.f @@ -21,7 +21,7 @@ integer :: i, iorder_p complex*16 :: P_new(0:max_dim), P_center, fact_p, p, inv_sq_p - complex*16 :: Fc_integral + complex*16, external :: Fc_integral call give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_p, iorder_p, & diff --git a/src/utils/cgtos_utils.irp.f b/src/utils/cgtos_utils.irp.f index 075d9bbc..8d18ef46 100644 --- a/src/utils/cgtos_utils.irp.f +++ b/src/utils/cgtos_utils.irp.f @@ -421,11 +421,12 @@ subroutine recentered_cpoly2(P_A, x_A, x_P, a, P_B, x_B, x_Q, b) implicit none include 'constants.include.F' - integer, intent(in) :: n - complex*16, intent(in) :: inv_sq_p + integer, intent(in) :: n + complex*16, intent(in) :: inv_sq_p + complex*16 :: inv_sq_p2, inv_sq_p3, inv_sq_p4 ! (n)! - double precision :: fact + double precision, external :: fact if(n < 0) then Fc_integral = (0.d0, 0.d0) @@ -438,13 +439,29 @@ subroutine recentered_cpoly2(P_A, x_A, x_P, a, P_B, x_B, x_Q, b) return endif - if(n == 0) then + select case(n) + case(0) Fc_integral = sqpi * inv_sq_p - return - endif - - Fc_integral = sqpi * 0.5d0**n * inv_sq_p**dble(n+1) * fact(n) / fact(shiftr(n, 1)) - + case(2) + Fc_integral = 0.5d0 * sqpi * inv_sq_p * inv_sq_p * inv_sq_p + case(4) + inv_sq_p2 = inv_sq_p * inv_sq_p + Fc_integral = 0.75d0 * sqpi * inv_sq_p * inv_sq_p2 * inv_sq_p2 + case(6) + inv_sq_p3 = inv_sq_p * inv_sq_p * inv_sq_p + Fc_integral = 1.875d0 * sqpi * inv_sq_p * inv_sq_p3 * inv_sq_p3 + case(8) + inv_sq_p3 = inv_sq_p * inv_sq_p * inv_sq_p + Fc_integral = 6.5625d0 * sqpi * inv_sq_p3 * inv_sq_p3 * inv_sq_p3 + case(10) + inv_sq_p2 = inv_sq_p * inv_sq_p + inv_sq_p4 = inv_sq_p2 * inv_sq_p2 + Fc_integral = 29.53125d0 * sqpi * inv_sq_p * inv_sq_p2 * inv_sq_p4 * inv_sq_p4 + case default + Fc_integral = sqpi * 0.5d0**n * inv_sq_p**(n+1) * fact(n) / fact(shiftr(n, 1)) + end select + + return end ! --- From a38bf1bcb217330577b0391953c5a4561fc8303a Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Sat, 19 Oct 2024 23:20:37 +0200 Subject: [PATCH 008/175] fixed bug in cpx overlap --- src/utils/cgtos_one_e.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/cgtos_one_e.irp.f b/src/utils/cgtos_one_e.irp.f index 1193e126..b0924d94 100644 --- a/src/utils/cgtos_one_e.irp.f +++ b/src/utils/cgtos_one_e.irp.f @@ -92,7 +92,7 @@ subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, pow F_integral_tab(i) = Fc_integral(i, inv_sq_p) enddo - ab = alpha * beta * inv_sq_p + ab = alpha * beta * inv_sq_p * inv_sq_p arg = ab * (Ae_center(1) - Be_center(1)) & * (Ae_center(1) - Be_center(1)) From 3589688254bdb2e1a162785d0b94404622477477 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Sun, 20 Oct 2024 11:18:28 +0200 Subject: [PATCH 009/175] few opt in cgtos integrals --- .../one_e_coul_integrals_cgtos.irp.f | 31 ++++++++++--------- src/utils/cgtos_one_e.irp.f | 1 + src/utils/cgtos_utils.irp.f | 4 ++- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f index 9294b139..77dda248 100644 --- a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f +++ b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f @@ -158,24 +158,27 @@ p_inv = (1.d0, 0.d0) / p rho = alpha * beta * p_inv - dist = (0.d0, 0.d0) - dist_integral = (0.d0, 0.d0) - do i = 1, 3 - P_center(i) = (alpha * Ae_center(i) + beta * Be_center(i)) * p_inv - dist += (Ae_center(i) - Be_center(i)) * (Ae_center(i) - Be_center(i)) - dist_integral += (P_center(i) - C_center(i)) * (P_center(i) - C_center(i)) - enddo + dist = (Ae_center(1) - Be_center(1)) * (Ae_center(1) - Be_center(1)) & + + (Ae_center(2) - Be_center(2)) * (Ae_center(2) - Be_center(2)) & + + (Ae_center(3) - Be_center(3)) * (Ae_center(3) - Be_center(3)) const_factor = dist * rho - const = p * dist_integral - - if(abs(const_factor) > 80.d0) then + if(real(const_factor) > 80.d0) then NAI_pol_mult_cgtos = (0.d0, 0.d0) return endif + P_center(1) = (alpha * Ae_center(1) + beta * Be_center(1)) * p_inv + P_center(2) = (alpha * Ae_center(2) + beta * Be_center(2)) * p_inv + P_center(3) = (alpha * Ae_center(3) + beta * Be_center(3)) * p_inv + + dist_integral = (P_center(1) - C_center(1)) * (P_center(1) - C_center(1)) & + + (P_center(2) - C_center(2)) * (P_center(2) - C_center(2)) & + + (P_center(3) - C_center(3)) * (P_center(3) - C_center(3)) + + const = p * dist_integral factor = zexp(-const_factor) - coeff = dtwo_pi * factor * p_inv + coeff = dtwo_pi * factor * p_inv n_pt = 2 * ((power_A(1) + power_B(1)) + (power_A(2) + power_B(2)) + (power_A(3) + power_B(3))) if(n_pt == 0) then @@ -219,7 +222,7 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & integer :: a_x, b_x, a_y, b_y, a_z, b_z integer :: n_pt1, n_pt2, n_pt3, dim, i, n_pt_tmp complex*16 :: p, P_center(3), rho, p_inv, p_inv_2 - complex*16 :: R1x(0:2), B01(0:2), R1xp(0:2),R2x(0:2) + complex*16 :: R1x(0:2), B01(0:2), R1xp(0:2), R2x(0:2) complex*16 :: d1(0:n_pt_in), d2(0:n_pt_in), d3(0:n_pt_in) ASSERT (n_pt_in > 1) @@ -354,13 +357,13 @@ recursive subroutine I_x1_pol_mult_one_e_cgtos(a, c, R1x, R1xp, R2x, d, nd, n_pt dim = n_pt_in - if( (a==0) .and. (c==0)) then + if((a == 0) .and. (c == 0)) then nd = 0 d(0) = (1.d0, 0.d0) return - elseif( (c < 0) .or. (nd < 0) ) then + elseif((c < 0) .or. (nd < 0)) then nd = -1 return diff --git a/src/utils/cgtos_one_e.irp.f b/src/utils/cgtos_one_e.irp.f index b0924d94..f4a0b7de 100644 --- a/src/utils/cgtos_one_e.irp.f +++ b/src/utils/cgtos_one_e.irp.f @@ -42,6 +42,7 @@ overlap_cgaussian_x = overlap_cgaussian_x * fact_p + return end ! --- diff --git a/src/utils/cgtos_utils.irp.f b/src/utils/cgtos_utils.irp.f index 8d18ef46..a4e90c7d 100644 --- a/src/utils/cgtos_utils.irp.f +++ b/src/utils/cgtos_utils.irp.f @@ -164,6 +164,7 @@ subroutine cgaussian_product(a, xa, b, xb, k, p, xp) END_DOC implicit none + complex*16, intent(in) :: a, b, xa(3), xb(3) complex*16, intent(out) :: p, k, xp(3) @@ -196,6 +197,7 @@ subroutine cgaussian_product(a, xa, b, xb, k, p, xp) xp(2) = (a * xa(2) + b * xb(2)) * p_inv xp(3) = (a * xa(3) + b * xb(3)) * p_inv + return end ! --- @@ -458,7 +460,7 @@ subroutine recentered_cpoly2(P_A, x_A, x_P, a, P_B, x_B, x_Q, b) inv_sq_p4 = inv_sq_p2 * inv_sq_p2 Fc_integral = 29.53125d0 * sqpi * inv_sq_p * inv_sq_p2 * inv_sq_p4 * inv_sq_p4 case default - Fc_integral = sqpi * 0.5d0**n * inv_sq_p**(n+1) * fact(n) / fact(shiftr(n, 1)) + Fc_integral = 2.d0 * sqpi * (0.5d0 * inv_sq_p)**(n+1) * fact(n) / fact(shiftr(n, 1)) end select return From 398ca5ceb75eb681a1af353b72b71c4105e6e273 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Mon, 21 Oct 2024 18:14:23 +0200 Subject: [PATCH 010/175] fixed bug in cpx polyn multip --- .../one_e_coul_integrals_cgtos.irp.f | 37 ++- src/ao_one_e_ints/screening.irp.f | 2 +- src/ao_two_e_ints/deb_2eint_cgtos.irp.f | 153 --------- .../two_e_coul_integrals_cgtos.irp.f | 40 +-- src/ao_two_e_ints/two_e_integrals.irp.f | 1 + src/hartree_fock/deb_ao_2e_int.irp.f | 310 ++++++++++++++++-- src/utils/cgtos_utils.irp.f | 14 +- 7 files changed, 334 insertions(+), 223 deletions(-) delete mode 100644 src/ao_two_e_ints/deb_2eint_cgtos.irp.f diff --git a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f index 77dda248..7240f4a5 100644 --- a/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f +++ b/src/ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f @@ -12,16 +12,19 @@ END_DOC implicit none - integer :: power_A(3), power_B(3) - integer :: i, j, k, l, m, n, ii, jj - double precision :: c, Z, C_center(3) - double precision :: phiA, KA2 - double precision :: phiB, KB2 - complex*16 :: alpha, alpha_inv, Ae_center(3), Ap_center(3) - complex*16 :: beta, beta_inv, Be_center(3), Bp_center(3) - complex*16 :: C1, C2, I1, I2 - complex*16 :: NAI_pol_mult_cgtos + integer :: power_A(3), power_B(3) + integer :: i, j, k, l, m, n, ii, jj + double precision :: c, Z, C_center(3) + double precision :: phiA, KA2 + double precision :: phiB, KB2 + complex*16 :: alpha, alpha_inv, Ae_center(3), Ap_center(3) + complex*16 :: beta, beta_inv, Be_center(3), Bp_center(3) + complex*16 :: C1, C2, I1, I2 + + complex*16, external :: NAI_pol_mult_cgtos + + ao_integrals_n_e_cgtos = 0.d0 @@ -140,7 +143,6 @@ dist_AC += abs(Ae_center(i) - C_center(i) * (1.d0, 0.d0)) enddo - if((dist_AB .gt. 1d-13) .or. (dist_AC .gt. 1d-13) .or. use_pw) then continue @@ -217,7 +219,7 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & double precision, intent(in) :: C_center(3) complex*16, intent(in) :: alpha, beta, A_center(3), B_center(3) integer, intent(out) :: n_pt_out - complex*16, intent(out) :: d(0:n_pt_in) + complex*16, intent(inout) :: d(0:n_pt_in) integer :: a_x, b_x, a_y, b_y, a_z, b_z integer :: n_pt1, n_pt2, n_pt3, dim, i, n_pt_tmp @@ -231,9 +233,9 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & p_inv = (1.d0, 0.d0) / p p_inv_2 = 0.5d0 * p_inv - do i = 1, 3 - P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv - enddo + P_center(1) = (alpha * A_center(1) + beta * B_center(1)) * p_inv + P_center(2) = (alpha * A_center(2) + beta * B_center(2)) * p_inv + P_center(3) = (alpha * A_center(3) + beta * B_center(3)) * p_inv do i = 0, n_pt_in d(i) = (0.d0, 0.d0) @@ -260,6 +262,7 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & a_x = power_A(1) b_x = power_B(1) + call I_x1_pol_mult_one_e_cgtos(a_x, b_x, R1x, R1xp, R2x, d1, n_pt1, n_pt_in) if(n_pt1 < 0) then @@ -284,6 +287,7 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & a_y = power_A(2) b_y = power_B(2) + call I_x1_pol_mult_one_e_cgtos(a_y, b_y, R1x, R1xp, R2x, d2, n_pt2, n_pt_in) if(n_pt2 < 0) then @@ -308,6 +312,7 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & a_z = power_A(3) b_z = power_B(3) + call I_x1_pol_mult_one_e_cgtos(a_z, b_z, R1x, R1xp, R2x, d3, n_pt3, n_pt_in) if(n_pt3 < 0) then @@ -322,11 +327,9 @@ subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & n_pt_tmp = 0 call multiply_cpoly(d1, n_pt1, d2, n_pt2, d, n_pt_tmp) - do i = 0, n_pt_tmp - d1(i) = (0.d0, 0.d0) - enddo n_pt_out = 0 + d1(0:n_pt_tmp) = (0.d0, 0.d0) call multiply_cpoly(d, n_pt_tmp, d3, n_pt3, d1, n_pt_out) do i = 0, n_pt_out d(i) = d1(i) diff --git a/src/ao_one_e_ints/screening.irp.f b/src/ao_one_e_ints/screening.irp.f index 3f436743..339156db 100644 --- a/src/ao_one_e_ints/screening.irp.f +++ b/src/ao_one_e_ints/screening.irp.f @@ -3,7 +3,7 @@ logical function ao_one_e_integral_zero(i,k) integer, intent(in) :: i,k ao_one_e_integral_zero = .False. - if (.not.((io_ao_integrals_overlap/='None').or.is_periodic)) then + if (.not.((io_ao_integrals_overlap/='None').or.is_periodic.or.use_cgtos)) then if (ao_overlap_abs(i,k) < ao_one_e_integrals_threshold) then ao_one_e_integral_zero = .True. return diff --git a/src/ao_two_e_ints/deb_2eint_cgtos.irp.f b/src/ao_two_e_ints/deb_2eint_cgtos.irp.f deleted file mode 100644 index b871ff5a..00000000 --- a/src/ao_two_e_ints/deb_2eint_cgtos.irp.f +++ /dev/null @@ -1,153 +0,0 @@ - -! --- - -subroutine deb_ao_2eint_cgtos(i, j, k, l) - - BEGIN_DOC - ! integral of the AO basis or (ij|kl) - ! i(r1) j(r1) 1/r12 k(r2) l(r2) - END_DOC - - implicit none - include 'utils/constants.include.F' - - integer, intent(in) :: i, j, k, l - - integer :: p, q, r, s - integer :: num_i, num_j, num_k, num_l, dim1, I_power(3), J_power(3), K_power(3), L_power(3) - integer :: iorder_p1(3), iorder_p2(3), iorder_q1(3), iorder_q2(3) - complex*16 :: I_center(3), J_center(3), K_center(3), L_center(3) - complex*16 :: expo1, expo2, expo3, expo4 - complex*16 :: P1_center(3), pp1 - complex*16 :: P2_center(3), pp2 - complex*16 :: Q1_center(3), qq1 - complex*16 :: Q2_center(3), qq2 - - - - dim1 = n_pt_max_integrals - - num_i = ao_nucl(i) - num_j = ao_nucl(j) - num_k = ao_nucl(k) - num_l = ao_nucl(l) - - if(num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k) then - - !print*, ao_prim_num(i), ao_prim_num(j), ao_prim_num(k), ao_prim_num(l) - - do p = 1, 3 - I_power(p) = ao_power(i,p) - J_power(p) = ao_power(j,p) - K_power(p) = ao_power(k,p) - L_power(p) = ao_power(l,p) - I_center(p) = nucl_coord(num_i,p) * (1.d0, 0.d0) - J_center(p) = nucl_coord(num_j,p) * (1.d0, 0.d0) - K_center(p) = nucl_coord(num_k,p) * (1.d0, 0.d0) - L_center(p) = nucl_coord(num_l,p) * (1.d0, 0.d0) - enddo - - do p = 1, ao_prim_num(i) - expo1 = ao_expo_cgtos_ord_transp(p,i) - !print*, "expo1 = ", expo1 - !print*, "center1 = ", I_center - - do q = 1, ao_prim_num(j) - expo2 = ao_expo_cgtos_ord_transp(q,j) - !print*, "expo2 = ", expo2 - !print*, "center2 = ", J_center - - pp1 = expo1 + expo2 - P1_center(1:3) = (expo1 * I_center(1:3) + expo2 * J_center(1:3)) / pp1 - iorder_p1(1:3) = I_power(1:3) + J_power(1:3) - - pp2 = conjg(expo1) + expo2 - P2_center(1:3) = (conjg(expo1) * I_center(1:3) + expo2 * J_center(1:3)) / pp2 - iorder_p2(1:3) = I_power(1:3) + J_power(1:3) - - do r = 1, ao_prim_num(k) - expo3 = ao_expo_cgtos_ord_transp(r,k) - !print*, "expo3 = ", expo3 - !print*, "center3 = ", K_center - - do s = 1, ao_prim_num(l) - expo4 = ao_expo_cgtos_ord_transp(s,l) - !print*, "expo4 = ", expo4 - !print*, "center4 = ", L_center - - qq1 = expo3 + expo4 - Q1_center(1:3) = (expo3 * K_center(1:3) + expo4 * L_center(1:3)) / qq1 - iorder_q1(1:3) = K_power(1:3) + L_power(1:3) - - qq2 = conjg(expo3) + expo4 - Q2_center(1:3) = (conjg(expo3) * K_center(1:3) + expo4 * L_center(1:3)) / qq2 - iorder_q2(1:3) = K_power(1:3) + L_power(1:3) - - call deb_cboys(P1_center, pp1, iorder_p1, Q1_center, qq1, iorder_q1) - call deb_cboys(P1_center, pp1, iorder_p1, Q2_center, qq2, iorder_q2) - call deb_cboys(P2_center, pp2, iorder_p2, Q1_center, qq1, iorder_q1) - call deb_cboys(P2_center, pp2, iorder_p2, Q2_center, qq2, iorder_q2) - call deb_cboys(conjg(P2_center), conjg(pp2), iorder_p2, Q1_center, qq1, iorder_q1) - call deb_cboys(conjg(P2_center), conjg(pp2), iorder_p2, Q2_center, qq2, iorder_q2) - call deb_cboys(conjg(P1_center), conjg(pp1), iorder_p1, Q1_center, qq1, iorder_q1) - call deb_cboys(conjg(P1_center), conjg(pp1), iorder_p1, Q2_center, qq2, iorder_q2) - enddo ! s - enddo ! r - enddo ! q - enddo ! p - - endif ! same centers - - return -end - -! --- - -subroutine deb_cboys(P_center, p, iorder_p, Q_center, q, iorder_q) - - - implicit none - include 'utils/constants.include.F' - - integer, intent(in) :: iorder_p(3), iorder_q(3) - complex*16, intent(in) :: P_center(3), p - complex*16, intent(in) :: Q_center(3), q - - integer :: iorder, n - complex*16 :: dist, rho - complex*16 :: int1, int2 - - complex*16, external :: crint_2 - - - dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) & - + (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) & - + (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3)) - rho = dist * p * q / (p + q) - - if(abs(rho) .lt. 1d-15) return - - iorder = 2*iorder_p(1)+2*iorder_q(1) + 2*iorder_p(2)+2*iorder_q(2) + 2*iorder_p(3)+2*iorder_q(3) - n = shiftr(iorder, 1) - - !write(33,*) n, real(rho), aimag(rho) - !print*, n, real(rho), aimag(rho) - - int1 = crint_2(n, rho) - call crint_quad_12(n, rho, 1000000, int2) - - if(abs(int1 - int2) .gt. 1d-5) then - print*, ' important error found: ' - print*, p!, P_center - print*, q!, Q_center - print*, dist - print*, " n, tho = ", n, real(rho), aimag(rho) - print*, real(int1), real(int2), dabs(real(int1-int2)) - print*, aimag(int1), aimag(int2), dabs(aimag(int1-int2)) - stop - endif - -end - -! --- - diff --git a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f index 3cdb6b73..a7521b78 100644 --- a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f +++ b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f @@ -882,15 +882,13 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) complex*16, intent(in) :: Q_new(0:max_dim,3), Q_center(3), fact_q, q, q_inv integer :: i, j, nx, ny, nz, n_Ix, n_Iy, n_Iz, iorder, n_pt_tmp, n_pt_out - double precision :: tmp_mod - double precision :: ppq_re, ppq_im, ppq_mod, sq_ppq_re, sq_ppq_im complex*16 :: pq, pq_inv, pq_inv_2, p01_1, p01_2, p10_1, p10_2, ppq, sq_ppq complex*16 :: rho, dist, const complex*16 :: accu, tmp_p, tmp_q complex*16 :: dx(0:max_dim), Ix_pol(0:max_dim), dy(0:max_dim), Iy_pol(0:max_dim), dz(0:max_dim), Iz_pol(0:max_dim) complex*16 :: d1(0:max_dim), d_poly(0:max_dim) - complex*16 :: crint_sum + complex*16, external :: crint_sum !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx, Ix_pol, dy, Iy_pol, dz, Iz_pol @@ -919,15 +917,13 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) n_Ix = 0 do i = 0, iorder_p(1) - tmp_p = P_new(i,1) - tmp_mod = dsqrt(real(tmp_p)*real(tmp_p) + aimag(tmp_p)*aimag(tmp_p)) - if(tmp_mod < thresh) cycle + tmp_p = P_new(i,1) + if(zabs(tmp_p) < thresh) cycle do j = 0, iorder_q(1) - tmp_q = tmp_p * Q_new(j,1) - tmp_mod = dsqrt(real(tmp_q)*real(tmp_q) + aimag(tmp_q)*aimag(tmp_q)) - if(tmp_mod < thresh) cycle + tmp_q = tmp_p * Q_new(j,1) + if(zabs(tmp_q) < thresh) cycle !DIR$ FORCEINLINE call give_cpolynom_mult_center_x(P_center(1), Q_center(1), i, j, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dx, nx) @@ -950,15 +946,13 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) n_Iy = 0 do i = 0, iorder_p(2) - tmp_p = P_new(i,2) - tmp_mod = dsqrt(REAL(tmp_p)*REAL(tmp_p) + AIMAG(tmp_p)*AIMAG(tmp_p)) - if(tmp_mod < thresh) cycle + tmp_p = P_new(i,2) + if(zabs(tmp_p) < thresh) cycle do j = 0, iorder_q(2) - tmp_q = tmp_p * Q_new(j,2) - tmp_mod = dsqrt(REAL(tmp_q)*REAL(tmp_q) + AIMAG(tmp_q)*AIMAG(tmp_q)) - if(tmp_mod < thresh) cycle + tmp_q = tmp_p * Q_new(j,2) + if(zabs(tmp_q) < thresh) cycle !DIR$ FORCEINLINE call give_cpolynom_mult_center_x(P_center(2), Q_center(2), i, j, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dy, ny) @@ -982,15 +976,13 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) n_Iz = 0 do i = 0, iorder_p(3) - tmp_p = P_new(i,3) - tmp_mod = dsqrt(REAL(tmp_p)*REAL(tmp_p) + AIMAG(tmp_p)*AIMAG(tmp_p)) - if(tmp_mod < thresh) cycle + tmp_p = P_new(i,3) + if(zabs(tmp_p) < thresh) cycle do j = 0, iorder_q(3) - tmp_q = tmp_p * Q_new(j,3) - tmp_mod = dsqrt(REAL(tmp_q)*REAL(tmp_q) + AIMAG(tmp_q)*AIMAG(tmp_q)) - if(tmp_mod < thresh) cycle + tmp_q = tmp_p * Q_new(j,3) + if(zabs(tmp_q) < thresh) cycle !DIR$ FORCEINLINE call give_cpolynom_mult_center_x(P_center(3), Q_center(3), i, j, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dz, nz) @@ -1028,6 +1020,9 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) !DIR$ FORCEINLINE call multiply_cpoly(d_poly, n_pt_tmp, Iz_pol, n_Iz, d1, n_pt_out) + if(n_pt_out == -1) then + return + endif accu = crint_sum(n_pt_out, const, d1) @@ -1056,7 +1051,6 @@ double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) integer :: a_x_2, b_x_2, c_x_2, d_x_2, a_y_2, b_y_2, c_y_2, d_y_2, a_z_2, b_z_2, c_z_2, d_z_2 integer :: i, j, k, l, n_pt integer :: nx, ny, nz - double precision :: ppq_re, ppq_im, ppq_mod, sq_ppq_re, sq_ppq_im complex*16 :: p, q, ppq, sq_ppq, coeff, I_f ERI_cgtos = (0.d0, 0.d0) @@ -1494,7 +1488,7 @@ recursive subroutine I_x1_pol_mult_a1_cgtos(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt complex*16 :: Y(0:max_dim) !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: X,Y - if( (c < 0) .or. (nd < 0) ) then + if((c < 0) .or. (nd < 0)) then nd = -1 return endif diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index ec048ab4..3734d4a0 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -46,6 +46,7 @@ double precision function ao_two_e_integral(i, j, k, l) if(use_cgtos) then ao_two_e_integral = ao_two_e_integral_cgtos(i, j, k, l) + return else if (use_only_lr) then diff --git a/src/hartree_fock/deb_ao_2e_int.irp.f b/src/hartree_fock/deb_ao_2e_int.irp.f index 99b5b36a..7b8f95e6 100644 --- a/src/hartree_fock/deb_ao_2e_int.irp.f +++ b/src/hartree_fock/deb_ao_2e_int.irp.f @@ -3,18 +3,134 @@ program deb_ao_2e_int implicit none + !call main() + call check_ao_one_e_integral_cgtos() !call check_ao_two_e_integral_cgtos() !call check_crint1() !call check_crint2() !call check_crint3() !call check_crint4() - call check_crint5() + !call check_crint5() !call check_crint6() end ! --- +subroutine main() + + implicit none + + integer :: i, j + + + PROVIDE ao_overlap + PROVIDE ao_kinetic_integrals + PROVIDE ao_integrals_n_e + + print*, "ao_overlap:" + do i = 1, ao_num + print*, (ao_overlap(i,j), j=1, ao_num) + enddo + + print*, "ao_kinetic_integrals:" + do i = 1, ao_num + print*, (ao_kinetic_integrals(i,j), j=1, ao_num) + enddo + + print*, "ao_integrals_n_e:" + do i = 1, ao_num + print*, (ao_integrals_n_e(i,j), j=1, ao_num) + enddo + + return +end + +! --- + +subroutine check_ao_one_e_integral_cgtos() + + implicit none + + integer :: i, j + double precision :: acc, nrm, dif + double precision :: tmp1, tmp2 + double precision :: t1, t2, tt + + PROVIDE ao_overlap ao_overlap_cgtos + PROVIDE ao_integrals_n_e ao_integrals_n_e_cgtos + PROVIDE ao_kinetic_integrals ao_kinetic_integrals_cgtos + + ! --- + +! print *, "overlap:" +! acc = 0.d0 +! nrm = 0.d0 +! do i = 1, ao_num +! do j = 1, ao_num +! tmp1 = ao_overlap (i,j) +! tmp2 = ao_overlap_cgtos(i,j) +! dif = abs(tmp1 - tmp2) +! if(dif .gt. 1d-10) then +! print*, ' error on:', i, j +! print*, tmp1, tmp2, dif +! !stop +! endif +! acc += dif +! nrm += abs(tmp1) +! enddo +! enddo +! print *, ' acc (%) = ', 100.d0 * acc / nrm +! +! ! --- +! +! print *, "kinetic:" +! acc = 0.d0 +! nrm = 0.d0 +! do i = 1, ao_num +! do j = 1, ao_num +! tmp1 = ao_kinetic_integrals (i,j) +! tmp2 = ao_kinetic_integrals_cgtos(i,j) +! dif = abs(tmp1 - tmp2) +! if(dif .gt. 1d-10) then +! print*, ' error on:', i, j +! print*, tmp1, tmp2, dif +! !stop +! endif +! acc += dif +! nrm += abs(tmp1) +! enddo +! enddo +! print *, ' acc (%) = ', 100.d0 * acc / nrm + + ! --- + + print *, "NAI:" + acc = 0.d0 + nrm = 0.d0 + do i = 1, ao_num + !do i = 9, 9 + do j = 1, ao_num + !do j = 16, 16 + tmp1 = ao_integrals_n_e (i,j) + tmp2 = ao_integrals_n_e_cgtos(i,j) + dif = dabs(tmp1 - tmp2) + if(dif .gt. 1d-10) then + print*, ' error on:', i, j + print*, tmp1, tmp2, dif + stop + endif + acc += dif + nrm += dabs(tmp1) + enddo + enddo + print *, ' acc (%) = ', 100.d0 * acc / nrm + +end + +! --- + + subroutine check_ao_two_e_integral_cgtos() implicit none @@ -22,7 +138,6 @@ subroutine check_ao_two_e_integral_cgtos() integer :: i, j, k, l double precision :: acc, nrm, dif double precision :: tmp1, tmp2 - double precision :: pw, pw0 double precision :: t1, t2, tt double precision, external :: ao_two_e_integral @@ -31,40 +146,40 @@ subroutine check_ao_two_e_integral_cgtos() acc = 0.d0 nrm = 0.d0 - pw0 = dble(ao_num**3) - pw = 0.d0 tt = 0.d0 do i = 1, ao_num + !do i = 1, 1 call wall_time(t1) do j = 1, ao_num + !do j = 1, 1 do k = 1, ao_num + !do k = 1, 1 do l = 1, ao_num + !do l = 21, 21 - call deb_ao_2eint_cgtos(i, j, k, l) + !call deb_ao_2eint_cgtos(i, j, k, l) - !tmp1 = ao_two_e_integral (i, j, k, l) - !tmp2 = ao_two_e_integral_cgtos(i, j, k, l) + tmp1 = ao_two_e_integral (i, j, k, l) + tmp2 = ao_two_e_integral_cgtos(i, j, k, l) - !print*, i, j, k, l - - !dif = abs(tmp1 - tmp2) - !!if(dif .gt. 1d-10) then - ! print*, ' error on:', i, j, k, l - ! print*, tmp1, tmp2, dif - ! !stop - !!endif - !acc += dif - !nrm += abs(tmp1) + dif = abs(tmp1 - tmp2) + if(dif .gt. 1d-10) then + print*, ' error on:', i, j, k, l + print*, tmp1, tmp2, dif + !stop + endif + acc += dif + nrm += abs(tmp1) enddo enddo enddo call wall_time(t2) tt += t2 - t1 print*, " % done = ", 100.d0 * dble(i) / ao_num - print*, ' ellepsed time (sec) =', tt + print*, ' ellapsed time (sec) =', tt enddo - !print *, ' acc (%) = ', dif * 100.d0 / nrm + !print *, ' acc (%) = ', 100.d0 * acc / nrm end @@ -635,3 +750,160 @@ subroutine check_crint6() ! --- + +! --- + +subroutine deb_ao_2eint_cgtos(i, j, k, l) + + BEGIN_DOC + ! integral of the AO basis or (ij|kl) + ! i(r1) j(r1) 1/r12 k(r2) l(r2) + END_DOC + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: i, j, k, l + + integer :: p, q, r, s + integer :: num_i, num_j, num_k, num_l, dim1, I_power(3), J_power(3), K_power(3), L_power(3) + integer :: iorder_p1(3), iorder_p2(3), iorder_q1(3), iorder_q2(3) + complex*16 :: I_center(3), J_center(3), K_center(3), L_center(3) + complex*16 :: expo1, expo2, expo3, expo4 + complex*16 :: P1_center(3), pp1 + complex*16 :: P2_center(3), pp2 + complex*16 :: Q1_center(3), qq1 + complex*16 :: Q2_center(3), qq2 + + + + dim1 = n_pt_max_integrals + + num_i = ao_nucl(i) + num_j = ao_nucl(j) + num_k = ao_nucl(k) + num_l = ao_nucl(l) + + if(num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k) then + + !print*, ao_prim_num(i), ao_prim_num(j), ao_prim_num(k), ao_prim_num(l) + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_power(j,p) + K_power(p) = ao_power(k,p) + L_power(p) = ao_power(l,p) + I_center(p) = nucl_coord(num_i,p) * (1.d0, 0.d0) + J_center(p) = nucl_coord(num_j,p) * (1.d0, 0.d0) + K_center(p) = nucl_coord(num_k,p) * (1.d0, 0.d0) + L_center(p) = nucl_coord(num_l,p) * (1.d0, 0.d0) + enddo + + do p = 1, ao_prim_num(i) + expo1 = ao_expo_cgtos_ord_transp(p,i) + !print*, "expo1 = ", expo1 + !print*, "center1 = ", I_center + + do q = 1, ao_prim_num(j) + expo2 = ao_expo_cgtos_ord_transp(q,j) + !print*, "expo2 = ", expo2 + !print*, "center2 = ", J_center + + pp1 = expo1 + expo2 + P1_center(1:3) = (expo1 * I_center(1:3) + expo2 * J_center(1:3)) / pp1 + iorder_p1(1:3) = I_power(1:3) + J_power(1:3) + + pp2 = conjg(expo1) + expo2 + P2_center(1:3) = (conjg(expo1) * I_center(1:3) + expo2 * J_center(1:3)) / pp2 + iorder_p2(1:3) = I_power(1:3) + J_power(1:3) + + do r = 1, ao_prim_num(k) + expo3 = ao_expo_cgtos_ord_transp(r,k) + !print*, "expo3 = ", expo3 + !print*, "center3 = ", K_center + + do s = 1, ao_prim_num(l) + expo4 = ao_expo_cgtos_ord_transp(s,l) + !print*, "expo4 = ", expo4 + !print*, "center4 = ", L_center + + qq1 = expo3 + expo4 + Q1_center(1:3) = (expo3 * K_center(1:3) + expo4 * L_center(1:3)) / qq1 + iorder_q1(1:3) = K_power(1:3) + L_power(1:3) + + qq2 = conjg(expo3) + expo4 + Q2_center(1:3) = (conjg(expo3) * K_center(1:3) + expo4 * L_center(1:3)) / qq2 + iorder_q2(1:3) = K_power(1:3) + L_power(1:3) + + call deb_cboys(P1_center, pp1, iorder_p1, Q1_center, qq1, iorder_q1) + call deb_cboys(P1_center, pp1, iorder_p1, Q2_center, qq2, iorder_q2) + call deb_cboys(P2_center, pp2, iorder_p2, Q1_center, qq1, iorder_q1) + call deb_cboys(P2_center, pp2, iorder_p2, Q2_center, qq2, iorder_q2) + call deb_cboys(conjg(P2_center), conjg(pp2), iorder_p2, Q1_center, qq1, iorder_q1) + call deb_cboys(conjg(P2_center), conjg(pp2), iorder_p2, Q2_center, qq2, iorder_q2) + call deb_cboys(conjg(P1_center), conjg(pp1), iorder_p1, Q1_center, qq1, iorder_q1) + call deb_cboys(conjg(P1_center), conjg(pp1), iorder_p1, Q2_center, qq2, iorder_q2) + enddo ! s + enddo ! r + enddo ! q + enddo ! p + + endif ! same centers + + return +end + +! --- + +subroutine deb_cboys(P_center, p, iorder_p, Q_center, q, iorder_q) + + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: iorder_p(3), iorder_q(3) + complex*16, intent(in) :: P_center(3), p + complex*16, intent(in) :: Q_center(3), q + + integer :: iorder, n + complex*16 :: dist, rho + complex*16 :: int1, int2 + + complex*16, external :: crint_2 + + + dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) & + + (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) & + + (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3)) + rho = dist * p * q / (p + q) + + if(real(rho) .lt. -5.d0) then + print*, 'warning ! impotant negative rho: ', rho + endif + + !if(abs(rho) .lt. 1d-15) return + + iorder = 2*iorder_p(1)+2*iorder_q(1) + 2*iorder_p(2)+2*iorder_q(2) + 2*iorder_p(3)+2*iorder_q(3) + n = shiftr(iorder, 1) + + !write(33,*) n, real(rho), aimag(rho) + !print*, n, real(rho), aimag(rho) + + int1 = crint_2(n, rho) + call crint_quad_12(n, rho, 1000000, int2) + + if(abs(int1 - int2) .gt. 1d-5) then + print*, ' important error found: ' + print*, p!, P_center + print*, q!, Q_center + print*, dist + print*, " n, tho = ", n, real(rho), aimag(rho) + print*, real(int1), real(int2), dabs(real(int1-int2)) + print*, aimag(int1), aimag(int2), dabs(aimag(int1-int2)) + stop + endif + +end + +! --- + diff --git a/src/utils/cgtos_utils.irp.f b/src/utils/cgtos_utils.irp.f index a4e90c7d..b6d3ac98 100644 --- a/src/utils/cgtos_utils.irp.f +++ b/src/utils/cgtos_utils.irp.f @@ -256,15 +256,10 @@ subroutine multiply_cpoly(b, nb, c, nc, d, nd) complex*16, intent(inout) :: d(0:nb+nc) integer, intent(out) :: nd - integer :: ndtmp, ib, ic + integer :: ib, ic - if(ior(nc, nb) >= 0) then ! True if nc>=0 and nb>=0 - continue - else - return - endif + if(ior(nc, nb) < 0) return ! False if nc>=0 and nb>=0 - ndtmp = nb + nc do ic = 0, nc d(ic) = d(ic) + c(ic) * b(0) @@ -277,9 +272,8 @@ subroutine multiply_cpoly(b, nb, c, nc, d, nd) enddo enddo - do nd = ndtmp, 0, -1 - if(abs(d(nd)) .lt. 1.d-15) cycle - exit + do nd = nb + nc, 0, -1 + if(d(nd) /= (0.d0, 0.d0)) exit enddo end From 9071a64ce103f884ba60d1407cc9c19fe5c004e5 Mon Sep 17 00:00:00 2001 From: AbdAmmar Date: Mon, 21 Oct 2024 18:16:09 +0200 Subject: [PATCH 011/175] rm deb code from HF module --- src/hartree_fock/deb_ao_2e_int.irp.f | 909 --------------------------- 1 file changed, 909 deletions(-) delete mode 100644 src/hartree_fock/deb_ao_2e_int.irp.f diff --git a/src/hartree_fock/deb_ao_2e_int.irp.f b/src/hartree_fock/deb_ao_2e_int.irp.f deleted file mode 100644 index 7b8f95e6..00000000 --- a/src/hartree_fock/deb_ao_2e_int.irp.f +++ /dev/null @@ -1,909 +0,0 @@ - -program deb_ao_2e_int - - implicit none - - !call main() - call check_ao_one_e_integral_cgtos() - !call check_ao_two_e_integral_cgtos() - !call check_crint1() - !call check_crint2() - !call check_crint3() - !call check_crint4() - !call check_crint5() - !call check_crint6() - -end - -! --- - -subroutine main() - - implicit none - - integer :: i, j - - - PROVIDE ao_overlap - PROVIDE ao_kinetic_integrals - PROVIDE ao_integrals_n_e - - print*, "ao_overlap:" - do i = 1, ao_num - print*, (ao_overlap(i,j), j=1, ao_num) - enddo - - print*, "ao_kinetic_integrals:" - do i = 1, ao_num - print*, (ao_kinetic_integrals(i,j), j=1, ao_num) - enddo - - print*, "ao_integrals_n_e:" - do i = 1, ao_num - print*, (ao_integrals_n_e(i,j), j=1, ao_num) - enddo - - return -end - -! --- - -subroutine check_ao_one_e_integral_cgtos() - - implicit none - - integer :: i, j - double precision :: acc, nrm, dif - double precision :: tmp1, tmp2 - double precision :: t1, t2, tt - - PROVIDE ao_overlap ao_overlap_cgtos - PROVIDE ao_integrals_n_e ao_integrals_n_e_cgtos - PROVIDE ao_kinetic_integrals ao_kinetic_integrals_cgtos - - ! --- - -! print *, "overlap:" -! acc = 0.d0 -! nrm = 0.d0 -! do i = 1, ao_num -! do j = 1, ao_num -! tmp1 = ao_overlap (i,j) -! tmp2 = ao_overlap_cgtos(i,j) -! dif = abs(tmp1 - tmp2) -! if(dif .gt. 1d-10) then -! print*, ' error on:', i, j -! print*, tmp1, tmp2, dif -! !stop -! endif -! acc += dif -! nrm += abs(tmp1) -! enddo -! enddo -! print *, ' acc (%) = ', 100.d0 * acc / nrm -! -! ! --- -! -! print *, "kinetic:" -! acc = 0.d0 -! nrm = 0.d0 -! do i = 1, ao_num -! do j = 1, ao_num -! tmp1 = ao_kinetic_integrals (i,j) -! tmp2 = ao_kinetic_integrals_cgtos(i,j) -! dif = abs(tmp1 - tmp2) -! if(dif .gt. 1d-10) then -! print*, ' error on:', i, j -! print*, tmp1, tmp2, dif -! !stop -! endif -! acc += dif -! nrm += abs(tmp1) -! enddo -! enddo -! print *, ' acc (%) = ', 100.d0 * acc / nrm - - ! --- - - print *, "NAI:" - acc = 0.d0 - nrm = 0.d0 - do i = 1, ao_num - !do i = 9, 9 - do j = 1, ao_num - !do j = 16, 16 - tmp1 = ao_integrals_n_e (i,j) - tmp2 = ao_integrals_n_e_cgtos(i,j) - dif = dabs(tmp1 - tmp2) - if(dif .gt. 1d-10) then - print*, ' error on:', i, j - print*, tmp1, tmp2, dif - stop - endif - acc += dif - nrm += dabs(tmp1) - enddo - enddo - print *, ' acc (%) = ', 100.d0 * acc / nrm - -end - -! --- - - -subroutine check_ao_two_e_integral_cgtos() - - implicit none - - integer :: i, j, k, l - double precision :: acc, nrm, dif - double precision :: tmp1, tmp2 - double precision :: t1, t2, tt - - double precision, external :: ao_two_e_integral - double precision, external :: ao_two_e_integral_cgtos - - acc = 0.d0 - nrm = 0.d0 - - tt = 0.d0 - do i = 1, ao_num - !do i = 1, 1 - call wall_time(t1) - do j = 1, ao_num - !do j = 1, 1 - do k = 1, ao_num - !do k = 1, 1 - do l = 1, ao_num - !do l = 21, 21 - - !call deb_ao_2eint_cgtos(i, j, k, l) - - tmp1 = ao_two_e_integral (i, j, k, l) - tmp2 = ao_two_e_integral_cgtos(i, j, k, l) - - dif = abs(tmp1 - tmp2) - if(dif .gt. 1d-10) then - print*, ' error on:', i, j, k, l - print*, tmp1, tmp2, dif - !stop - endif - acc += dif - nrm += abs(tmp1) - enddo - enddo - enddo - call wall_time(t2) - tt += t2 - t1 - print*, " % done = ", 100.d0 * dble(i) / ao_num - print*, ' ellapsed time (sec) =', tt - enddo - - !print *, ' acc (%) = ', 100.d0 * acc / nrm - -end - -! --- - -subroutine check_crint1() - - implicit none - integer :: i, n, i_rho - double precision :: dif_thr - double precision :: dif_re, dif_im, acc_re, nrm_re, acc_im, nrm_im - complex*16 :: rho_test(1:10) = (/ (1d-12, 0.d0), & - (+1d-9, +1d-6), & - (-1d-6, -1d-5), & - (+1d-3, -1d-2), & - (-1d-1, +1d-1), & - (+1d-0, +1d-1), & - (-1d+1, +1d+1), & - (+1d+2, +1d+1), & - (-1d+3, +1d+2), & - (+1d+4, +1d+4) /) - complex*16 :: rho - complex*16 :: int_an, int_nm - - double precision, external :: rint - complex*16, external :: crint_1, crint_2 - - n = 10 - dif_thr = 1d-7 - - do i_rho = 8, 10 - !do i_rho = 7, 7 - - !rho = (-10.d0, 0.1d0) - !rho = (+10.d0, 0.1d0) - rho = rho_test(i_rho) - print*, "rho = ", real(rho), aimag(rho) - - acc_re = 0.d0 - nrm_re = 0.d0 - acc_im = 0.d0 - nrm_im = 0.d0 - do i = 0, n - !int_an = crint_1(i, rho) - int_an = crint_2(i, rho) - call crint_quad_1(i, rho, 100000000, int_nm) - - dif_re = dabs(real(int_an) - real(int_nm)) - dif_im = dabs(aimag(int_an) - aimag(int_nm)) - - if((dif_re .gt. dif_thr) .or. (dif_im .gt. dif_thr)) then - print*, ' error on i =', i - print*, real(int_an), real(int_nm), dif_re - print*, aimag(int_an), aimag(int_nm), dif_im - !print*, rint(i, real(rho)) - print*, crint_1(i, rho) - !print*, crint_2(i, rho) - stop - endif - acc_re += dif_re - nrm_re += dabs(real(int_nm)) - acc_im += dif_im - nrm_im += dabs(aimag(int_nm)) - enddo - - print*, "accuracy on real part (%):", 100.d0 * acc_re / (nrm_re+1d-15) - print*, "accuracy on imag part (%):", 100.d0 * acc_im / (nrm_im+1d-15) - enddo - -end - -! --- - -subroutine check_crint2() - - implicit none - - integer :: i, n, i_rho - double precision :: dif_thr - double precision :: dif_re, dif_im, acc_re, nrm_re, acc_im, nrm_im - complex*16 :: rho_test(1:10) = (/ (1d-12, 0.d0), & - (+1d-9, +1d-6), & - (-1d-6, -1d-5), & - (+1d-3, -1d-2), & - (-1d-1, +1d-1), & - (+1d-0, +1d-1), & - (-1d+1, +1d+1), & - (+1d+2, +1d+1), & - (-1d+3, +1d+2), & - (+1d+4, +1d+4) /) - complex*16 :: rho - complex*16 :: int_an, int_nm - complex*16, external :: crint_1, crint_2 - - n = 30 - dif_thr = 1d-12 - - do i_rho = 1, 10 - rho = rho_test(i_rho) - print*, "rho = ", real(rho), aimag(rho) - - acc_re = 0.d0 - nrm_re = 0.d0 - acc_im = 0.d0 - nrm_im = 0.d0 - do i = 0, n - int_an = crint_1(i, rho) - int_nm = crint_2(i, rho) - - dif_re = dabs(real(int_an) - real(int_nm)) - !if(dif_re .gt. dif_thr) then - ! print*, ' error in real part:', i - ! print*, real(int_an), real(int_nm), dif_re - ! stop - !endif - acc_re += dif_re - nrm_re += dabs(real(int_nm)) - - dif_im = dabs(aimag(int_an) - aimag(int_nm)) - !if(dif_im .gt. dif_thr) then - ! print*, ' error in imag part:', i - ! print*, aimag(int_an), aimag(int_nm), dif_im - ! stop - !endif - acc_im += dif_im - nrm_im += dabs(aimag(int_nm)) - enddo - - print*, "accuracy on real part (%):", 100.d0 * acc_re / (nrm_re+1d-15) - print*, "accuracy on imag part (%):", 100.d0 * acc_im / (nrm_im+1d-15) - enddo - -end - -! --- - -subroutine check_crint3() - - implicit none - - integer :: i_test, n_test - integer :: nx, ny, n, n_quad - integer :: i, seed_size, clock_time - double precision :: xr(1:4), x - double precision :: yr(1:4), y - double precision :: dif_re, dif_im, acc_re, nrm_re, acc_im, nrm_im - double precision :: delta_ref - double precision :: t1, t2, t_int1, t_int2 - complex*16 :: rho - complex*16 :: int1_old, int1_ref, int2_old, int2_ref - integer, allocatable :: seed(:) - - complex*16, external :: crint_2 - - call random_seed(size=seed_size) - allocate(seed(seed_size)) - call system_clock(count=clock_time) - seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) - !seed = 123456789 - call random_seed(put=seed) - - - t_int1 = 0.d0 - t_int2 = 0.d0 - - n_test = 1 - - acc_re = 0.d0 - nrm_re = 0.d0 - acc_im = 0.d0 - nrm_im = 0.d0 - do i_test = 1, n_test - - ! Re(rho) - call random_number(xr) - x = xr(1) - if(xr(2) .gt. 0.5d0) x = -x - nx = int(15.d0 * xr(3)) - if(xr(4) .gt. 0.5d0) nx = -nx - x = x * 10.d0**nx - - ! Im(rho) - call random_number(yr) - y = yr(1) - if(yr(2) .gt. 0.5d0) y = -y - ny = int(5.d0 * yr(3)) - if(yr(4) .gt. 0.5d0) ny = -ny - y = y * 10.d0**ny - - rho = x + (0.d0, 1.d0) * y - - call random_number(x) - x = 31.d0 * x - n = int(x) - !if(n.eq.0) cycle - - n = 0 - !rho = (-6.83897018210218d0, -7.24479852507338d0) - rho = (-9.83206247355480d0, 0.445269582329036d0) - - print*, " n = ", n - print*, " rho = ", real(rho), aimag(rho) - - - call wall_time(t1) - int1_old = crint_2(n, rho) - !n_quad = 10000000 - !call crint_quad_1(n, rho, n_quad, int1_old) - !!delta_ref = 1.d0 - !!do while(delta_ref .gt. 1d-12) - !! n_quad = n_quad * 10 - !! !print*, " delta = ", delta_ref - !! !print*, " increasing n_quad to:", n_quad - !! call crint_quad_1(n, rho, n_quad, int1_ref) - !! delta_ref = abs(int1_ref - int1_old) - !! int1_old = int1_ref - !! if(n_quad .ge. 1000000000) then - !! print*, ' convergence was not reached for crint_quad_1' - !! print*, " delta = ", delta_ref - !! exit - !! endif - !!enddo - call wall_time(t2) - t_int1 = t_int1 + t2 - t1 - !print*, " n_quad for crint_quad_1:", n_quad - - call wall_time(t1) - n_quad = 10000000 - call crint_quad_12(n, rho, n_quad, int2_old) - !delta_ref = 1.d0 - !do while(delta_ref .gt. 1d-12) - ! n_quad = n_quad * 10 - ! !print*, " delta = ", delta_ref - ! !print*, " increasing n_quad to:", n_quad - ! call crint_quad_12(n, rho, n_quad, int2_ref) - ! delta_ref = abs(int2_ref - int2_old) - ! int2_old = int2_ref - ! if(n_quad .ge. 1000000000) then - ! print*, ' convergence was not reached for crint_quad_2' - ! print*, " delta = ", delta_ref - ! exit - ! endif - !enddo - call wall_time(t2) - t_int2 = t_int2 + t2 - t1 - !print*, " n_quad for crint_quad_2:", n_quad - - dif_re = dabs(real(int1_old) - real(int2_old)) - dif_im = dabs(aimag(int1_old) - aimag(int2_old)) - if((dif_re .gt. 1d-10) .or. (dif_im .gt. 1d-10)) then - print*, ' important error found: ' - print*, " n = ", n - print*, " rho = ", real(rho), aimag(rho) - print*, real(int1_old), real(int2_old), dif_re - print*, aimag(int1_old), aimag(int2_old), dif_im - !stop - endif - - if((real(int1_old) /= real(int1_old)) .or. (aimag(int1_old) /= aimag(int1_old)) .or. & - (real(int2_old) /= real(int2_old)) .or. (aimag(int2_old) /= aimag(int2_old)) ) then - cycle - else - acc_re += dif_re - acc_im += dif_im - nrm_re += dabs(real(int1_old)) - nrm_im += dabs(aimag(int1_old)) - endif - enddo - - print*, "accuracy on real part (%):", 100.d0 * acc_re / (nrm_re + 1d-15) - print*, "accuracy on imag part (%):", 100.d0 * acc_im / (nrm_im + 1d-15) - - print*, "crint_quad_1 wall time (sec) = ", t_int1 - print*, "crint_quad_2 wall time (sec) = ", t_int2 - - - deallocate(seed) - -end - -! --- - -subroutine check_crint4() - - implicit none - - integer :: i_test, n_test - integer :: i, seed_size, clock_time - double precision :: xr(1), x, shift - double precision :: yr(1), y - double precision :: dif_re, dif_im, acc_re, nrm_re, acc_im, nrm_im - double precision :: t1, t2, t_int1, t_int2 - complex*16 :: rho - complex*16 :: int1, int2, int3 - integer, allocatable :: seed(:) - - - - call random_seed(size=seed_size) - allocate(seed(seed_size)) - call system_clock(count=clock_time) - seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) - !seed = 123456789 - call random_seed(put=seed) - - - t_int1 = 0.d0 - t_int2 = 0.d0 - - n_test = 100 - shift = 15.d0 - - acc_re = 0.d0 - nrm_re = 0.d0 - acc_im = 0.d0 - nrm_im = 0.d0 - do i_test = 1, n_test - - call random_number(xr) - call random_number(yr) - - x = 1.d0 * (2.d0 * shift * xr(1) - shift) - y = 1.d0 * (2.d0 * shift * yr(1) - shift) - - rho = x + (0.d0, 1.d0) * y - - call wall_time(t1) - call zboysfun00_1(rho, int1) - call wall_time(t2) - t_int1 = t_int1 + t2 - t1 - - call wall_time(t1) - call zboysfun00_2(rho, int2) - call wall_time(t2) - t_int2 = t_int2 + t2 - t1 - - dif_re = dabs(real(int1) - real(int2)) - dif_im = dabs(aimag(int1) - aimag(int2)) - if((dif_re .gt. 1d-10) .or. (dif_im .gt. 1d-10)) then - print*, ' important error found: ' - print*, " rho = ", x, y - print*, real(int1), real(int2), dif_re - print*, aimag(int1), aimag(int2), dif_im - call crint_quad_12(0, rho, 10000000, int3) - if(zabs(int1 - int3) .lt. zabs(int2 - int3)) then - print*, ' implementation 2 seems to be wrong' - else - print*, ' implementation 1 seems to be wrong' - print*, ' quad 10000000:', real(int3), aimag(int3) - call crint_quad_12(0, rho, 100000000, int3) - print*, ' quad 100000000:', real(int3), aimag(int3) - endif - !print*, ' quad:', real(int3), aimag(int3) - !stop - endif - - if((real(int1) /= real(int1)) .or. (aimag(int1) /= aimag(int1)) .or. & - (real(int2) /= real(int2)) .or. (aimag(int2) /= aimag(int2)) ) then - cycle - else - acc_re += dif_re - acc_im += dif_im - nrm_re += dabs(real(int1)) - nrm_im += dabs(aimag(int1)) - endif - enddo - - print*, "accuracy on real part (%):", 100.d0 * acc_re / (nrm_re + 1d-15) - print*, "accuracy on imag part (%):", 100.d0 * acc_im / (nrm_im + 1d-15) - - print*, "zerf_1 wall time (sec) = ", t_int1 - print*, "zerf_2 wall time (sec) = ", t_int2 - - - deallocate(seed) - -end - -! --- - -subroutine check_crint5() - - implicit none - - integer :: i_test, n_test - integer :: i, seed_size, clock_time - integer :: n - double precision :: xr(1), yr(1), nr(1), x, shift, y - double precision :: dif1_re, dif1_im, acc1_re, acc1_im - double precision :: dif2_re, dif2_im, acc2_re, acc2_im - double precision :: nrm_re, nrm_im - double precision :: t1, t2, t_int1, t_int2 - complex*16 :: rho - complex*16 :: int1, int2, int_ref - integer, allocatable :: seed(:) - - complex*16, external :: crint_1, crint_2 - - - - call random_seed(size=seed_size) - allocate(seed(seed_size)) - call system_clock(count=clock_time) - seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) - !seed = 123456789 - call random_seed(put=seed) - - - t_int1 = 0.d0 - t_int2 = 0.d0 - - n_test = 100 - - acc1_re = 0.d0 - acc1_im = 0.d0 - acc2_re = 0.d0 - acc2_im = 0.d0 - nrm_re = 0.d0 - nrm_im = 0.d0 - do i_test = 1, n_test - - call random_number(xr) - call random_number(yr) - call random_number(nr) - - x = 1.d+1 * (30.d0 * xr(1) - 15.d0) - y = 1.d+1 * (30.d0 * yr(1) - 15.d0) - n = int(16.d0 * nr(1)) - - rho = x + (0.d0, 1.d0) * y - - call wall_time(t1) - int1 = crint_1(n, rho) - call wall_time(t2) - t_int1 = t_int1 + t2 - t1 - - call wall_time(t1) - int2 = crint_2(n, rho) - call wall_time(t2) - t_int2 = t_int2 + t2 - t1 - - call crint_quad_12(n, rho, 10000000, int_ref) - - dif1_re = dabs(real(int1) - real(int_ref)) - dif1_im = dabs(aimag(int1) - aimag(int_ref)) - - dif2_re = dabs(real(int2) - real(int_ref)) - dif2_im = dabs(aimag(int2) - aimag(int_ref)) - - if((dif2_re .gt. 1d-7) .or. (dif2_im .gt. 1d-7)) then - print*, ' important error found: ' - print*, " n, rho = ", n, x, y - print*, real(int1), real(int2), real(int_ref) - print*, aimag(int1), aimag(int2), aimag(int_ref) - !stop - endif - - acc1_re += dif1_re - acc1_im += dif1_im - - acc2_re += dif2_re - acc2_im += dif2_im - - nrm_re += dabs(real(int_ref)) - nrm_im += dabs(aimag(int_ref)) - enddo - - print*, "accuracy on boys_1 (%):", 100.d0 * acc1_re / (nrm_re + 1d-15), 100.d0 * acc1_im / (nrm_im + 1d-15) - print*, "accuracy on boys_2 (%):", 100.d0 * acc1_re / (nrm_re + 1d-15), 100.d0 * acc2_im / (nrm_im + 1d-15) - - print*, "boys_1 wall time (sec) = ", t_int1 - print*, "boys_2 wall time (sec) = ", t_int2 - - - deallocate(seed) - -end - -! --- - -subroutine check_crint6() - - implicit none - - integer :: i_test, n_test - integer :: i, seed_size, clock_time - integer :: n - double precision :: xr(1), yr(1), nr(1), x, shift, y - double precision :: dif_re, dif_im, acc_re, acc_im - double precision :: nrm_re, nrm_im - double precision :: t1, t2, t_int1, t_int2 - complex*16 :: rho - complex*16 :: int1, int2, int3 - integer, allocatable :: seed(:) - - complex*16, external :: crint_1, crint_2 - - - - call random_seed(size=seed_size) - allocate(seed(seed_size)) - call system_clock(count=clock_time) - seed = clock_time + 37 * (/ (i, i=0, seed_size-1) /) - !seed = 123456789 - call random_seed(put=seed) - - - t_int1 = 0.d0 - t_int2 = 0.d0 - - n_test = 100 - - acc_re = 0.d0 - acc_im = 0.d0 - nrm_re = 0.d0 - nrm_im = 0.d0 - do i_test = 1, n_test - - call random_number(xr) - call random_number(yr) - call random_number(nr) - - x = 1.d0 * (30.d0 * xr(1) - 15.d0) - y = 1.d0 * (30.d0 * yr(1) - 15.d0) - n = int(16.d0 * nr(1)) - - rho = x + (0.d0, 1.d0) * y - - call wall_time(t1) - int1 = crint_1(n, rho) - call wall_time(t2) - t_int1 = t_int1 + t2 - t1 - - call wall_time(t1) - int2 = crint_2(n, rho) - call wall_time(t2) - t_int2 = t_int2 + t2 - t1 - - dif_re = dabs(real(int1) - real(int2)) - dif_im = dabs(aimag(int1) - aimag(int2)) - - if((dif_re .gt. 1d-10) .or. (dif_im .gt. 1d-10)) then - print*, ' important error found: ' - print*, " n, rho = ", n, x, y - print*, real(int1), real(int2), dif_re - print*, aimag(int1), aimag(int2), dif_im - call crint_quad_12(n, rho, 100000000, int3) - print*, ' quad 100000000:', real(int3), aimag(int3) - !print*, ' quad 100000000:', dabs(real(int1) - real(int3)), dabs(aimag(int1) - aimag(int3)) - !stop - endif - - acc_re += dif_re - acc_im += dif_im - nrm_re += dabs(real(int1)) - nrm_im += dabs(aimag(int1)) - enddo - - print*, "diff (%):", 100.d0 * acc_re / (nrm_re + 1d-15), 100.d0 * acc_im / (nrm_im + 1d-15) - - print*, "boys_1 wall time (sec) = ", t_int1 - print*, "boys_2 wall time (sec) = ", t_int2 - - - deallocate(seed) - -end - -! --- - - -! --- - -subroutine deb_ao_2eint_cgtos(i, j, k, l) - - BEGIN_DOC - ! integral of the AO basis or (ij|kl) - ! i(r1) j(r1) 1/r12 k(r2) l(r2) - END_DOC - - implicit none - include 'utils/constants.include.F' - - integer, intent(in) :: i, j, k, l - - integer :: p, q, r, s - integer :: num_i, num_j, num_k, num_l, dim1, I_power(3), J_power(3), K_power(3), L_power(3) - integer :: iorder_p1(3), iorder_p2(3), iorder_q1(3), iorder_q2(3) - complex*16 :: I_center(3), J_center(3), K_center(3), L_center(3) - complex*16 :: expo1, expo2, expo3, expo4 - complex*16 :: P1_center(3), pp1 - complex*16 :: P2_center(3), pp2 - complex*16 :: Q1_center(3), qq1 - complex*16 :: Q2_center(3), qq2 - - - - dim1 = n_pt_max_integrals - - num_i = ao_nucl(i) - num_j = ao_nucl(j) - num_k = ao_nucl(k) - num_l = ao_nucl(l) - - if(num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k) then - - !print*, ao_prim_num(i), ao_prim_num(j), ao_prim_num(k), ao_prim_num(l) - - do p = 1, 3 - I_power(p) = ao_power(i,p) - J_power(p) = ao_power(j,p) - K_power(p) = ao_power(k,p) - L_power(p) = ao_power(l,p) - I_center(p) = nucl_coord(num_i,p) * (1.d0, 0.d0) - J_center(p) = nucl_coord(num_j,p) * (1.d0, 0.d0) - K_center(p) = nucl_coord(num_k,p) * (1.d0, 0.d0) - L_center(p) = nucl_coord(num_l,p) * (1.d0, 0.d0) - enddo - - do p = 1, ao_prim_num(i) - expo1 = ao_expo_cgtos_ord_transp(p,i) - !print*, "expo1 = ", expo1 - !print*, "center1 = ", I_center - - do q = 1, ao_prim_num(j) - expo2 = ao_expo_cgtos_ord_transp(q,j) - !print*, "expo2 = ", expo2 - !print*, "center2 = ", J_center - - pp1 = expo1 + expo2 - P1_center(1:3) = (expo1 * I_center(1:3) + expo2 * J_center(1:3)) / pp1 - iorder_p1(1:3) = I_power(1:3) + J_power(1:3) - - pp2 = conjg(expo1) + expo2 - P2_center(1:3) = (conjg(expo1) * I_center(1:3) + expo2 * J_center(1:3)) / pp2 - iorder_p2(1:3) = I_power(1:3) + J_power(1:3) - - do r = 1, ao_prim_num(k) - expo3 = ao_expo_cgtos_ord_transp(r,k) - !print*, "expo3 = ", expo3 - !print*, "center3 = ", K_center - - do s = 1, ao_prim_num(l) - expo4 = ao_expo_cgtos_ord_transp(s,l) - !print*, "expo4 = ", expo4 - !print*, "center4 = ", L_center - - qq1 = expo3 + expo4 - Q1_center(1:3) = (expo3 * K_center(1:3) + expo4 * L_center(1:3)) / qq1 - iorder_q1(1:3) = K_power(1:3) + L_power(1:3) - - qq2 = conjg(expo3) + expo4 - Q2_center(1:3) = (conjg(expo3) * K_center(1:3) + expo4 * L_center(1:3)) / qq2 - iorder_q2(1:3) = K_power(1:3) + L_power(1:3) - - call deb_cboys(P1_center, pp1, iorder_p1, Q1_center, qq1, iorder_q1) - call deb_cboys(P1_center, pp1, iorder_p1, Q2_center, qq2, iorder_q2) - call deb_cboys(P2_center, pp2, iorder_p2, Q1_center, qq1, iorder_q1) - call deb_cboys(P2_center, pp2, iorder_p2, Q2_center, qq2, iorder_q2) - call deb_cboys(conjg(P2_center), conjg(pp2), iorder_p2, Q1_center, qq1, iorder_q1) - call deb_cboys(conjg(P2_center), conjg(pp2), iorder_p2, Q2_center, qq2, iorder_q2) - call deb_cboys(conjg(P1_center), conjg(pp1), iorder_p1, Q1_center, qq1, iorder_q1) - call deb_cboys(conjg(P1_center), conjg(pp1), iorder_p1, Q2_center, qq2, iorder_q2) - enddo ! s - enddo ! r - enddo ! q - enddo ! p - - endif ! same centers - - return -end - -! --- - -subroutine deb_cboys(P_center, p, iorder_p, Q_center, q, iorder_q) - - - implicit none - include 'utils/constants.include.F' - - integer, intent(in) :: iorder_p(3), iorder_q(3) - complex*16, intent(in) :: P_center(3), p - complex*16, intent(in) :: Q_center(3), q - - integer :: iorder, n - complex*16 :: dist, rho - complex*16 :: int1, int2 - - complex*16, external :: crint_2 - - - dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) & - + (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) & - + (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3)) - rho = dist * p * q / (p + q) - - if(real(rho) .lt. -5.d0) then - print*, 'warning ! impotant negative rho: ', rho - endif - - !if(abs(rho) .lt. 1d-15) return - - iorder = 2*iorder_p(1)+2*iorder_q(1) + 2*iorder_p(2)+2*iorder_q(2) + 2*iorder_p(3)+2*iorder_q(3) - n = shiftr(iorder, 1) - - !write(33,*) n, real(rho), aimag(rho) - !print*, n, real(rho), aimag(rho) - - int1 = crint_2(n, rho) - call crint_quad_12(n, rho, 1000000, int2) - - if(abs(int1 - int2) .gt. 1d-5) then - print*, ' important error found: ' - print*, p!, P_center - print*, q!, Q_center - print*, dist - print*, " n, tho = ", n, real(rho), aimag(rho) - print*, real(int1), real(int2), dabs(real(int1-int2)) - print*, aimag(int1), aimag(int2), dabs(aimag(int1-int2)) - stop - endif - -end - -! --- - From 1d4dbad7e58f5401a7572d42bcb0a1e34a2b3641 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 31 Oct 2024 15:13:02 +0100 Subject: [PATCH 012/175] Importing pseudo from trexio --- src/ao_one_e_ints/ao_one_e_ints.irp.f | 2 +- src/trexio/import_trexio_integrals.irp.f | 31 +++++++++++++----------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/ao_one_e_ints/ao_one_e_ints.irp.f b/src/ao_one_e_ints/ao_one_e_ints.irp.f index 9b914dee..431a75fc 100644 --- a/src/ao_one_e_ints/ao_one_e_ints.irp.f +++ b/src/ao_one_e_ints/ao_one_e_ints.irp.f @@ -9,7 +9,7 @@ IF (read_ao_one_e_integrals) THEN call ezfio_get_ao_one_e_ints_ao_one_e_integrals(ao_one_e_integrals) ELSE - ao_one_e_integrals = ao_integrals_n_e + ao_kinetic_integrals + ao_one_e_integrals = ao_integrals_n_e + ao_kinetic_integrals ENDIF diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index 405c0863..dc342197 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -36,7 +36,7 @@ subroutine run(f) real(integral_kind), allocatable :: buffer_values(:) - double precision, allocatable :: A(:,:) + double precision, allocatable :: A(:,:), B(:,:) double precision, allocatable :: V(:) integer , allocatable :: Vi(:,:) double precision :: s @@ -66,6 +66,7 @@ subroutine run(f) ! ------------ allocate(A(ao_num, ao_num)) + allocate(B(ao_num, ao_num)) if (trexio_has_ao_1e_int_overlap(f) == TREXIO_SUCCESS) then @@ -92,17 +93,19 @@ subroutine run(f) call ezfio_set_ao_one_e_ints_io_ao_integrals_kinetic('Read') endif -! if (trexio_has_ao_1e_int_ecp(f) == TREXIO_SUCCESS) then -! rc = trexio_read_ao_1e_int_ecp(f, A) -! if (rc /= TREXIO_SUCCESS) then -! print *, irp_here -! print *, 'Error reading AO ECP local integrals' -! call trexio_assert(rc, TREXIO_SUCCESS) -! stop -1 -! endif -! call ezfio_set_ao_one_e_ints_ao_integrals_pseudo(A) -! call ezfio_set_ao_one_e_ints_io_ao_integrals_pseudo('Read') -! endif + B=0.d0 + if (trexio_has_ao_1e_int_ecp(f) == TREXIO_SUCCESS) then + rc = trexio_read_ao_1e_int_ecp(f, B) + if (rc /= TREXIO_SUCCESS) then + print *, irp_here + print *, 'Error reading AO ECP local integrals' + call trexio_assert(rc, TREXIO_SUCCESS) + stop -1 + endif + call ezfio_set_ao_one_e_ints_ao_integrals_pseudo(B) + call ezfio_set_pseudo_do_pseudo(.True.) + call ezfio_set_ao_one_e_ints_io_ao_integrals_pseudo('Read') + endif if (trexio_has_ao_1e_int_potential_n_e(f) == TREXIO_SUCCESS) then rc = trexio_read_ao_1e_int_potential_n_e(f, A) @@ -112,11 +115,11 @@ subroutine run(f) call trexio_assert(rc, TREXIO_SUCCESS) stop -1 endif - call ezfio_set_ao_one_e_ints_ao_integrals_n_e(A) + call ezfio_set_ao_one_e_ints_ao_integrals_n_e(A+B) call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e('Read') endif - deallocate(A) + deallocate(A,B) ! AO 2e integrals ! --------------- From b68cc4ef9ac8d9f159ab249d7d12508a8179b38e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 1 Nov 2024 10:30:54 +0100 Subject: [PATCH 013/175] qp_import_trexio.py --- scripts/qp_import_trexio.py | 39 ++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 50806598..5fa98cd5 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -14,6 +14,8 @@ import sys import os import numpy as np +import subprocess +import tempfile from functools import reduce from ezfio import ezfio from docopt import docopt @@ -77,10 +79,8 @@ def create_x(accu,x,y,z): def write_ezfio(trexio_filename, filename): - try: - trexio_file = trexio.File(trexio_filename,mode='r',back_end=trexio.TREXIO_TEXT) - except: - trexio_file = trexio.File(trexio_filename,mode='r',back_end=trexio.TREXIO_HDF5) + warnings = [] + trexio_file = trexio.File(trexio_filename,mode='r',back_end=trexio.TREXIO_AUTO) ezfio.set_file(filename) ezfio.set_trexio_trexio_file(trexio_filename) @@ -113,6 +113,7 @@ def write_ezfio(trexio_filename, filename): ezfio.set_nuclei_nucl_coord([0.,0.,0.]) ezfio.set_nuclei_nucl_label(["X"]) print("None") + warnings.append("No geometry found in the TREXIO file") @@ -142,7 +143,6 @@ def write_ezfio(trexio_filename, filename): try: basis_type = trexio.read_basis_type(trexio_file) - print ("BASIS TYPE: ", basis_type.lower()) if basis_type.lower() in ["gaussian", "slater"]: shell_num = trexio.read_basis_shell_num(trexio_file) prim_num = trexio.read_basis_prim_num(trexio_file) @@ -251,6 +251,7 @@ def write_ezfio(trexio_filename, filename): print(basis_type) except: + raise print("None") ezfio.set_ao_basis_ao_cartesian(True) @@ -264,7 +265,20 @@ def write_ezfio(trexio_filename, filename): ao_num = trexio.read_ao_num(trexio_file) ezfio.set_ao_basis_ao_num(ao_num) - if cartesian and shell_num > 0: + trexio_file_cart = trexio_file + if basis_type.lower() == "gaussian" and not cartesian: + try: + import trexio_tools + fd, tmp = tempfile.mkstemp() + os.close(fd) + retcode = subprocess.call(["trexio", "convert-to", "-t", "cartesian", "-o", tmp, trexio_filename]) + trexio_file_cart = trexio.File(tmp,mode='r',back_end=trexio.TREXIO_AUTO) + cartesian = trexio.read_ao_cartesian(trexio_file_cart) + os.unlink(tmp) + except: + pass + + if cartesian and basis_type.lower() == "gaussian" and shell_num > 0: ao_shell = trexio.read_ao_shell(trexio_file) at = [ nucl_index[i]+1 for i in ao_shell ] ezfio.set_ao_basis_ao_nucl(at) @@ -327,7 +341,9 @@ def write_ezfio(trexio_filename, filename): print("OK") else: - print("None: integrals should be also imported using qp run import_trexio_integrals") + warnings.append("Integrals should be imported using `qp run import_trexio_integrals`") + print("None") + # _ @@ -364,7 +380,8 @@ def write_ezfio(trexio_filename, filename): mo_num = trexio.read_mo_num(trexio_file) ezfio.set_mo_basis_mo_num(mo_num) - MoMatrix = trexio.read_mo_coefficient(trexio_file) + # Read coefs from temporary cartesian file created in the AO section + MoMatrix = trexio.read_mo_coefficient(trexio_file_cart) ezfio.set_mo_basis_mo_coef(MoMatrix) mo_occ = [ 0. for i in range(mo_num) ] @@ -471,7 +488,7 @@ def write_ezfio(trexio_filename, filename): alpha = [ alpha[i] for i in range(num_alpha) ] beta = [ i for i in range(len(spin)) if spin[i] == 1 ] beta = [ beta[i] for i in range(num_beta) ] - print("Warning -- UHF orbitals --", end=' ') + warnings.append("UHF orbitals orbitals read", end=' ') alpha_s = ['0']*mo_num beta_s = ['0']*mo_num for i in alpha: @@ -498,6 +515,10 @@ def conv(i): print("OK") + for w in warnings: + print(w) + + def get_full_path(file_path): From 869e45a7e58e208371cb57f9b536499ce2e349ac Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 1 Nov 2024 10:36:32 +0100 Subject: [PATCH 014/175] Fixed qp_import_trexio.py --- scripts/qp_import_trexio.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 5fa98cd5..4373d90e 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -341,7 +341,9 @@ def write_ezfio(trexio_filename, filename): print("OK") else: - warnings.append("Integrals should be imported using `qp run import_trexio_integrals`") + if basis_type.lower() == "gaussian" and not cartesian: + warnings.append(f"Spherical AOs not handled by QP. Convert the TREXIO file using trexio_tools:\n trexio convert-to -t cartesian -o cartesian_{trexio_filename} {trexio_filename}") + warnings.append("Integrals should be imported using:\n qp run import_trexio_integrals") print("None") @@ -516,7 +518,9 @@ def conv(i): for w in warnings: - print(w) + s = "-------------" + print (s) + print (w) From c0941c5d1df314c60f351415db2da5c93ceb644a Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 6 Nov 2024 18:12:40 +0100 Subject: [PATCH 015/175] added print_n2_related_stuff.irp.f --- .../local/basis_correction/pbe_on_top.irp.f | 27 ++++++++++++++++++- .../print_n2_related_stuff.irp.f | 17 ++++++++++++ src/cas_based_on_top/cas_based_on_top.irp.f | 1 + src/cas_based_on_top/on_top_cas_prov.irp.f | 14 ++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 plugins/local/basis_correction/print_n2_related_stuff.irp.f diff --git a/plugins/local/basis_correction/pbe_on_top.irp.f b/plugins/local/basis_correction/pbe_on_top.irp.f index be3a23d7..96d1ffdc 100644 --- a/plugins/local/basis_correction/pbe_on_top.irp.f +++ b/plugins/local/basis_correction/pbe_on_top.irp.f @@ -180,4 +180,29 @@ enddo END_PROVIDER - + BEGIN_PROVIDER [ double precision, extrapolated_on_top, (n_points_final_grid,N_states)] +&BEGIN_PROVIDER [ double precision, average_extrapolated_on_top, (N_states)] + implicit none + double precision :: weight,on_top, on_top_extrap, mu_correction_of_on_top,mu + integer :: istate, ipoint + extrapolated_on_top = 0.d0 + average_extrapolated_on_top = 0.d0 + do istate = 1, N_states + do ipoint = 1, n_points_final_grid + weight = final_weight_at_r_vector(ipoint) + mu = mu_of_r_prov(ipoint,istate) + if(mu_of_r_potential == "cas_full")then + ! You take the on-top of the CAS wave function which is computed with mu(r) + on_top = on_top_cas_mu_r(ipoint,istate) + else + ! You take the on-top of the CAS wave function computed separately + on_top = total_cas_on_top_density(ipoint,istate) + endif +! We take the extrapolated on-top pair density + on_top_extrap = mu_correction_of_on_top(mu,on_top) + extrapolated_on_top(ipoint,istate) = on_top_extrap + average_extrapolated_on_top(istate) += on_top_extrap * weight + enddo + enddo + + END_PROVIDER diff --git a/plugins/local/basis_correction/print_n2_related_stuff.irp.f b/plugins/local/basis_correction/print_n2_related_stuff.irp.f new file mode 100644 index 00000000..0967d16e --- /dev/null +++ b/plugins/local/basis_correction/print_n2_related_stuff.irp.f @@ -0,0 +1,17 @@ +program print_n2_stuffs + implicit none + BEGIN_DOC +! TODO : Put the documentation of the program here + END_DOC + read_wf = .True. + touch read_wf + no_core_density = .True. + touch no_core_density + call routine +end + +subroutine routine + implicit none + print*,'average_extrapolated_on_top = ',average_extrapolated_on_top + print*,'average_on_top = ',average_on_top +end diff --git a/src/cas_based_on_top/cas_based_on_top.irp.f b/src/cas_based_on_top/cas_based_on_top.irp.f index 89516336..7d9090ce 100644 --- a/src/cas_based_on_top/cas_based_on_top.irp.f +++ b/src/cas_based_on_top/cas_based_on_top.irp.f @@ -16,4 +16,5 @@ program cas_based_on_top_density subroutine routine implicit none provide total_cas_on_top_density + provide average_on_top end diff --git a/src/cas_based_on_top/on_top_cas_prov.irp.f b/src/cas_based_on_top/on_top_cas_prov.irp.f index 18a7b7d2..dd93ed40 100644 --- a/src/cas_based_on_top/on_top_cas_prov.irp.f +++ b/src/cas_based_on_top/on_top_cas_prov.irp.f @@ -74,3 +74,17 @@ subroutine act_on_top_on_grid_pt(ipoint,istate,pure_act_on_top_of_r) END_PROVIDER + + BEGIN_PROVIDER [ double precision, average_on_top, (n_states)] + implicit none + integer :: i_point,istate + double precision :: wall_0,wall_1,core_inact_dm,pure_act_on_top_of_r,weight + average_on_top = 0.d0 + do istate = 1, N_states + do i_point = 1, n_points_final_grid + weight = final_weight_at_r_vector(i_point) + average_on_top(istate) += total_cas_on_top_density(i_point,istate) * weight + enddo + enddo + print*,'Average on top pair density = ',average_on_top + END_PROVIDER From 8f54963655e1c37d1ee6b8ef3e018387df4b6aa1 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 20 Nov 2024 18:26:27 +0100 Subject: [PATCH 016/175] moved ao_one_e_integrals_from_mo into mo_one_e_ints --- .../local/basis_correction/print_n2_related_stuff.irp.f | 1 + src/ao_one_e_ints/ao_one_e_ints.irp.f | 9 --------- src/mo_one_e_ints/ao_to_mo.irp.f | 9 +++++++++ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/plugins/local/basis_correction/print_n2_related_stuff.irp.f b/plugins/local/basis_correction/print_n2_related_stuff.irp.f index 0967d16e..453694c7 100644 --- a/plugins/local/basis_correction/print_n2_related_stuff.irp.f +++ b/plugins/local/basis_correction/print_n2_related_stuff.irp.f @@ -14,4 +14,5 @@ subroutine routine implicit none print*,'average_extrapolated_on_top = ',average_extrapolated_on_top print*,'average_on_top = ',average_on_top + print*,'mu_average_prov = ',mu_average_prov end diff --git a/src/ao_one_e_ints/ao_one_e_ints.irp.f b/src/ao_one_e_ints/ao_one_e_ints.irp.f index 431a75fc..8ab9fe5f 100644 --- a/src/ao_one_e_ints/ao_one_e_ints.irp.f +++ b/src/ao_one_e_ints/ao_one_e_ints.irp.f @@ -46,12 +46,3 @@ END_PROVIDER -BEGIN_PROVIDER [ double precision, ao_one_e_integrals_from_mo, (ao_num, ao_num)] - implicit none - BEGIN_DOC -! Integrals of the one e hamiltonian obtained from the integrals on the MO basis -! -! WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions - END_DOC - call mo_to_ao(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_num) -END_PROVIDER diff --git a/src/mo_one_e_ints/ao_to_mo.irp.f b/src/mo_one_e_ints/ao_to_mo.irp.f index a0d8caaa..7ebc4638 100644 --- a/src/mo_one_e_ints/ao_to_mo.irp.f +++ b/src/mo_one_e_ints/ao_to_mo.irp.f @@ -64,3 +64,12 @@ subroutine mo_to_ao_no_overlap(A_mo,LDA_mo,A_ao,LDA_ao) END_PROVIDER +BEGIN_PROVIDER [ double precision, ao_one_e_integrals_from_mo, (ao_num, ao_num)] + implicit none + BEGIN_DOC +! Integrals of the one e hamiltonian obtained from the integrals on the MO basis +! +! WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions + END_DOC + call mo_to_ao(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_num) +END_PROVIDER From 25b175df2f69bb2d31e36386c8a8b12d7b92ab8f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 25 Nov 2024 15:08:13 +0100 Subject: [PATCH 017/175] Fix TREXIO import problems --- scripts/qp_import_trexio.py | 16 ++++++++++++---- src/ao_two_e_ints/cholesky.irp.f | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 4373d90e..0b7f7cde 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -384,6 +384,14 @@ def write_ezfio(trexio_filename, filename): # Read coefs from temporary cartesian file created in the AO section MoMatrix = trexio.read_mo_coefficient(trexio_file_cart) + + # Renormalize MO coefs if needed + if trexio.has_ao_normalization(trexio_file_cart): + norm = trexio.read_ao_normalization(trexio_file_cart) + print (norm) + for j in range(mo_num): + for i,f in enumerate(norm): + MoMatrix[i,j] *= f ezfio.set_mo_basis_mo_coef(MoMatrix) mo_occ = [ 0. for i in range(mo_num) ] @@ -486,10 +494,10 @@ def write_ezfio(trexio_filename, filename): if trexio.has_mo_spin(trexio_file): spin = trexio.read_mo_spin(trexio_file) if max(spin) == 1: - alpha = [ i for i in range(len(spin)) if spin[i] == 0 ] - alpha = [ alpha[i] for i in range(num_alpha) ] - beta = [ i for i in range(len(spin)) if spin[i] == 1 ] - beta = [ beta[i] for i in range(num_beta) ] + tmp = [ i for i in range(len(spin)) if spin[i] == 0 ] + alpha = [ tmp[i] for i in range(num_alpha) ] + tmp = [ i for i in range(len(spin)) if spin[i] == 1 ] + beta = [ tmp[i] for i in range(num_beta) ] warnings.append("UHF orbitals orbitals read", end=' ') alpha_s = ['0']*mo_num beta_s = ['0']*mo_num diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index efafd504..69b18900 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -314,7 +314,7 @@ double precision function get_ao_integ_chol(i,j,k,l) do j=1,nq - if ( (Qmax < Dmin).or.(N+j*1_8 > ndim8) ) exit + if ( (Qmax <= Dmin).or.(N+j*1_8 > ndim8) ) exit ! i. rank = N+j From 560406c1fd59127ccf7d825e47e097c36e471507 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 25 Nov 2024 15:11:22 +0100 Subject: [PATCH 018/175] Removed print in trexio interface --- scripts/qp_import_trexio.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 0b7f7cde..70551c8f 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -388,7 +388,6 @@ def write_ezfio(trexio_filename, filename): # Renormalize MO coefs if needed if trexio.has_ao_normalization(trexio_file_cart): norm = trexio.read_ao_normalization(trexio_file_cart) - print (norm) for j in range(mo_num): for i,f in enumerate(norm): MoMatrix[i,j] *= f From 91be8820e6fcfd99820cc9fd6f7e56c8d4270ded Mon Sep 17 00:00:00 2001 From: eginer Date: Mon, 25 Nov 2024 17:55:27 +0100 Subject: [PATCH 019/175] moved the use_pw in ao_one_e_ints --- src/ao_one_e_ints/aos_cgtos.irp.f | 20 +++++++++++++++++++ .../two_e_coul_integrals_cgtos.irp.f | 20 ------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ao_one_e_ints/aos_cgtos.irp.f b/src/ao_one_e_ints/aos_cgtos.irp.f index 62c312f8..7b2dde7f 100644 --- a/src/ao_one_e_ints/aos_cgtos.irp.f +++ b/src/ao_one_e_ints/aos_cgtos.irp.f @@ -282,3 +282,23 @@ +! --- + +BEGIN_PROVIDER [logical, use_pw] + + implicit none + + logical :: exist + + use_pw = .false. + + call ezfio_has_ao_basis_ao_expo_pw(exist) + if(exist) then + PROVIDE ao_expo_pw_ord_transp + if(maxval(dabs(ao_expo_pw_ord_transp(4,:,:))) .gt. 1d-15) use_pw = .true. + endif + +END_PROVIDER + +! --- + diff --git a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f index a7521b78..30e4824a 100644 --- a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f +++ b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f @@ -1672,23 +1672,3 @@ recursive subroutine I_x2_pol_mult_cgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, end -! --- - -BEGIN_PROVIDER [logical, use_pw] - - implicit none - - logical :: exist - - use_pw = .false. - - call ezfio_has_ao_basis_ao_expo_pw(exist) - if(exist) then - PROVIDE ao_expo_pw_ord_transp - if(maxval(dabs(ao_expo_pw_ord_transp(4,:,:))) .gt. 1d-15) use_pw = .true. - endif - -END_PROVIDER - -! --- - From c35278cddbe72e988f671587af4c480714ddd70f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 26 Nov 2024 16:55:57 +0100 Subject: [PATCH 020/175] Moved use_pw into ao_basis module, and ao_one_e_integrals_from_mo in mo_one_e_ints --- src/ao_basis/aos.irp.f | 19 +++++++++++++++++++ src/ao_one_e_ints/ao_one_e_ints.irp.f | 10 ---------- .../two_e_coul_integrals_cgtos.irp.f | 18 ------------------ src/mo_one_e_ints/mo_one_e_ints.irp.f | 11 +++++++++++ 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index 09604487..c9213f47 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -339,3 +339,22 @@ integer function ao_power_index(nx,ny,nz) ao_l_char_space(i) = give_ao_character_space enddo END_PROVIDER + +! --- + +BEGIN_PROVIDER [ logical, use_pw ] + + implicit none + + logical :: exist + + use_pw = .false. + + call ezfio_has_ao_basis_ao_expo_pw(exist) + if(exist) then + PROVIDE ao_expo_pw_ord_transp + if(maxval(dabs(ao_expo_pw_ord_transp(4,:,:))) .gt. 1d-15) use_pw = .true. + endif + +END_PROVIDER + diff --git a/src/ao_one_e_ints/ao_one_e_ints.irp.f b/src/ao_one_e_ints/ao_one_e_ints.irp.f index 431a75fc..2c6b8e7e 100644 --- a/src/ao_one_e_ints/ao_one_e_ints.irp.f +++ b/src/ao_one_e_ints/ao_one_e_ints.irp.f @@ -45,13 +45,3 @@ END_PROVIDER - -BEGIN_PROVIDER [ double precision, ao_one_e_integrals_from_mo, (ao_num, ao_num)] - implicit none - BEGIN_DOC -! Integrals of the one e hamiltonian obtained from the integrals on the MO basis -! -! WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions - END_DOC - call mo_to_ao(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_num) -END_PROVIDER diff --git a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f index a7521b78..14be57e8 100644 --- a/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f +++ b/src/ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f @@ -1674,21 +1674,3 @@ recursive subroutine I_x2_pol_mult_cgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, ! --- -BEGIN_PROVIDER [logical, use_pw] - - implicit none - - logical :: exist - - use_pw = .false. - - call ezfio_has_ao_basis_ao_expo_pw(exist) - if(exist) then - PROVIDE ao_expo_pw_ord_transp - if(maxval(dabs(ao_expo_pw_ord_transp(4,:,:))) .gt. 1d-15) use_pw = .true. - endif - -END_PROVIDER - -! --- - diff --git a/src/mo_one_e_ints/mo_one_e_ints.irp.f b/src/mo_one_e_ints/mo_one_e_ints.irp.f index fba55beb..19cd2159 100644 --- a/src/mo_one_e_ints/mo_one_e_ints.irp.f +++ b/src/mo_one_e_ints/mo_one_e_ints.irp.f @@ -21,3 +21,14 @@ call nullify_small_elements(mo_num,mo_num,mo_one_e_integrals,size(mo_one_e_integrals,1),1.d-15) END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_one_e_integrals_from_mo, (ao_num, ao_num)] + implicit none + BEGIN_DOC +! Integrals of the one e hamiltonian obtained from the integrals on the MO basis +! +! WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions + END_DOC + call mo_to_ao(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_num) +END_PROVIDER From 7a0194d57690e67e44218aca4a75a1a3e3c4951c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Nov 2024 14:19:53 +0100 Subject: [PATCH 021/175] Fixed problems with trexio files coming from cp2k --- scripts/qp_import_trexio.py | 13 ++++++++----- src/ao_basis/aos.irp.f | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 70551c8f..c25a27a9 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -160,7 +160,6 @@ def write_ezfio(trexio_filename, filename): ezfio.set_basis_shell_ang_mom(ang_mom) ezfio.set_basis_basis_nucleus_index([ x+1 for x in nucl_index ]) ezfio.set_basis_prim_expo(exponent) - ezfio.set_basis_prim_coef(coefficient) nucl_shell_num = [] prev = None @@ -194,6 +193,10 @@ def write_ezfio(trexio_filename, filename): shell_factor = trexio.read_basis_shell_factor(trexio_file) prim_factor = trexio.read_basis_prim_factor(trexio_file) + for i,p in enumerate(prim_factor): + coefficient[i] *= prim_factor[i] + ezfio.set_ao_basis_primitives_normalized(False) + ezfio.set_basis_prim_coef(coefficient) elif basis_type.lower() == "numerical": @@ -245,7 +248,6 @@ def write_ezfio(trexio_filename, filename): ezfio.set_basis_nucleus_shell_num(nucl_shell_num) shell_factor = trexio.read_basis_shell_factor(trexio_file) - prim_factor = [1.]*prim_num else: raise TypeError @@ -387,10 +389,11 @@ def write_ezfio(trexio_filename, filename): # Renormalize MO coefs if needed if trexio.has_ao_normalization(trexio_file_cart): + ezfio.set_ao_basis_ao_normalized(False) norm = trexio.read_ao_normalization(trexio_file_cart) - for j in range(mo_num): - for i,f in enumerate(norm): - MoMatrix[i,j] *= f +# for j in range(mo_num): +# for i,f in enumerate(norm): +# MoMatrix[i,j] *= f ezfio.set_mo_basis_mo_coef(MoMatrix) mo_occ = [ 0. for i in range(mo_num) ] diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index c9213f47..34853398 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -55,9 +55,6 @@ do i=1,ao_num -! powA(1) = ao_power(i,1) + ao_power(i,2) + ao_power(i,3) -! powA(2) = 0 -! powA(3) = 0 powA(1) = ao_power(i,1) powA(2) = ao_power(i,2) powA(3) = ao_power(i,3) @@ -76,16 +73,19 @@ endif ! Normalization of the contracted basis functions - if (ao_normalized) then - norm = 0.d0 + norm = 0.d0 + do j=1,ao_prim_num(i) + do k=1,ao_prim_num(i) + call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) + norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k) + enddo + enddo + ao_coef_normalization_factor(i) = 1.d0/dsqrt(norm) + + if (.not.ao_normalized) then do j=1,ao_prim_num(i) - do k=1,ao_prim_num(i) - call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) - norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k) - enddo + ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i) enddo - ao_coef_normalization_factor(i) = 1.d0/dsqrt(norm) - else ao_coef_normalization_factor(i) = 1.d0 endif enddo From 80e0aaec6b6bb9dca25345b30803fbbba5d6914c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 2 Dec 2024 16:47:57 +0100 Subject: [PATCH 022/175] Introduced ao_two_e_integral_general --- src/ao_two_e_ints/two_e_integrals.irp.f | 176 ++++++++++++++---------- 1 file changed, 105 insertions(+), 71 deletions(-) diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index 3734d4a0..e4bd9d1d 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -40,8 +40,11 @@ double precision function ao_two_e_integral(i, j, k, l) double precision, external :: ao_two_e_integral_erf double precision, external :: ao_two_e_integral_cgtos double precision, external :: ao_two_e_integral_schwartz_accel + double precision, external :: ao_two_e_integral_general + double precision, external :: general_primitive_integral logical, external :: do_schwartz_accel + double precision :: coef1, coef2, coef3, coef4 if(use_cgtos) then @@ -58,83 +61,44 @@ double precision function ao_two_e_integral(i, j, k, l) else - dim1 = n_pt_max_integrals - num_i = ao_nucl(i) num_j = ao_nucl(j) num_k = ao_nucl(k) num_l = ao_nucl(l) ao_two_e_integral = 0.d0 - if (num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k)then - do p = 1, 3 - I_power(p) = ao_power(i,p) - J_power(p) = ao_power(j,p) - K_power(p) = ao_power(k,p) - L_power(p) = ao_power(l,p) - I_center(p) = nucl_coord(num_i,p) - J_center(p) = nucl_coord(num_j,p) - K_center(p) = nucl_coord(num_k,p) - L_center(p) = nucl_coord(num_l,p) - enddo + if (num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k) then - double precision :: coef1, coef2, coef3, coef4 - double precision :: p_inv,q_inv - double precision :: general_primitive_integral - - do p = 1, ao_prim_num(i) - coef1 = ao_coef_normalized_ordered_transp(p,i) - do q = 1, ao_prim_num(j) - coef2 = coef1*ao_coef_normalized_ordered_transp(q,j) - call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,& - ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), & - I_power,J_power,I_center,J_center,dim1) - p_inv = 1.d0/pp - do r = 1, ao_prim_num(k) - coef3 = coef2*ao_coef_normalized_ordered_transp(r,k) - do s = 1, ao_prim_num(l) - coef4 = coef3*ao_coef_normalized_ordered_transp(s,l) - call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,& - ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), & - K_power,L_power,K_center,L_center,dim1) - q_inv = 1.d0/qq - integral = general_primitive_integral(dim1, & - P_new,P_center,fact_p,pp,p_inv,iorder_p, & - Q_new,Q_center,fact_q,qq,q_inv,iorder_q) - ao_two_e_integral = ao_two_e_integral + coef4 * integral - enddo ! s - enddo ! r - enddo ! q - enddo ! p - - else - - do p = 1, 3 - I_power(p) = ao_power(i,p) - J_power(p) = ao_power(j,p) - K_power(p) = ao_power(k,p) - L_power(p) = ao_power(l,p) - enddo - double precision :: ERI - - do p = 1, ao_prim_num(i) - coef1 = ao_coef_normalized_ordered_transp(p,i) - do q = 1, ao_prim_num(j) - coef2 = coef1*ao_coef_normalized_ordered_transp(q,j) - do r = 1, ao_prim_num(k) - coef3 = coef2*ao_coef_normalized_ordered_transp(r,k) - do s = 1, ao_prim_num(l) - coef4 = coef3*ao_coef_normalized_ordered_transp(s,l) - integral = ERI( & - ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j),ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l),& - I_power(1),J_power(1),K_power(1),L_power(1), & - I_power(2),J_power(2),K_power(2),L_power(2), & - I_power(3),J_power(3),K_power(3),L_power(3)) - ao_two_e_integral = ao_two_e_integral + coef4 * integral - enddo ! s - enddo ! r - enddo ! q - enddo ! p + ao_two_e_integral = ao_two_e_integral_general(i,j,k,l,general_primitive_integral) + + else + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_power(j,p) + K_power(p) = ao_power(k,p) + L_power(p) = ao_power(l,p) + enddo + double precision :: ERI + + do p = 1, ao_prim_num(i) + coef1 = ao_coef_normalized_ordered_transp(p,i) + do q = 1, ao_prim_num(j) + coef2 = coef1*ao_coef_normalized_ordered_transp(q,j) + do r = 1, ao_prim_num(k) + coef3 = coef2*ao_coef_normalized_ordered_transp(r,k) + do s = 1, ao_prim_num(l) + coef4 = coef3*ao_coef_normalized_ordered_transp(s,l) + integral = ERI( & + ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j),ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l),& + I_power(1),J_power(1),K_power(1),L_power(1), & + I_power(2),J_power(2),K_power(2),L_power(2), & + I_power(3),J_power(3),K_power(3),L_power(3)) + ao_two_e_integral = ao_two_e_integral + coef4 * integral + enddo ! s + enddo ! r + enddo ! q + enddo ! p endif @@ -144,6 +108,76 @@ double precision function ao_two_e_integral(i, j, k, l) ! --- +double precision function ao_two_e_integral_general(i, j, k, l, op) + + BEGIN_DOC + ! integral of the AO basis or (ij|kl) + ! i(r1) j(r1) 1/r12 k(r2) l(r2) + END_DOC + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: i, j, k, l + double precision, external :: op ! Operator function + + integer :: p, q, r, s + integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3) + integer :: iorder_p(3), iorder_q(3) + double precision :: I_center(3), J_center(3), K_center(3), L_center(3) + double precision :: integral + double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp + double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq + + dim1 = n_pt_max_integrals + + num_i = ao_nucl(i) + num_j = ao_nucl(j) + num_k = ao_nucl(k) + num_l = ao_nucl(l) + ao_two_e_integral_general = 0.d0 + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_power(j,p) + K_power(p) = ao_power(k,p) + L_power(p) = ao_power(l,p) + I_center(p) = nucl_coord(num_i,p) + J_center(p) = nucl_coord(num_j,p) + K_center(p) = nucl_coord(num_k,p) + L_center(p) = nucl_coord(num_l,p) + enddo + + double precision :: coef1, coef2, coef3, coef4 + double precision :: p_inv,q_inv + + do p = 1, ao_prim_num(i) + coef1 = ao_coef_normalized_ordered_transp(p,i) + do q = 1, ao_prim_num(j) + coef2 = coef1*ao_coef_normalized_ordered_transp(q,j) + call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,& + ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), & + I_power,J_power,I_center,J_center,dim1) + p_inv = 1.d0/pp + do r = 1, ao_prim_num(k) + coef3 = coef2*ao_coef_normalized_ordered_transp(r,k) + do s = 1, ao_prim_num(l) + coef4 = coef3*ao_coef_normalized_ordered_transp(s,l) + call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,& + ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), & + K_power,L_power,K_center,L_center,dim1) + q_inv = 1.d0/qq + integral = op(dim1, & + P_new,P_center,fact_p,pp,p_inv,iorder_p, & + Q_new,Q_center,fact_q,qq,q_inv,iorder_q) + ao_two_e_integral_general = ao_two_e_integral_general + coef4 * integral + enddo ! s + enddo ! r + enddo ! q + enddo ! p + +end + double precision function ao_two_e_integral_schwartz_accel(i,j,k,l) implicit none BEGIN_DOC @@ -512,7 +546,7 @@ double precision function general_primitive_integral(dim, & double precision :: a,b,c,d,e,f,accu,pq,const double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2,pq_inv_2 integer :: n_pt_tmp,n_pt_out, iorder - double precision :: d1(0:max_dim),d_poly(0:max_dim),rint,d1_screened(0:max_dim) + double precision :: d1(0:max_dim),d_poly(0:max_dim),d1_screened(0:max_dim) general_primitive_integral = 0.d0 From 5dec303871acd7735491fa380c69172f958517de Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Dec 2024 13:44:55 +0100 Subject: [PATCH 023/175] Fix PySCF import --- scripts/qp_import_trexio.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index c25a27a9..4c153a29 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -264,9 +264,6 @@ def write_ezfio(trexio_filename, filename): except: cartesian = True - ao_num = trexio.read_ao_num(trexio_file) - ezfio.set_ao_basis_ao_num(ao_num) - trexio_file_cart = trexio_file if basis_type.lower() == "gaussian" and not cartesian: try: @@ -280,8 +277,12 @@ def write_ezfio(trexio_filename, filename): except: pass + ao_num = trexio.read_ao_num(trexio_file_cart) + ezfio.set_ao_basis_ao_num(ao_num) + + if cartesian and basis_type.lower() == "gaussian" and shell_num > 0: - ao_shell = trexio.read_ao_shell(trexio_file) + ao_shell = trexio.read_ao_shell(trexio_file_cart) at = [ nucl_index[i]+1 for i in ao_shell ] ezfio.set_ao_basis_ao_nucl(at) @@ -316,6 +317,7 @@ def write_ezfio(trexio_filename, filename): exponent.append(expo[i]) num_prim.append(num_prim0[i]) + print (len(coefficient), ao_num) assert (len(coefficient) == ao_num) ezfio.set_ao_basis_ao_power(power_x + power_y + power_z) ezfio.set_ao_basis_ao_prim_num(num_prim) From 16a7bdc4b0be6bc826dd7546e2c4805310ed7b92 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 4 Dec 2024 13:58:50 +0100 Subject: [PATCH 024/175] Update trexio --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 43ca9f6d..7b5fa0c9 100755 --- a/configure +++ b/configure @@ -9,7 +9,7 @@ echo "QP_ROOT="$QP_ROOT unset CC unset CCXX -TREXIO_VERSION=2.4.2 +TREXIO_VERSION=2.5.0 # Force GCC instead of ICC for dependencies export CC=gcc From 0fdaa03d99eea6085667e22c268b23b1eddc1f45 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 4 Dec 2024 15:58:59 +0100 Subject: [PATCH 025/175] added extra basis --- docs/source/index.rst | 1 + docs/source/modules/ao_basis.rst | 241 +- docs/source/modules/ao_one_e_ints.rst | 2357 +++++++++-- docs/source/modules/ao_two_e_ints.rst | 2897 +++++++++++--- docs/source/modules/becke_numerical_grid.rst | 18 + docs/source/modules/bitmask.rst | 2540 ++++++------ docs/source/modules/cipsi.rst | 2876 +++----------- docs/source/modules/cis.rst | 8 +- docs/source/modules/cisd.rst | 144 +- docs/source/modules/davidson.rst | 2256 ++++++++--- docs/source/modules/davidson_undressed.rst | 32 + docs/source/modules/density_for_dft.rst | 6 +- docs/source/modules/determinants.rst | 2373 ++++++++---- docs/source/modules/dft_keywords.rst | 10 +- docs/source/modules/dft_one_e.rst | 671 +++- docs/source/modules/dft_utils_in_r.rst | 1384 +++++-- docs/source/modules/electrons.rst | 10 + docs/source/modules/ezfio_files.rst | 641 +-- docs/source/modules/fci.rst | 71 +- docs/source/modules/generators_cas.rst | 331 ++ docs/source/modules/generators_full.rst | 249 -- docs/source/modules/hartree_fock.rst | 280 +- docs/source/modules/iterations.rst | 185 +- docs/source/modules/kohn_sham.rst | 366 ++ docs/source/modules/kohn_sham_rs.rst | 365 -- docs/source/modules/mo_basis.rst | 167 +- docs/source/modules/mo_guess.rst | 6 +- docs/source/modules/mo_one_e_ints.rst | 231 +- docs/source/modules/mo_two_e_ints.rst | 1797 +++++++-- docs/source/modules/mpi.rst | 130 +- docs/source/modules/nuclei.rst | 208 + docs/source/modules/perturbation.rst | 27 +- docs/source/modules/pseudo.rst | 4 +- docs/source/modules/scf_utils.rst | 182 +- docs/source/modules/selectors_utils.rst | 4 +- docs/source/modules/tools.rst | 154 +- docs/source/modules/utils.rst | 3448 ++++++++++++----- docs/source/modules/zmq.rst | 54 +- .../programmers_guide/index_providers.rst | 1247 +++++- docs/source/programs/cisd.rst | 14 +- docs/source/programs/fci.rst | 12 +- docs/source/programs/four_idx_transform.rst | 1 + docs/source/programs/pt2.rst | 8 + docs/source/programs/rs_ks_scf.rst | 1 - docs/source/programs/save_natorb.rst | 1 + docs/source/programs/scf.rst | 4 + plugins/local/ao_extra_basis/EZFIO.cfg | 87 + plugins/local/ao_extra_basis/NEED | 3 + plugins/local/ao_extra_basis/README.rst | 4 + plugins/local/ao_extra_basis/aos.irp.f | 325 ++ .../ao_extra_basis/dimensions_integrals.irp.f | 19 + .../local/ao_extra_basis/extra_basis.irp.f | 15 + plugins/local/ao_extra_basis/install | 23 + .../local/ao_extra_basis/qp_copy_extra_basis | 59 + plugins/local/ao_extra_basis/uninstall | 20 + plugins/local/extra_basis_int/NEED | 2 + plugins/local/extra_basis_int/README.rst | 4 + .../local/extra_basis_int/ao_overlap.irp.f | 136 + .../extra_basis_int/extra_basis_int.irp.f | 7 + plugins/local/extra_nuclei/EZFIO.cfg | 23 + plugins/local/extra_nuclei/NEED | 3 + plugins/local/extra_nuclei/README.rst | 4 + plugins/local/extra_nuclei/extra_nuclei.irp.f | 7 + plugins/local/extra_nuclei/nuclei.irp.f | 122 + plugins/local/tuto_plugins/tuto_I/tuto_I.rst | 2 +- src/cas_based_on_top/cas_based_on_top.irp.f | 2 +- src/casscf_cipsi/get_energy.irp.f | 2 +- src/mu_of_r/test_proj_op.irp.f | 2 +- src/tools/attachement_orb.irp.f | 2 +- src/tools/fcidump_pyscf.irp.f | 2 +- src/tools/hcore_guess.irp.f | 3 - src/tools/huckel_guess.irp.f | 5 - src/tools/print_sorted_wf_coef.irp.f | 2 +- src/tools/save_natorb_no_ov_rot.irp.f | 2 +- src/tools/save_natorb_no_ref.irp.f | 2 +- src/trexio/import_trexio_integrals.irp.f | 2 +- 76 files changed, 19956 insertions(+), 8947 deletions(-) create mode 100644 plugins/local/ao_extra_basis/EZFIO.cfg create mode 100644 plugins/local/ao_extra_basis/NEED create mode 100644 plugins/local/ao_extra_basis/README.rst create mode 100644 plugins/local/ao_extra_basis/aos.irp.f create mode 100644 plugins/local/ao_extra_basis/dimensions_integrals.irp.f create mode 100644 plugins/local/ao_extra_basis/extra_basis.irp.f create mode 100755 plugins/local/ao_extra_basis/install create mode 100755 plugins/local/ao_extra_basis/qp_copy_extra_basis create mode 100755 plugins/local/ao_extra_basis/uninstall create mode 100644 plugins/local/extra_basis_int/NEED create mode 100644 plugins/local/extra_basis_int/README.rst create mode 100644 plugins/local/extra_basis_int/ao_overlap.irp.f create mode 100644 plugins/local/extra_basis_int/extra_basis_int.irp.f create mode 100644 plugins/local/extra_nuclei/EZFIO.cfg create mode 100644 plugins/local/extra_nuclei/NEED create mode 100644 plugins/local/extra_nuclei/README.rst create mode 100644 plugins/local/extra_nuclei/extra_nuclei.irp.f create mode 100644 plugins/local/extra_nuclei/nuclei.irp.f delete mode 100644 src/tools/hcore_guess.irp.f delete mode 100644 src/tools/huckel_guess.irp.f diff --git a/docs/source/index.rst b/docs/source/index.rst index 273582d4..f663d607 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -41,6 +41,7 @@ programmers_guide/plugins programmers_guide/plugins_tuto_intro programmers_guide/plugins_tuto_I + programmers_guide/plugins_tuto_II programmers_guide/new_ks programmers_guide/index diff --git a/docs/source/modules/ao_basis.rst b/docs/source/modules/ao_basis.rst index 3e3821d3..834730fc 100644 --- a/docs/source/modules/ao_basis.rst +++ b/docs/source/modules/ao_basis.rst @@ -27,7 +27,7 @@ The |AO| coefficients are normalized as: .. warning:: `ao_coef` contains the |AO| coefficients given in input. These do not - include the normalization constant of the |AO|. The `ao_coef_normalized` + include the normalization constant of the |AO|. The `ao_coef_normalized_factor` provider includes this normalization factor. @@ -36,6 +36,19 @@ the two electron integrals. +Complex Gaussian-Type Orbitals (cGTOs) +===================================== + +Complex Gaussian-Type Orbitals (cGTOs) are also supported: + +.. math:: + + \chi_i(\mathbf{r}) = x^a y^b z^c \sum_k c_{ki} \left( e^{-\alpha_{ki} \mathbf{r}^2 - \imath \mathbf{k}_{ki} \cdot \mathbf{r} - \imath \phi_{ki}} + \text{C.C.} \right) + +where: + - :math:`\alpha \in \mathbb{C}` and :math:`\Re(\alpha) > 0` (specified by ``ao_expo`` and ``ao_expo_im``), + - :math:`\mathbf{k} = (k_x, k_y, k_z) \in \mathbb{R}^3` (specified by ``ao_expo_pw``), + - :math:`\phi = \phi_x + \phi_y + \phi_z \in \mathbb{R}` (specified by ``ao_expo_phase``). @@ -94,6 +107,39 @@ EZFIO parameters Default: false +.. option:: ao_normalized + + Use normalized basis functions + + Default: true + +.. option:: primitives_normalized + + Use normalized primitive functions + + Default: true + +.. option:: use_cgtos + + If true, use cgtos for AO integrals + + Default: False + +.. option:: ao_expo_im + + imag part for Exponents for each primitive of each cGTOs |AO| + + +.. option:: ao_expo_pw + + plane wave part for each primitive GTOs |AO| + + +.. option:: ao_expo_phase + + phase shift for each primitive GTOs |AO| + + Providers --------- @@ -130,35 +176,9 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalization_libint_factor` * :c:data:`ao_coef_normalized_ordered` -.. c:var:: ao_coef_normalization_libint_factor - - - File : :file:`ao_basis/aos.irp.f` - - .. code:: fortran - - double precision, allocatable :: ao_coef_normalization_libint_factor (ao_num) - - - |AO| normalization for interfacing with libint - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_coef_normalized` - * :c:data:`ao_expo` - * :c:data:`ao_l` - * :c:data:`ao_num` - * :c:data:`ao_prim_num` - - - .. c:var:: ao_coef_normalized @@ -191,7 +211,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalization_libint_factor` * :c:data:`ao_coef_normalized_ordered` @@ -260,13 +279,18 @@ Providers * :c:data:`ao_dipole_x` * :c:data:`ao_integrals_n_e` * :c:data:`ao_integrals_n_e_per_atom` + * :c:data:`ao_integrals_pt_chrg` * :c:data:`ao_overlap` * :c:data:`ao_overlap_abs` * :c:data:`ao_pseudo_integrals_local` * :c:data:`ao_pseudo_integrals_non_local` * :c:data:`ao_spread_x` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_erf_schwartz` * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` .. c:var:: ao_coef_normalized_ordered_transp_per_nucl @@ -359,13 +383,18 @@ Providers * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_integrals_n_e` * :c:data:`ao_integrals_n_e_per_atom` + * :c:data:`ao_integrals_pt_chrg` * :c:data:`ao_overlap` * :c:data:`ao_overlap_abs` * :c:data:`ao_pseudo_integrals_local` * :c:data:`ao_pseudo_integrals_non_local` * :c:data:`ao_spread_x` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_erf_schwartz` * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` .. c:var:: ao_expo_ordered_transp_per_nucl @@ -393,6 +422,28 @@ Providers +.. c:var:: ao_first_of_shell + + + File : :file:`ao_basis/aos.irp.f` + + .. code:: fortran + + integer, allocatable :: ao_first_of_shell (shell_num) + + + Index of the shell to which the AO corresponds + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`shell_ang_mom` + * :c:data:`shell_num` + + + .. c:var:: ao_l @@ -422,7 +473,6 @@ Providers :columns: 3 * :c:data:`ao_cart_to_sphe_coef` - * :c:data:`ao_coef_normalization_libint_factor` * :c:data:`ao_l_char_space` * :c:data:`nucl_list_shell_aos` @@ -456,7 +506,6 @@ Providers :columns: 3 * :c:data:`ao_cart_to_sphe_coef` - * :c:data:`ao_coef_normalization_libint_factor` * :c:data:`ao_l_char_space` * :c:data:`nucl_list_shell_aos` @@ -513,7 +562,6 @@ Providers :columns: 3 * :c:data:`ao_cart_to_sphe_coef` - * :c:data:`ao_coef_normalization_libint_factor` * :c:data:`ao_l_char_space` * :c:data:`nucl_list_shell_aos` @@ -566,13 +614,43 @@ Providers :columns: 3 * :c:data:`ao_coef` + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_coef_norm_cgtos_ord` * :c:data:`ao_coef_normalized` * :c:data:`ao_coef_normalized_ordered` * :c:data:`ao_coef_normalized_ordered_transp` * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` * :c:data:`ao_expo` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_expo_im` * :c:data:`ao_expo_ordered_transp` * :c:data:`ao_expo_ordered_transp_per_nucl` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` + + +.. c:var:: ao_shell + + + File : :file:`ao_basis/aos.irp.f` + + .. code:: fortran + + integer, allocatable :: ao_shell (ao_num) + + + Index of the shell to which the AO corresponds + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`shell_ang_mom` + * :c:data:`shell_num` + .. c:var:: cart_to_sphe_0 @@ -849,10 +927,17 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ao_2e_cgtos_schwartz` * :c:data:`ao_integrals_n_e` + * :c:data:`ao_integrals_n_e_cgtos` * :c:data:`ao_integrals_n_e_per_atom` + * :c:data:`ao_integrals_pt_chrg` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_erf_schwartz` * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` * :c:data:`gauleg_t2` @@ -881,10 +966,17 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ao_2e_cgtos_schwartz` * :c:data:`ao_integrals_n_e` + * :c:data:`ao_integrals_n_e_cgtos` * :c:data:`ao_integrals_n_e_per_atom` + * :c:data:`ao_integrals_pt_chrg` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_erf_schwartz` * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` * :c:data:`gauleg_t2` @@ -915,7 +1007,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`nucl_aos_transposed` * :c:data:`nucl_list_shell_aos` @@ -938,7 +1029,6 @@ Providers * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`nucl_aos` * :c:data:`nucl_n_aos` * :c:data:`nucl_num` @@ -1043,6 +1133,74 @@ Providers +.. c:var:: use_cgtos + + + File : :file:`ao_basis/cgtos.irp.f` + + .. code:: fortran + + logical :: use_cgtos + + + If true, use cgtos for AO integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_deriv2_x` + * :c:data:`ao_integrals_n_e` + * :c:data:`ao_overlap` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` + + +.. c:var:: use_cosgtos + + + File : :file:`ao_basis/cosgtos.irp.f` + + .. code:: fortran + + logical :: use_cosgtos + + + If true, use cosgtos for AO integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_deriv2_x` + * :c:data:`ao_integrals_n_e` + * :c:data:`ao_overlap` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` + + Subroutines / functions ----------------------- @@ -1069,7 +1227,7 @@ Subroutines / functions .. code:: fortran - double precision function ao_value(i,r) + double precision function ao_value(i, r) Returns the value of the i-th ao at point $\textbf{r}$ @@ -1094,15 +1252,17 @@ Subroutines / functions .. code:: fortran - subroutine give_all_aos_and_grad_and_lapl_at_r(r,aos_array,aos_grad_array,aos_lapl_array) + subroutine give_all_aos_and_grad_and_lapl_at_r(r, aos_array, aos_grad_array, aos_lapl_array) + input : r(1) ==> r(1) = x, r(2) = y, r(3) = z output : * aos_array(i) = ao(i) evaluated at $\textbf{r}$ * aos_grad_array(1,i) = $\nabla_x$ of the ao(i) evaluated at $\textbf{r}$ + Needs: @@ -1134,9 +1294,10 @@ Subroutines / functions .. code:: fortran - subroutine give_all_aos_and_grad_at_r(r,aos_array,aos_grad_array) + subroutine give_all_aos_and_grad_at_r(r, aos_array, aos_grad_array) + input : r(1) ==> r(1) = x, r(2) = y, r(3) = z output : @@ -1175,12 +1336,14 @@ Subroutines / functions .. code:: fortran - subroutine give_all_aos_at_r(r,aos_array) + subroutine give_all_aos_at_r(r, tmp_array) + input : r == r(1) = x and so on - output : aos_array(i) = aos(i) evaluated in $\textbf{r}$ + output : tmp_array(i) = aos(i) evaluated in $\textbf{r}$ + Needs: @@ -1212,7 +1375,7 @@ Subroutines / functions .. code:: fortran - double precision function primitive_value(i,j,r) + double precision function primitive_value(i, j, r) Returns the value of the j-th primitive of the i-th |AO| at point $\textbf{r} diff --git a/docs/source/modules/ao_one_e_ints.rst b/docs/source/modules/ao_one_e_ints.rst index e0ad5873..4b6b114d 100644 --- a/docs/source/modules/ao_one_e_ints.rst +++ b/docs/source/modules/ao_one_e_ints.rst @@ -23,12 +23,17 @@ The most important providers for usual quantum-chemistry calculation are: EZFIO parameters ---------------- -.. option:: ao_integrals_e_n +.. option:: ao_integrals_n_e Nucleus-electron integrals in |AO| basis set -.. option:: io_ao_integrals_e_n +.. option:: ao_integrals_n_e_imag + + Imaginary part of the nucleus-electron integrals in |AO| basis set + + +.. option:: io_ao_integrals_n_e Read/Write |AO| nucleus-electron attraction integrals from/to disk [ Write | Read | None ] @@ -39,6 +44,11 @@ EZFIO parameters Kinetic energy integrals in |AO| basis set +.. option:: ao_integrals_kinetic_imag + + Imaginary part of the kinetic energy integrals in |AO| basis set + + .. option:: io_ao_integrals_kinetic Read/Write |AO| kinetic integrals from/to disk [ Write | Read | None ] @@ -50,6 +60,11 @@ EZFIO parameters Pseudopotential integrals in |AO| basis set +.. option:: ao_integrals_pseudo_imag + + Imaginary part of the pseudopotential integrals in |AO| basis set + + .. option:: io_ao_integrals_pseudo Read/Write |AO| pseudopotential integrals from/to disk [ Write | Read | None ] @@ -61,6 +76,11 @@ EZFIO parameters Overlap integrals in |AO| basis set +.. option:: ao_integrals_overlap_imag + + Imaginary part of the overlap integrals in |AO| basis set + + .. option:: io_ao_integrals_overlap Read/Write |AO| overlap integrals from/to disk [ Write | Read | None ] @@ -72,12 +92,29 @@ EZFIO parameters Combined integrals in |AO| basis set +.. option:: ao_one_e_integrals_imag + + Imaginary part of the combined integrals in |AO| basis set + + .. option:: io_ao_one_e_integrals Read/Write |AO| one-electron integrals from/to disk [ Write | Read | None ] Default: None +.. option:: lin_dep_cutoff + + Remove linear dependencies when the eigenvalues of the overlap matrix are below this value + + Default: 1.e-6 + +.. option:: ao_one_e_integrals_threshold + + If | (p|q) | < `ao_one_e_integrals_threshold` then (p|q) is zero + + Default: 1.e-15 + Providers --------- @@ -218,253 +255,228 @@ Providers * :c:data:`ao_ortho_canonical_coef` -.. c:var:: ao_deriv2_x +.. c:var:: ao_coef_cgtos_norm_ord_transp - File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_deriv2_x (ao_num,ao_num) - double precision, allocatable :: ao_deriv2_y (ao_num,ao_num) - double precision, allocatable :: ao_deriv2_z (ao_num,ao_num) + double precision, allocatable :: ao_coef_cgtos_norm_ord_transp (ao_prim_num_max,ao_num) - Second derivative matrix elements in the |AO| basis. - - .. math:: - - {\tt ao\_deriv2\_x} = - \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle - Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` + * :c:data:`ao_coef_norm_cgtos_ord` * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` - * :c:data:`nucl_coord` + * :c:data:`ao_prim_num_max` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_integrals_n_e_cgtos` + * :c:data:`ao_overlap_cgtos` -.. c:var:: ao_deriv2_y +.. c:var:: ao_coef_norm_cgtos - File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_deriv2_x (ao_num,ao_num) - double precision, allocatable :: ao_deriv2_y (ao_num,ao_num) - double precision, allocatable :: ao_deriv2_z (ao_num,ao_num) + double precision, allocatable :: ao_coef_norm_cgtos (ao_num,ao_prim_num_max) - Second derivative matrix elements in the |AO| basis. - - .. math:: - - {\tt ao\_deriv2\_x} = - \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle - Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef` + * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` * :c:data:`ao_prim_num` + * :c:data:`ao_prim_num_max` * :c:data:`nucl_coord` + * :c:data:`primitives_normalized` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_coef_norm_cgtos_ord` -.. c:var:: ao_deriv2_z +.. c:var:: ao_coef_norm_cgtos_ord - File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_deriv2_x (ao_num,ao_num) - double precision, allocatable :: ao_deriv2_y (ao_num,ao_num) - double precision, allocatable :: ao_deriv2_z (ao_num,ao_num) + double precision, allocatable :: ao_coef_norm_cgtos_ord (ao_num,ao_prim_num_max) + complex*16, allocatable :: ao_expo_cgtos_ord (ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_pw_ord (4,ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_phase_ord (4,ao_num,ao_prim_num_max) - Second derivative matrix elements in the |AO| basis. - - .. math:: - - {\tt ao\_deriv2\_x} = - \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle - Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` * :c:data:`ao_num` - * :c:data:`ao_power` * :c:data:`ao_prim_num` - * :c:data:`nucl_coord` + * :c:data:`ao_prim_num_max` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` -.. c:var:: ao_deriv_1_x +.. c:var:: ao_coef_norm_cosgtos - File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_deriv_1_x (ao_num,ao_num) - double precision, allocatable :: ao_deriv_1_y (ao_num,ao_num) - double precision, allocatable :: ao_deriv_1_z (ao_num,ao_num) + double precision, allocatable :: ao_coef_norm_cosgtos (ao_num,ao_prim_num_max) - * array of the integrals of AO_i * d/dx AO_j - - * array of the integrals of AO_i * d/dy AO_j - - * array of the integrals of AO_i * d/dz AO_j Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` + * :c:data:`ao_coef` + * :c:data:`ao_expo` + * :c:data:`ao_expoim_cosgtos` * :c:data:`ao_num` * :c:data:`ao_power` * :c:data:`ao_prim_num` - * :c:data:`nucl_coord` + * :c:data:`ao_prim_num_max` + * :c:data:`primitives_normalized` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`ao_coef_norm_ord_cosgtos` -.. c:var:: ao_deriv_1_y +.. c:var:: ao_coef_norm_ord_cosgtos - File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_deriv_1_x (ao_num,ao_num) - double precision, allocatable :: ao_deriv_1_y (ao_num,ao_num) - double precision, allocatable :: ao_deriv_1_z (ao_num,ao_num) + double precision, allocatable :: ao_coef_norm_ord_cosgtos (ao_num,ao_prim_num_max) + complex*16, allocatable :: ao_expo_ord_cosgtos (ao_num,ao_prim_num_max) - * array of the integrals of AO_i * d/dx AO_j - - * array of the integrals of AO_i * d/dy AO_j - - * array of the integrals of AO_i * d/dz AO_j Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` + * :c:data:`ao_coef_norm_cosgtos` + * :c:data:`ao_expo` + * :c:data:`ao_expoim_cosgtos` * :c:data:`ao_num` - * :c:data:`ao_power` * :c:data:`ao_prim_num` - * :c:data:`nucl_coord` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` -.. c:var:: ao_deriv_1_z +.. c:var:: ao_coef_norm_ord_transp_cosgtos - File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_deriv_1_x (ao_num,ao_num) - double precision, allocatable :: ao_deriv_1_y (ao_num,ao_num) - double precision, allocatable :: ao_deriv_1_z (ao_num,ao_num) + double precision, allocatable :: ao_coef_norm_ord_transp_cosgtos (ao_prim_num_max,ao_num) - * array of the integrals of AO_i * d/dx AO_j - - * array of the integrals of AO_i * d/dy AO_j - - * array of the integrals of AO_i * d/dz AO_j Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` + * :c:data:`ao_coef_norm_ord_cosgtos` * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` - * :c:data:`nucl_coord` + * :c:data:`ao_prim_num_max` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_2e_cosgtos_schwartz` + * :c:data:`ao_deriv2_cosgtos_x` + * :c:data:`ao_integrals_n_e_cosgtos` + * :c:data:`ao_overlap_cosgtos` -.. c:var:: ao_dipole_x +.. c:var:: ao_deriv2_cgtos_x - File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + File : :file:`ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_dipole_x (ao_num,ao_num) - double precision, allocatable :: ao_dipole_y (ao_num,ao_num) - double precision, allocatable :: ao_dipole_z (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_z (ao_num,ao_num) - * array of the integrals of AO_i * x AO_j - - * array of the integrals of AO_i * y AO_j - - * array of the integrals of AO_i * z AO_j Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` @@ -476,34 +488,30 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mo_dipole_x` + * :c:data:`ao_deriv2_x` + * :c:data:`ao_kinetic_integrals_cgtos` -.. c:var:: ao_dipole_y +.. c:var:: ao_deriv2_cgtos_y - File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + File : :file:`ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_dipole_x (ao_num,ao_num) - double precision, allocatable :: ao_dipole_y (ao_num,ao_num) - double precision, allocatable :: ao_dipole_z (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_z (ao_num,ao_num) - * array of the integrals of AO_i * x AO_j - - * array of the integrals of AO_i * y AO_j - - * array of the integrals of AO_i * z AO_j Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` @@ -515,34 +523,30 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mo_dipole_x` + * :c:data:`ao_deriv2_x` + * :c:data:`ao_kinetic_integrals_cgtos` -.. c:var:: ao_dipole_z +.. c:var:: ao_deriv2_cgtos_z - File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + File : :file:`ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_dipole_x (ao_num,ao_num) - double precision, allocatable :: ao_dipole_y (ao_num,ao_num) - double precision, allocatable :: ao_dipole_z (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cgtos_z (ao_num,ao_num) - * array of the integrals of AO_i * x AO_j - - * array of the integrals of AO_i * y AO_j - - * array of the integrals of AO_i * z AO_j Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` @@ -554,127 +558,133 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mo_dipole_x` + * :c:data:`ao_deriv2_x` + * :c:data:`ao_kinetic_integrals_cgtos` -.. c:var:: ao_integrals_n_e +.. c:var:: ao_deriv2_cosgtos_x - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_kin_integrals_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_integrals_n_e (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_z (ao_num,ao_num) - Nucleus-electron interaction, in the |AO| basis set. - - :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle` - - These integrals also contain the pseudopotential integrals. Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` * :c:data:`ao_prim_num` - * :c:data:`ao_pseudo_integrals` - * :c:data:`do_pseudo` - * :c:data:`n_pt_max_integrals` - * :c:data:`nucl_charge` * :c:data:`nucl_coord` - * :c:data:`nucl_num` - * :c:data:`read_ao_integrals_n_e` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_one_e_integrals` - * :c:data:`mo_integrals_n_e` + * :c:data:`ao_deriv2_x` + * :c:data:`ao_kinetic_integrals_cosgtos` -.. c:var:: ao_integrals_n_e_imag +.. c:var:: ao_deriv2_cosgtos_y - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_kin_integrals_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_integrals_n_e_imag (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_z (ao_num,ao_num) - Nucleus-electron interaction, in the |AO| basis set. - - :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle` Needs: .. hlist:: :columns: 3 + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`read_ao_integrals_n_e` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`ao_deriv2_x` + * :c:data:`ao_kinetic_integrals_cosgtos` -.. c:var:: ao_integrals_n_e_per_atom +.. c:var:: ao_deriv2_cosgtos_z - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_kin_integrals_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_integrals_n_e_per_atom (ao_num,ao_num,nucl_num) + double precision, allocatable :: ao_deriv2_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_cosgtos_z (ao_num,ao_num) - Nucleus-electron interaction in the |AO| basis set, per atom A. - - :math:`\langle \chi_i | -\frac{1}{|r-R_A|} | \chi_j \rangle` Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` * :c:data:`ao_prim_num` - * :c:data:`n_pt_max_integrals` * :c:data:`nucl_coord` - * :c:data:`nucl_num` Needed by: .. hlist:: :columns: 3 - * :c:data:`mo_integrals_n_e_per_atom` + * :c:data:`ao_deriv2_x` + * :c:data:`ao_kinetic_integrals_cosgtos` -.. c:var:: ao_kinetic_integrals +.. c:var:: ao_deriv2_x File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` .. code:: fortran - double precision, allocatable :: ao_kinetic_integrals (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_z (ao_num,ao_num) - Kinetic energy integrals in the |AO| basis. + Second derivative matrix elements in the |AO| basis. - :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + .. math:: + + {\tt ao\_deriv2\_x} = + \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle Needs: @@ -682,53 +692,1040 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_deriv2_x` + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`read_ao_integrals_kinetic` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + * :c:data:`use_cgtos` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_one_e_integrals` - * :c:data:`mo_kinetic_integrals` + * :c:data:`ao_kinetic_integrals` -.. c:var:: ao_kinetic_integrals_imag +.. c:var:: ao_deriv2_y File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` .. code:: fortran - double precision, allocatable :: ao_kinetic_integrals_imag (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_z (ao_num,ao_num) - Kinetic energy integrals in the |AO| basis. + Second derivative matrix elements in the |AO| basis. - :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + .. math:: + + {\tt ao\_deriv2\_x} = + \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + * :c:data:`use_cgtos` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_kinetic_integrals` + + +.. c:var:: ao_deriv2_z + + + File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_deriv2_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv2_z (ao_num,ao_num) + + + Second derivative matrix elements in the |AO| basis. + + .. math:: + + {\tt ao\_deriv2\_x} = + \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + * :c:data:`use_cgtos` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_kinetic_integrals` + + +.. c:var:: ao_deriv_1_x + + + File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_deriv_1_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv_1_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv_1_z (ao_num,ao_num) + + + * array of the integrals of AO_i * d/dx AO_j + + * array of the integrals of AO_i * d/dy AO_j + + * array of the integrals of AO_i * d/dz AO_j + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_deriv_1_x` + + +.. c:var:: ao_deriv_1_y + + + File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_deriv_1_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv_1_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv_1_z (ao_num,ao_num) + + + * array of the integrals of AO_i * d/dx AO_j + + * array of the integrals of AO_i * d/dy AO_j + + * array of the integrals of AO_i * d/dz AO_j + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_deriv_1_x` + + +.. c:var:: ao_deriv_1_z + + + File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_deriv_1_x (ao_num,ao_num) + double precision, allocatable :: ao_deriv_1_y (ao_num,ao_num) + double precision, allocatable :: ao_deriv_1_z (ao_num,ao_num) + + + * array of the integrals of AO_i * d/dx AO_j + + * array of the integrals of AO_i * d/dy AO_j + + * array of the integrals of AO_i * d/dz AO_j + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_deriv_1_x` + + +.. c:var:: ao_dipole_x + + + File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_dipole_x (ao_num,ao_num) + double precision, allocatable :: ao_dipole_y (ao_num,ao_num) + double precision, allocatable :: ao_dipole_z (ao_num,ao_num) + + + * array of the integrals of AO_i * x AO_j + + * array of the integrals of AO_i * y AO_j + + * array of the integrals of AO_i * z AO_j + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_dipole_x` + + +.. c:var:: ao_dipole_y + + + File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_dipole_x (ao_num,ao_num) + double precision, allocatable :: ao_dipole_y (ao_num,ao_num) + double precision, allocatable :: ao_dipole_z (ao_num,ao_num) + + + * array of the integrals of AO_i * x AO_j + + * array of the integrals of AO_i * y AO_j + + * array of the integrals of AO_i * z AO_j + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_dipole_x` + + +.. c:var:: ao_dipole_z + + + File : :file:`ao_one_e_ints/spread_dipole_ao.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_dipole_x (ao_num,ao_num) + double precision, allocatable :: ao_dipole_y (ao_num,ao_num) + double precision, allocatable :: ao_dipole_z (ao_num,ao_num) + + + * array of the integrals of AO_i * x AO_j + + * array of the integrals of AO_i * y AO_j + + * array of the integrals of AO_i * z AO_j + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_dipole_x` + + +.. c:var:: ao_expo_cgtos_ord + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_coef_norm_cgtos_ord (ao_num,ao_prim_num_max) + complex*16, allocatable :: ao_expo_cgtos_ord (ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_pw_ord (4,ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_phase_ord (4,ao_num,ao_prim_num_max) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` + * :c:data:`ao_num` + * :c:data:`ao_prim_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + + +.. c:var:: ao_expo_cgtos_ord_transp + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + complex*16, allocatable :: ao_expo_cgtos_ord_transp (ao_prim_num_max,ao_num) + double precision, allocatable :: ao_expo_pw_ord_transp (4,ao_prim_num_max,ao_num) + double precision, allocatable :: ao_expo_phase_ord_transp (4,ao_prim_num_max,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos_ord` + * :c:data:`ao_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_integrals_n_e_cgtos` + * :c:data:`ao_overlap_cgtos` + * :c:data:`use_pw` + + +.. c:var:: ao_expo_ord_cosgtos + + + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_coef_norm_ord_cosgtos (ao_num,ao_prim_num_max) + complex*16, allocatable :: ao_expo_ord_cosgtos (ao_num,ao_prim_num_max) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cosgtos` + * :c:data:`ao_expo` + * :c:data:`ao_expoim_cosgtos` + * :c:data:`ao_num` + * :c:data:`ao_prim_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + + +.. c:var:: ao_expo_ord_transp_cosgtos + + + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` + + .. code:: fortran + + complex*16, allocatable :: ao_expo_ord_transp_cosgtos (ao_prim_num_max,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_ord_cosgtos` + * :c:data:`ao_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_2e_cosgtos_schwartz` + * :c:data:`ao_deriv2_cosgtos_x` + * :c:data:`ao_integrals_n_e_cosgtos` + * :c:data:`ao_overlap_cosgtos` + + +.. c:var:: ao_expo_phase_ord + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_coef_norm_cgtos_ord (ao_num,ao_prim_num_max) + complex*16, allocatable :: ao_expo_cgtos_ord (ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_pw_ord (4,ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_phase_ord (4,ao_num,ao_prim_num_max) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` + * :c:data:`ao_num` + * :c:data:`ao_prim_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + + +.. c:var:: ao_expo_phase_ord_transp + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + complex*16, allocatable :: ao_expo_cgtos_ord_transp (ao_prim_num_max,ao_num) + double precision, allocatable :: ao_expo_pw_ord_transp (4,ao_prim_num_max,ao_num) + double precision, allocatable :: ao_expo_phase_ord_transp (4,ao_prim_num_max,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos_ord` + * :c:data:`ao_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_integrals_n_e_cgtos` + * :c:data:`ao_overlap_cgtos` + * :c:data:`use_pw` + + +.. c:var:: ao_expo_pw_ord + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_coef_norm_cgtos_ord (ao_num,ao_prim_num_max) + complex*16, allocatable :: ao_expo_cgtos_ord (ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_pw_ord (4,ao_num,ao_prim_num_max) + double precision, allocatable :: ao_expo_phase_ord (4,ao_num,ao_prim_num_max) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` + * :c:data:`ao_num` + * :c:data:`ao_prim_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + + +.. c:var:: ao_expo_pw_ord_transp + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + complex*16, allocatable :: ao_expo_cgtos_ord_transp (ao_prim_num_max,ao_num) + double precision, allocatable :: ao_expo_pw_ord_transp (4,ao_prim_num_max,ao_num) + double precision, allocatable :: ao_expo_phase_ord_transp (4,ao_prim_num_max,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos_ord` + * :c:data:`ao_num` + * :c:data:`ao_prim_num_max` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_integrals_n_e_cgtos` + * :c:data:`ao_overlap_cgtos` + * :c:data:`use_pw` + + +.. c:var:: ao_integrals_n_e + + + File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_integrals_n_e (ao_num,ao_num) + + + Nucleus-electron interaction, in the |AO| basis set. + + :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle` + + These integrals also contain the pseudopotential integrals. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_n_e_cgtos` + * :c:data:`ao_integrals_pt_chrg` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`ao_pseudo_integrals` + * :c:data:`do_pseudo` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + * :c:data:`point_charges` + * :c:data:`read_ao_integrals_n_e` + * :c:data:`use_cgtos` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_ortho_canonical_nucl_elec_integrals` + * :c:data:`ao_ortho_lowdin_nucl_elec_integrals` + * :c:data:`hf_kinetic_energy` + * :c:data:`mo_integrals_n_e` + + +.. c:var:: ao_integrals_n_e_cgtos + + + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_integrals_n_e_cgtos (ao_num,ao_num) + + + + Nucleus-electron interaction, in the cgtos |AO| basis set. + + :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle` + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + * :c:data:`use_pw` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + + +.. c:var:: ao_integrals_n_e_cosgtos + + + File : :file:`ao_one_e_ints/one_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_integrals_n_e_cosgtos (ao_num,ao_num) + + + + Nucleus-electron interaction, in the cosgtos |AO| basis set. + + :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle` + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + + +.. c:var:: ao_integrals_n_e_imag + + + File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_integrals_n_e_imag (ao_num,ao_num) + + + Nucleus-electron interaction, in the |AO| basis set. + + :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`read_ao_integrals_n_e` + + + +.. c:var:: ao_integrals_n_e_per_atom + + + File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_integrals_n_e_per_atom (ao_num,ao_num,nucl_num) + + + Nucleus-electron interaction in the |AO| basis set, per atom A. + + :math:`\langle \chi_i | -\frac{1}{|r-R_A|} | \chi_j \rangle` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_n_e_per_atom` + + +.. c:var:: ao_integrals_pt_chrg + + + File : :file:`ao_one_e_ints/pot_pt_charges.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_integrals_pt_chrg (ao_num,ao_num) + + + Point charge-electron interaction, in the |AO| basis set. + + :math:`\langle \chi_i | -\sum_charge charge * \frac{1}{|r-R_charge|} | \chi_j \rangle` + + Notice the minus sign convention as it is supposed to be for electrons. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`n_pts_charge` + * :c:data:`nucl_coord` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + + +.. c:var:: ao_kinetic_integrals + + + File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_kinetic_integrals (ao_num,ao_num) + + + Kinetic energy integrals in the |AO| basis. + + :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_deriv2_x` + * :c:data:`ao_num` + * :c:data:`read_ao_integrals_kinetic` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_one_e_integrals` + * :c:data:`hf_kinetic_energy` + * :c:data:`mo_kinetic_integrals` + + +.. c:var:: ao_kinetic_integrals_cgtos + + + File : :file:`ao_one_e_ints/one_e_kin_integrals_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_kinetic_integrals_cgtos (ao_num,ao_num) + + + + Kinetic energy integrals in the cgtos |AO| basis. + + :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_num` + + + +.. c:var:: ao_kinetic_integrals_cosgtos + + + File : :file:`ao_one_e_ints/one_e_kin_integrals_cosgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_kinetic_integrals_cosgtos (ao_num,ao_num) + + + + Kinetic energy integrals in the cosgtos |AO| basis. + + :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_deriv2_cosgtos_x` + * :c:data:`ao_num` + + + +.. c:var:: ao_kinetic_integrals_imag + + + File : :file:`ao_one_e_ints/kin_ao_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_kinetic_integrals_imag (ao_num,ao_num) + + + Kinetic energy integrals in the |AO| basis. + + :math:`\langle \chi_i |\hat{T}| \chi_j \rangle` - Needs: + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`read_ao_integrals_kinetic` + + + +.. c:var:: ao_one_e_integrals + + + File : :file:`ao_one_e_ints/ao_one_e_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_one_e_integrals (ao_num,ao_num) + double precision, allocatable :: ao_one_e_integrals_diag (ao_num) + + + One-electron Hamiltonian in the |AO| basis. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_num` + * :c:data:`read_ao_one_e_integrals` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`hf_energy` + * :c:data:`scf_energy` + + +.. c:var:: ao_one_e_integrals_diag + + + File : :file:`ao_one_e_ints/ao_one_e_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_one_e_integrals (ao_num,ao_num) + double precision, allocatable :: ao_one_e_integrals_diag (ao_num) + + + One-electron Hamiltonian in the |AO| basis. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_num` + * :c:data:`read_ao_one_e_integrals` + + Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_num` - * :c:data:`read_ao_integrals_kinetic` - + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`hf_energy` + * :c:data:`scf_energy` -.. c:var:: ao_one_e_integrals +.. c:var:: ao_one_e_integrals_imag File : :file:`ao_one_e_ints/ao_one_e_ints.irp.f` .. code:: fortran - double precision, allocatable :: ao_one_e_integrals (ao_num,ao_num) - double precision, allocatable :: ao_one_e_integrals_diag (ao_num) + double precision, allocatable :: ao_one_e_integrals_imag (ao_num,ao_num) One-electron Hamiltonian in the |AO| basis. @@ -738,49 +1735,63 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_integrals_n_e` - * :c:data:`ao_kinetic_integrals` * :c:data:`ao_num` * :c:data:`read_ao_one_e_integrals` -.. c:var:: ao_one_e_integrals_diag +.. c:var:: ao_ortho_canonical_coef - File : :file:`ao_one_e_ints/ao_one_e_ints.irp.f` + File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` .. code:: fortran - double precision, allocatable :: ao_one_e_integrals (ao_num,ao_num) - double precision, allocatable :: ao_one_e_integrals_diag (ao_num) + double precision, allocatable :: ao_ortho_canonical_coef (ao_num,ao_num) + integer :: ao_ortho_canonical_num - One-electron Hamiltonian in the |AO| basis. + matrix of the coefficients of the mos generated by the + orthonormalization by the S^{-1/2} canonical transformation of the aos + ao_ortho_canonical_coef(i,j) = coefficient of the ith ao on the jth ao_ortho_canonical orbital Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_n_e` - * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_cart_to_sphe_coef` + * :c:data:`ao_cart_to_sphe_overlap` + * :c:data:`ao_cartesian` * :c:data:`ao_num` - * :c:data:`read_ao_one_e_integrals` + * :c:data:`ao_overlap` + * :c:data:`lin_dep_cutoff` + * :c:data:`mpi_master` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`ao_ortho_canonical_coef_inv` + * :c:data:`ao_ortho_canonical_nucl_elec_integrals` + * :c:data:`ao_ortho_canonical_overlap` + * :c:data:`mo_coef` + * :c:data:`mo_coef_aux` + * :c:data:`mo_num` -.. c:var:: ao_one_e_integrals_imag +.. c:var:: ao_ortho_canonical_coef_inv - File : :file:`ao_one_e_ints/ao_one_e_ints.irp.f` + File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` .. code:: fortran - double precision, allocatable :: ao_one_e_integrals_imag (ao_num,ao_num) + double precision, allocatable :: ao_ortho_canonical_coef_inv (ao_num,ao_num) - One-electron Hamiltonian in the |AO| basis. + ao_ortho_canonical_coef^(-1) Needs: @@ -788,11 +1799,17 @@ Providers :columns: 3 * :c:data:`ao_num` - * :c:data:`read_ao_one_e_integrals` + * :c:data:`ao_ortho_canonical_coef` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`mo_coef_in_ao_ortho_basis` -.. c:var:: ao_ortho_canonical_coef +.. c:var:: ao_ortho_canonical_num File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` @@ -812,222 +1829,449 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_cart_to_sphe_coef` - * :c:data:`ao_cart_to_sphe_overlap` - * :c:data:`ao_cartesian` + * :c:data:`ao_cart_to_sphe_coef` + * :c:data:`ao_cart_to_sphe_overlap` + * :c:data:`ao_cartesian` + * :c:data:`ao_num` + * :c:data:`ao_overlap` + * :c:data:`lin_dep_cutoff` + * :c:data:`mpi_master` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_ortho_canonical_coef_inv` + * :c:data:`ao_ortho_canonical_nucl_elec_integrals` + * :c:data:`ao_ortho_canonical_overlap` + * :c:data:`mo_coef` + * :c:data:`mo_coef_aux` + * :c:data:`mo_num` + + +.. c:var:: ao_ortho_canonical_overlap + + + File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_ortho_canonical_overlap (ao_ortho_canonical_num,ao_ortho_canonical_num) + + + overlap matrix of the ao_ortho_canonical. + Expected to be the Identity + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_ortho_canonical_coef` + * :c:data:`ao_overlap` + + + +.. c:var:: ao_overlap + + + File : :file:`ao_one_e_ints/ao_overlap.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_overlap (ao_num,ao_num) + double precision, allocatable :: ao_overlap_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_z (ao_num,ao_num) + + + Overlap between atomic basis functions: + + :math:`\int \chi_i(r) \chi_j(r) dr` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_overlap_cgtos` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + * :c:data:`read_ao_integrals_overlap` + * :c:data:`use_cgtos` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_cart_to_sphe_overlap` + * :c:data:`ao_ortho_canonical_coef` + * :c:data:`ao_ortho_canonical_overlap` + * :c:data:`ao_ortho_lowdin_coef` + * :c:data:`ao_ortho_lowdin_overlap` + * :c:data:`ao_overlap_complex` + * :c:data:`fps_spf_matrix_ao` + * :c:data:`mo_overlap` + * :c:data:`s_half` + * :c:data:`s_half_inv` + * :c:data:`s_inv` + * :c:data:`s_mo_coef` + + +.. c:var:: ao_overlap_abs + + + File : :file:`ao_one_e_ints/ao_overlap.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_overlap_abs (ao_num,ao_num) + + + Overlap between absolute values of atomic basis functions: + + :math:`\int |\chi_i(r)| |\chi_j(r)| dr` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_overlap_complex` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`is_periodic` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`cholesky_ao_num` + + +.. c:var:: ao_overlap_cgtos + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_overlap_cgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_z (ao_num,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_overlap` + + +.. c:var:: ao_overlap_cgtos_x + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_overlap_cgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_z (ao_num,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_overlap` + + +.. c:var:: ao_overlap_cgtos_y + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_overlap_cgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_z (ao_num,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_overlap` - * :c:data:`lin_dep_cutoff` - * :c:data:`mpi_master` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_ortho_canonical_coef_inv` - * :c:data:`ao_ortho_canonical_overlap` - * :c:data:`mo_coef` - * :c:data:`mo_num` + * :c:data:`ao_overlap` -.. c:var:: ao_ortho_canonical_coef_inv +.. c:var:: ao_overlap_cgtos_z - File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_ortho_canonical_coef_inv (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cgtos_z (ao_num,ao_num) - ao_ortho_canonical_coef^(-1) Needs: .. hlist:: :columns: 3 + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_ortho_canonical_coef` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` Needed by: .. hlist:: :columns: 3 - * :c:data:`mo_coef_in_ao_ortho_basis` + * :c:data:`ao_overlap` -.. c:var:: ao_ortho_canonical_num +.. c:var:: ao_overlap_complex - File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` + File : :file:`ao_one_e_ints/ao_overlap.irp.f` .. code:: fortran - double precision, allocatable :: ao_ortho_canonical_coef (ao_num,ao_num) - integer :: ao_ortho_canonical_num + complex*16, allocatable :: ao_overlap_complex (ao_num,ao_num) - matrix of the coefficients of the mos generated by the - orthonormalization by the S^{-1/2} canonical transformation of the aos - ao_ortho_canonical_coef(i,j) = coefficient of the ith ao on the jth ao_ortho_canonical orbital + Overlap for complex AOs Needs: .. hlist:: :columns: 3 - * :c:data:`ao_cart_to_sphe_coef` - * :c:data:`ao_cart_to_sphe_overlap` - * :c:data:`ao_cartesian` * :c:data:`ao_num` * :c:data:`ao_overlap` - * :c:data:`lin_dep_cutoff` - * :c:data:`mpi_master` + * :c:data:`ao_overlap_imag` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_ortho_canonical_coef_inv` - * :c:data:`ao_ortho_canonical_overlap` - * :c:data:`mo_coef` - * :c:data:`mo_num` + * :c:data:`ao_overlap_abs` + * :c:data:`s_inv_complex` -.. c:var:: ao_ortho_canonical_overlap +.. c:var:: ao_overlap_cosgtos - File : :file:`ao_one_e_ints/ao_ortho_canonical.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_ortho_canonical_overlap (ao_ortho_canonical_num,ao_ortho_canonical_num) + double precision, allocatable :: ao_overlap_cosgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_z (ao_num,ao_num) - overlap matrix of the ao_ortho_canonical. - Expected to be the Identity Needs: .. hlist:: :columns: 3 + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_ortho_canonical_coef` - * :c:data:`ao_overlap` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`ao_overlap` -.. c:var:: ao_overlap +.. c:var:: ao_overlap_cosgtos_x - File : :file:`ao_one_e_ints/ao_overlap.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_overlap (ao_num,ao_num) - double precision, allocatable :: ao_overlap_x (ao_num,ao_num) - double precision, allocatable :: ao_overlap_y (ao_num,ao_num) - double precision, allocatable :: ao_overlap_z (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_z (ao_num,ao_num) - Overlap between atomic basis functions: - - :math:`\int \chi_i(r) \chi_j(r) dr` Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_power` * :c:data:`ao_prim_num` * :c:data:`nucl_coord` - * :c:data:`read_ao_integrals_overlap` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_cart_to_sphe_overlap` - * :c:data:`ao_ortho_canonical_coef` - * :c:data:`ao_ortho_canonical_overlap` - * :c:data:`ao_overlap_complex` - * :c:data:`mo_overlap` - * :c:data:`s_half` - * :c:data:`s_half_inv` - * :c:data:`s_inv` - * :c:data:`s_mo_coef` + * :c:data:`ao_overlap` -.. c:var:: ao_overlap_abs +.. c:var:: ao_overlap_cosgtos_y - File : :file:`ao_one_e_ints/ao_overlap.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - double precision, allocatable :: ao_overlap_abs (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_z (ao_num,ao_num) - Overlap between absolute values of atomic basis functions: - - :math:`\int |\chi_i(r)| |\chi_j(r)| dr` Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_overlap_complex` * :c:data:`ao_power` * :c:data:`ao_prim_num` - * :c:data:`is_periodic` * :c:data:`nucl_coord` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_overlap` -.. c:var:: ao_overlap_complex +.. c:var:: ao_overlap_cosgtos_z - File : :file:`ao_one_e_ints/ao_overlap.irp.f` + File : :file:`ao_one_e_ints/aos_cosgtos.irp.f` .. code:: fortran - complex*16, allocatable :: ao_overlap_complex (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_x (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_y (ao_num,ao_num) + double precision, allocatable :: ao_overlap_cosgtos_z (ao_num,ao_num) - Overlap for complex AOs Needs: .. hlist:: :columns: 3 + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_overlap` - * :c:data:`ao_overlap_imag` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`nucl_coord` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_overlap_abs` - * :c:data:`s_inv_complex` + * :c:data:`ao_overlap` .. c:var:: ao_overlap_imag @@ -1083,10 +2327,12 @@ Providers * :c:data:`ao_expo_ordered_transp` * :c:data:`ao_nucl` * :c:data:`ao_num` + * :c:data:`ao_overlap_cgtos` * :c:data:`ao_power` * :c:data:`ao_prim_num` * :c:data:`nucl_coord` * :c:data:`read_ao_integrals_overlap` + * :c:data:`use_cgtos` Needed by: @@ -1096,7 +2342,10 @@ Providers * :c:data:`ao_cart_to_sphe_overlap` * :c:data:`ao_ortho_canonical_coef` * :c:data:`ao_ortho_canonical_overlap` + * :c:data:`ao_ortho_lowdin_coef` + * :c:data:`ao_ortho_lowdin_overlap` * :c:data:`ao_overlap_complex` + * :c:data:`fps_spf_matrix_ao` * :c:data:`mo_overlap` * :c:data:`s_half` * :c:data:`s_half_inv` @@ -1130,10 +2379,12 @@ Providers * :c:data:`ao_expo_ordered_transp` * :c:data:`ao_nucl` * :c:data:`ao_num` + * :c:data:`ao_overlap_cgtos` * :c:data:`ao_power` * :c:data:`ao_prim_num` * :c:data:`nucl_coord` * :c:data:`read_ao_integrals_overlap` + * :c:data:`use_cgtos` Needed by: @@ -1143,7 +2394,10 @@ Providers * :c:data:`ao_cart_to_sphe_overlap` * :c:data:`ao_ortho_canonical_coef` * :c:data:`ao_ortho_canonical_overlap` + * :c:data:`ao_ortho_lowdin_coef` + * :c:data:`ao_ortho_lowdin_overlap` * :c:data:`ao_overlap_complex` + * :c:data:`fps_spf_matrix_ao` * :c:data:`mo_overlap` * :c:data:`s_half` * :c:data:`s_half_inv` @@ -1177,10 +2431,12 @@ Providers * :c:data:`ao_expo_ordered_transp` * :c:data:`ao_nucl` * :c:data:`ao_num` + * :c:data:`ao_overlap_cgtos` * :c:data:`ao_power` * :c:data:`ao_prim_num` * :c:data:`nucl_coord` * :c:data:`read_ao_integrals_overlap` + * :c:data:`use_cgtos` Needed by: @@ -1190,7 +2446,10 @@ Providers * :c:data:`ao_cart_to_sphe_overlap` * :c:data:`ao_ortho_canonical_coef` * :c:data:`ao_ortho_canonical_overlap` + * :c:data:`ao_ortho_lowdin_coef` + * :c:data:`ao_ortho_lowdin_overlap` * :c:data:`ao_overlap_complex` + * :c:data:`fps_spf_matrix_ao` * :c:data:`mo_overlap` * :c:data:`s_half` * :c:data:`s_half_inv` @@ -1258,8 +2517,10 @@ Providers * :c:data:`nucl_charge` * :c:data:`nucl_coord` * :c:data:`nucl_num` + * :c:data:`pseudo_v_k_transp` * :c:data:`pseudo_klocmax` * :c:data:`pseudo_v_k_transp` + * :c:data:`pseudo_v_k_transp` Needed by: @@ -1267,6 +2528,7 @@ Providers :columns: 3 * :c:data:`ao_pseudo_integrals` + * :c:data:`mo_pseudo_integrals_local` .. c:var:: ao_pseudo_integrals_non_local @@ -1295,9 +2557,11 @@ Providers * :c:data:`nucl_charge` * :c:data:`nucl_coord` * :c:data:`nucl_num` + * :c:data:`pseudo_v_kl_transp` * :c:data:`pseudo_kmax` * :c:data:`pseudo_lmax` * :c:data:`pseudo_v_kl_transp` + * :c:data:`pseudo_v_kl_transp` Needed by: @@ -1305,6 +2569,7 @@ Providers :columns: 3 * :c:data:`ao_pseudo_integrals` + * :c:data:`mo_pseudo_integrals_non_local` .. c:var:: ao_spread_x @@ -1424,122 +2689,277 @@ Providers * :c:data:`mo_spread_x` -.. c:function:: give_polynomial_mult_center_one_e_erf: +.. c:function:: give_cpolynomial_mult_center_one_e: - File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + subroutine give_cpolynomial_mult_center_one_e(A_center, B_center, alpha, beta, & + power_A, power_B, C_center, n_pt_in, d, n_pt_out) + + + Returns the explicit polynomial in terms of the "t" variable of the following + + $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`nai_pol_mult_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e_cgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_one_e: + + + File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_one_e(a,c,R1x,R1xp,R2x,d,nd,n_pt_in) + + + Recursive routine involved in the electron-nucleus potential + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`give_polynomial_mult_center_one_e` + * :c:func:`give_polynomial_mult_center_one_e_erf` + * :c:func:`give_polynomial_mult_center_one_e_erf_opt` + * :c:func:`i_x1_pol_mult_one_e` + * :c:func:`i_x2_pol_mult_one_e` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e` + * :c:func:`i_x2_pol_mult_one_e` + * :c:func:`multiply_poly_c2` + + +.. c:function:: i_x1_pol_mult_one_e_cgtos: + + + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_one_e_cgtos(a, c, R1x, R1xp, R2x, d, nd, n_pt_in) + + + Recursive routine involved in the electron-nucleus potential + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`give_cpolynomial_mult_center_one_e` + * :c:func:`i_x1_pol_mult_one_e_cgtos` + * :c:func:`i_x2_pol_mult_one_e_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e_cgtos` + * :c:func:`i_x2_pol_mult_one_e_cgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_one_e_cosgtos: + + + File : :file:`ao_one_e_ints/one_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_one_e_cosgtos(a, c, R1x, R1xp, R2x, d, nd, n_pt_in) + + + Recursive routine involved in the electron-nucleus potential + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`give_cpolynomial_mult_center_one_e` + * :c:func:`i_x1_pol_mult_one_e_cosgtos` + * :c:func:`i_x2_pol_mult_one_e_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e_cosgtos` + * :c:func:`i_x2_pol_mult_one_e_cosgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x2_pol_mult_one_e: + + + File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_pol_mult_one_e(c,R1x,R1xp,R2x,d,nd,dim) + + + Recursive routine involved in the electron-nucleus potential + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e` + * :c:func:`multiply_poly_c2` + + +.. c:function:: i_x2_pol_mult_one_e_cgtos: + + + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` .. code:: fortran - subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,& - power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in) + recursive subroutine I_x2_pol_mult_one_e_cgtos(c, R1x, R1xp, R2x, d, nd, dim) + + + Recursive routine involved in the electron-nucleus potential + + Called by: + .. hlist:: + :columns: 3 - Returns the explicit polynomial in terms of the $t$ variable of the - following polynomial: - - $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. + * :c:func:`i_x1_pol_mult_one_e_cgtos` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_one_e` - * :c:func:`multiply_poly` + * :c:func:`i_x1_pol_mult_one_e_cgtos` + * :c:func:`multiply_cpoly` -.. c:function:: give_polynomial_mult_center_one_e_erf_opt: +.. c:function:: i_x2_pol_mult_one_e_cosgtos: - File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_Coul_integrals_cosgtos.irp.f` .. code:: fortran - subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,beta,& - power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center) + recursive subroutine I_x2_pol_mult_one_e_cosgtos(c, R1x, R1xp, R2x, d, nd, dim) - Returns the explicit polynomial in terms of the $t$ variable of the - following polynomial: - - $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. + Recursive routine involved in the electron-nucleus potential Called by: .. hlist:: :columns: 3 - * :c:func:`nai_pol_mult_erf` + * :c:func:`i_x1_pol_mult_one_e_cosgtos` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_one_e` - * :c:func:`multiply_poly` + * :c:func:`i_x1_pol_mult_one_e_cosgtos` + * :c:func:`multiply_cpoly` -.. c:function:: i_x1_pol_mult_one_e: +.. c:function:: nai_pol_mult_cgtos: - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` .. code:: fortran - recursive subroutine I_x1_pol_mult_one_e(a,c,R1x,R1xp,R2x,d,nd,n_pt_in) + complex*16 function NAI_pol_mult_cgtos(Ae_center, Be_center, power_A, power_B, alpha, beta, & + Ap_center, Bp_center, C_center, n_pt_in) - Recursive routine involved in the electron-nucleus potential + + Computes the electron-nucleus attraction with two primitves cgtos. + + :math:`\langle g_i | \frac{1}{|r-R_c|} | g_j \rangle` + - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`give_polynomial_mult_center_one_e` - * :c:func:`give_polynomial_mult_center_one_e_erf` - * :c:func:`give_polynomial_mult_center_one_e_erf_opt` - * :c:func:`i_x1_pol_mult_one_e` - * :c:func:`i_x2_pol_mult_one_e` + * :c:data:`use_pw` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_one_e` - * :c:func:`i_x2_pol_mult_one_e` - * :c:func:`multiply_poly` + * :c:func:`give_cpolynomial_mult_center_one_e` -.. c:function:: i_x2_pol_mult_one_e: +.. c:function:: nai_pol_mult_erf_with1s: - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` .. code:: fortran - recursive subroutine I_x2_pol_mult_one_e(c,R1x,R1xp,R2x,d,nd,dim) - + double precision function NAI_pol_mult_erf_with1s( A1_center, A2_center, power_A1, power_A2, alpha1, alpha2 & + , beta, B_center, C_center, n_pt_in, mu_in ) - Recursive routine involved in the electron-nucleus potential - - Called by: - - .. hlist:: - :columns: 3 - * :c:func:`i_x1_pol_mult_one_e` + + Computes the following integral : + + .. math:: + + \int dx (x - A1_x)^a_1 (x - B1_x)^a_2 \exp(-\alpha_1 (x - A1_x)^2 - \alpha_2 (x - A2_x)^2) + \int dy (y - A1_y)^b_1 (y - B1_y)^b_2 \exp(-\alpha_1 (y - A1_y)^2 - \alpha_2 (y - A2_y)^2) + \int dz (x - A1_z)^c_1 (z - B1_z)^c_2 \exp(-\alpha_1 (z - A1_z)^2 - \alpha_2 (z - A2_z)^2) + \exp(-\beta (r - B)^2) + \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$. + Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_one_e` - * :c:func:`multiply_poly` + * :c:func:`give_polynomial_mult_center_one_e_erf_opt` .. c:var:: pseudo_dz_k_transp @@ -1785,6 +3205,12 @@ Providers * :c:data:`ao_num` * :c:data:`ao_overlap` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`eigenvalues_fock_matrix_ao` .. c:var:: s_inv @@ -1833,6 +3259,34 @@ Providers +.. c:var:: use_pw + + + File : :file:`ao_one_e_ints/aos_cgtos.irp.f` + + .. code:: fortran + + logical :: use_pw + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_integrals_n_e_cgtos` + + Subroutines / functions ----------------------- @@ -1853,10 +3307,11 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`ao_integrals_threshold` + * :c:data:`ao_one_e_integrals_threshold` * :c:data:`ao_overlap_abs` * :c:data:`io_ao_integrals_overlap` * :c:data:`is_periodic` + * :c:data:`use_cgtos` .. c:function:: give_all_erf_kl_ao: @@ -1910,6 +3365,64 @@ Subroutines / functions * :c:func:`multiply_poly` +.. c:function:: give_polynomial_mult_center_one_e_erf: + + + File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + + .. code:: fortran + + subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in) + + + Returns the explicit polynomial in terms of the $t$ variable of the + following polynomial: + + $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e` + * :c:func:`multiply_poly` + + +.. c:function:: give_polynomial_mult_center_one_e_erf_opt: + + + File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + + .. code:: fortran + + subroutine give_polynomial_mult_center_one_e_erf_opt(A_center, B_center, power_A, power_B, C_center, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center) + + + Returns the explicit polynomial in terms of the $t$ variable of the + following polynomial: + + $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$. + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`nai_pol_mult_erf` + * :c:func:`nai_pol_mult_erf_v` + * :c:func:`nai_pol_mult_erf_with1s` + * :c:func:`nai_pol_mult_erf_with1s_v` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e` + * :c:func:`multiply_poly` + + .. c:function:: int_gaus_pol: @@ -1947,6 +3460,30 @@ Subroutines / functions * :c:func:`give_polynomial_mult_center_one_e` +.. c:function:: nai_pol_mult_cosgtos: + + + File : :file:`ao_one_e_ints/one_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + complex*16 function NAI_pol_mult_cosgtos(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in) + + + + Computes the electron-nucleus attraction with two primitves cosgtos. + + :math:`\langle g_i | \frac{1}{|r-R_c|} | g_j \rangle` + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_cpolynomial_mult_center_one_e` + + .. c:function:: nai_pol_mult_erf: @@ -1954,15 +3491,16 @@ Subroutines / functions .. code:: fortran - double precision function NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in,mu_in) + double precision function NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in) + Computes the following integral : .. math:: \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 ) - \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$. + \frac{\erf(\mu |r - R_C |)}{| r - R_C |}$. Calls: @@ -1980,11 +3518,42 @@ Subroutines / functions .. code:: fortran - double precision function NAI_pol_mult_erf_ao(i_ao,j_ao,mu_in,C_center) + double precision function NAI_pol_mult_erf_ao(i_ao, j_ao, mu_in, C_center) + + + + Computes the following integral : + $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$. + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + +.. c:function:: nai_pol_mult_erf_ao_with1s: + + + File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + + .. code:: fortran + + double precision function NAI_pol_mult_erf_ao_with1s(i_ao, j_ao, beta, B_center, mu_in, C_center) + Computes the following integral : - $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$. + $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$. + Needs: @@ -2000,6 +3569,63 @@ Subroutines / functions * :c:data:`nucl_coord` +.. c:function:: nai_pol_mult_erf_v: + + + File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + + .. code:: fortran + + subroutine NAI_pol_mult_erf_v(A_center, B_center, power_A, power_B, alpha, beta, C_center, LD_C, n_pt_in, mu_in, res_v, LD_resv, n_points) + + + + Computes the following integral : + + .. math:: + + \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 ) + \frac{\erf(\mu |r - R_C |)}{| r - R_C |}$. + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_polynomial_mult_center_one_e_erf_opt` + + +.. c:function:: nai_pol_mult_erf_with1s_v: + + + File : :file:`ao_one_e_ints/pot_ao_erf_ints.irp.f` + + .. code:: fortran + + subroutine NAI_pol_mult_erf_with1s_v(A1_center, A2_center, power_A1, power_A2, alpha1, alpha2, beta, B_center, LD_B, C_center, LD_C, n_pt_in, mu_in, res_v, LD_resv, n_points) + + + + Computes the following integral : + + .. math :: + + \int dx (x - A1_x)^a_1 (x - B1_x)^a_2 \exp(-\alpha_1 (x - A1_x)^2 - \alpha_2 (x - A2_x)^2) + \int dy (y - A1_y)^b_1 (y - B1_y)^b_2 \exp(-\alpha_1 (y - A1_y)^2 - \alpha_2 (y - A2_y)^2) + \int dz (x - A1_z)^c_1 (z - B1_z)^c_2 \exp(-\alpha_1 (z - A1_z)^2 - \alpha_2 (z - A2_z)^2) + \exp(-\beta (r - B)^2) + \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$. + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_polynomial_mult_center_one_e_erf_opt` + + .. c:function:: overlap_bourrin_deriv_x: @@ -2056,7 +3682,7 @@ Subroutines / functions Computes the following integral : - int [-infty ; +infty] of [(x-A_center)^(power_A) * (x-B_center)^power_B * exp(-alpha(x-A_center)^2) * exp(-beta(x-B_center)^2) * x ] + int [-infty ; +infty] of [(x-A_center)^(power_A) * (x-B_center)^power_B * exp(-alpha(x-A_center)^2) * exp(-beta(x-B_center)^2) * x^2 ] needed for the dipole and those things Called by: @@ -2103,19 +3729,38 @@ Subroutines / functions $p_2 = x^{b_x} y^{b_y} z^{b_z} \exp(-\beta r^2)$ -.. c:function:: v_phi: +.. c:function:: v_n_e_cgtos: - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + complex*16 function V_n_e_cgtos(a_x, a_y, a_z, b_x, b_y, b_z, alpha, beta) + + + Primitve nuclear attraction between the two primitves centered on the same atom. + + $p_1 = x^{a_x} y^{a_y} z^{a_z} \exp(-\alpha r^2)$ + + $p_2 = x^{b_x} y^{b_y} z^{b_z} \exp(-\beta r^2)$ + + +.. c:function:: v_n_e_cosgtos: + + + File : :file:`ao_one_e_ints/one_e_Coul_integrals_cosgtos.irp.f` .. code:: fortran - double precision function V_phi(n,m) + complex*16 function V_n_e_cosgtos(a_x, a_y, a_z, b_x, b_y, b_z, alpha, beta) - Computes the angular $\phi$ part of the nuclear attraction integral: + Primitve nuclear attraction between the two primitves centered on the same atom. + + $p_1 = x^{a_x} y^{a_y} z^{a_z} \exp(-\alpha r^2)$ - $\int_{0}^{2 \pi} \cos(\phi)^n \sin(\phi)^m d\phi$. + $p_2 = x^{b_x} y^{b_y} z^{b_z} \exp(-\beta r^2)$ .. c:function:: v_r: @@ -2134,32 +3779,34 @@ Subroutines / functions -.. c:function:: v_theta: +.. c:function:: v_r_cgtos: - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_coul_integrals_cgtos.irp.f` .. code:: fortran - double precision function V_theta(n,m) + complex*16 function V_r_cgtos(n, alpha) - Computes the angular $\theta$ part of the nuclear attraction integral: + Computes the radial part of the nuclear attraction integral: + + $\int_{0}^{\infty} r^n \exp(-\alpha r^2) dr$ - $\int_{0}^{\pi} \cos(\theta)^n \sin(\theta)^m d\theta$ -.. c:function:: wallis: +.. c:function:: v_r_cosgtos: - File : :file:`ao_one_e_ints/pot_ao_ints.irp.f` + File : :file:`ao_one_e_ints/one_e_Coul_integrals_cosgtos.irp.f` .. code:: fortran - double precision function Wallis(n) + complex*16 function V_r_cosgtos(n, alpha) - Wallis integral: + Computes the radial part of the nuclear attraction integral: + + $\int_{0}^{\infty} r^n \exp(-\alpha r^2) dr$ - $\int_{0}^{\pi} \cos(\theta)^n d\theta$. diff --git a/docs/source/modules/ao_two_e_ints.rst b/docs/source/modules/ao_two_e_ints.rst index bc3a0ebf..bdbc776a 100644 --- a/docs/source/modules/ao_two_e_ints.rst +++ b/docs/source/modules/ao_two_e_ints.rst @@ -33,15 +33,39 @@ EZFIO parameters Default: None +.. option:: io_ao_cholesky + + Read/Write |AO| Cholesky integrals from/to disk [ Write | Read | None ] + + Default: None + .. option:: ao_integrals_threshold If | (pq|rs) | < `ao_integrals_threshold` then (pq|rs) is zero Default: 1.e-15 -.. option:: do_direct_integrals +.. option:: ao_cholesky_threshold + + If | (ii|jj) | < `ao_cholesky_threshold` then (ii|jj) is zero + + Default: 1.e-12 + +.. option:: do_ao_cholesky + + Perform Cholesky decomposition of AO integrals - Compute integrals on the fly (very slow, only for debugging) + Default: True + +.. option:: io_ao_two_e_integrals_erf + + Read/Write |AO| erf integrals from/to disk [ Write | Read | None ] + + Default: None + +.. option:: use_only_lr + + If true, use only the long range part of the two-electron integrals instead of 1/r12 Default: False @@ -49,6 +73,63 @@ EZFIO parameters Providers --------- +.. c:var:: ao_2e_cgtos_schwartz + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_2e_cgtos_schwartz (ao_num,ao_num) + + + Needed to compute Schwartz inequalities + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + * :c:data:`use_pw` + + + +.. c:var:: ao_2e_cosgtos_schwartz + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_2e_cosgtos_schwartz (ao_num,ao_num) + + + Needed to compute Schwartz inequalities + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + + .. c:var:: ao_integrals_cache @@ -70,6 +151,12 @@ Providers * :c:data:`ao_integrals_map` * :c:data:`ao_two_e_integrals_in_map` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_ao_num` .. c:var:: ao_integrals_cache_max @@ -99,6 +186,7 @@ Providers * :c:data:`ao_integrals_cache` * :c:data:`ao_integrals_cache_periodic` + * :c:data:`cholesky_ao_num` .. c:var:: ao_integrals_cache_min @@ -128,6 +216,7 @@ Providers * :c:data:`ao_integrals_cache` * :c:data:`ao_integrals_cache_periodic` + * :c:data:`cholesky_ao_num` .. c:var:: ao_integrals_cache_periodic @@ -153,582 +242,2418 @@ Providers -.. c:var:: ao_integrals_map +.. c:var:: ao_integrals_erf_cache - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - type(map_type) :: ao_integrals_map + double precision, allocatable :: ao_integrals_erf_cache (0:64*64*64*64) - AO integrals + Cache of |AO| integrals for fast access Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`ao_integrals_erf_cache_min` + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_two_e_integrals_erf_in_map` - * :c:data:`ao_integrals_cache` - * :c:data:`ao_integrals_cache_periodic` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`mo_two_e_integral_jj_from_ao` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` -.. c:var:: ao_two_e_integral_schwartz +.. c:var:: ao_integrals_erf_cache_max - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: ao_two_e_integral_schwartz (ao_num,ao_num) + integer :: ao_integrals_erf_cache_min + integer :: ao_integrals_erf_cache_max - Needed to compute Schwartz inequalities + Min and max values of the AOs for which the integrals are in the cache Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` - * :c:data:`n_pt_max_integrals` - * :c:data:`nucl_coord` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_erf_cache` -.. c:var:: ao_two_e_integrals_in_map +.. c:var:: ao_integrals_erf_cache_min - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - logical :: ao_two_e_integrals_in_map + integer :: ao_integrals_erf_cache_min + integer :: ao_integrals_erf_cache_max - Map of Atomic integrals - i(r1) j(r2) 1/r12 k(r1) l(r2) + Min and max values of the AOs for which the integrals are in the cache Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_integrals_map` - * :c:data:`ao_nucl` * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` - * :c:data:`ezfio_filename` - * :c:data:`io_ao_two_e_integrals` - * :c:data:`mpi_master` - * :c:data:`n_pt_max_integrals` - * :c:data:`nproc` - * :c:data:`nucl_coord` - * :c:data:`read_ao_two_e_integrals` - * :c:data:`zmq_context` - * :c:data:`zmq_socket_pull_tcp_address` - * :c:data:`zmq_state` Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_cache` - * :c:data:`ao_integrals_cache_periodic` - * :c:data:`mo_two_e_integral_jj_from_ao` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` + * :c:data:`ao_integrals_erf_cache` -.. c:var:: gauleg_t2 +.. c:var:: ao_integrals_erf_map - File : :file:`ao_two_e_ints/gauss_legendre.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: gauleg_t2 (n_pt_max_integrals,n_pt_max_integrals/2) - double precision, allocatable :: gauleg_w (n_pt_max_integrals,n_pt_max_integrals/2) + type(map_type) :: ao_integrals_erf_map - t_w(i,1,k) = w(i) - t_w(i,2,k) = t(i) + |AO| integrals Needs: .. hlist:: :columns: 3 - * :c:data:`n_pt_max_integrals` + * :c:data:`ao_num` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`ao_integrals_erf_cache` + * :c:data:`ao_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_int_erf_jj_from_ao` -.. c:var:: gauleg_w +.. c:var:: ao_integrals_map - File : :file:`ao_two_e_ints/gauss_legendre.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - double precision, allocatable :: gauleg_t2 (n_pt_max_integrals,n_pt_max_integrals/2) - double precision, allocatable :: gauleg_w (n_pt_max_integrals,n_pt_max_integrals/2) + type(map_type) :: ao_integrals_map - t_w(i,1,k) = w(i) - t_w(i,2,k) = t(i) + AO integrals Needs: .. hlist:: :columns: 3 - * :c:data:`n_pt_max_integrals` - - - -.. c:function:: general_primitive_integral: - - - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` - - .. code:: fortran - - double precision function general_primitive_integral(dim, & - P_new,P_center,fact_p,p,p_inv,iorder_p, & - Q_new,Q_center,fact_q,q,q_inv,iorder_q) - - - Computes the integral where p,q,r,s are Gaussian primitives + * :c:data:`ao_num` - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`add_poly_multiply` - * :c:func:`give_polynom_mult_center_x` - * :c:func:`multiply_poly` + * :c:data:`ao_integrals_cache` + * :c:data:`ao_integrals_cache_periodic` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` -.. c:function:: i_x1_new: +.. c:var:: ao_two_e_integral_erf_schwartz - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/providers_ao_erf.irp.f` .. code:: fortran - recursive subroutine I_x1_new(a,c,B_10,B_01,B_00,res,n_pt) + double precision, allocatable :: ao_two_e_integral_erf_schwartz (ao_num,ao_num) - recursive function involved in the two-electron integral + Needed to compute Schwartz inequalities Needs: .. hlist:: :columns: 3 + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`mu_erf` * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`i_x1_new` - * :c:func:`i_x2_new` - * :c:func:`integrale_new` - - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`i_x1_new` - * :c:func:`i_x2_new` + * :c:data:`mo_two_e_int_erf_jj_from_ao` -.. c:function:: i_x1_pol_mult_a1: +.. c:var:: ao_two_e_integral_schwartz File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - recursive subroutine I_x1_pol_mult_a1(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + double precision, allocatable :: ao_two_e_integral_schwartz (ao_num,ao_num) - Recursive function involved in the two-electron integral + Needed to compute Schwartz inequalities - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult` - * :c:func:`i_x1_pol_mult_a2` - * :c:func:`i_x1_pol_mult_recurs` + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`i_x2_pol_mult` - * :c:func:`multiply_poly` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`cholesky_ao_num` -.. c:function:: i_x1_pol_mult_a2: +.. c:var:: ao_two_e_integrals_erf_in_map - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/providers_ao_erf.irp.f` .. code:: fortran - recursive subroutine I_x1_pol_mult_a2(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + logical :: ao_two_e_integrals_erf_in_map - Recursive function involved in the two-electron integral + Map of Atomic integrals + i(r1) j(r2) 1/r12 k(r1) l(r2) - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult` - * :c:func:`i_x1_pol_mult_recurs` + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`ezfio_filename` + * :c:data:`io_ao_two_e_integrals_erf` + * :c:data:`mu_erf` + * :c:data:`n_pt_max_integrals` + * :c:data:`nproc` + * :c:data:`nucl_coord` + * :c:data:`read_ao_two_e_integrals_erf` + * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` + * :c:data:`zmq_state` - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_a1` - * :c:func:`i_x2_pol_mult` - * :c:func:`multiply_poly` + * :c:data:`ao_integrals_erf_cache` + * :c:data:`mo_two_e_int_erf_jj_from_ao` + * :c:data:`mo_two_e_integrals_erf_in_map` -.. c:function:: i_x1_pol_mult_recurs: +.. c:var:: ao_two_e_integrals_in_map File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - recursive subroutine I_x1_pol_mult_recurs(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + logical :: ao_two_e_integrals_in_map - Recursive function involved in the two-electron integral + Map of Atomic integrals + i(r1) j(r2) 1/r12 k(r1) l(r2) - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult` + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_map` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`ezfio_filename` + * :c:data:`io_ao_two_e_integrals` + * :c:data:`mpi_master` + * :c:data:`n_pt_max_integrals` + * :c:data:`nproc` + * :c:data:`nucl_coord` + * :c:data:`read_ao_two_e_integrals` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` + * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` + * :c:data:`zmq_state` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_cache` + * :c:data:`ao_integrals_cache_periodic` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`cholesky_ao_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` + + +.. c:var:: cholesky_ao + + + File : :file:`ao_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + integer :: cholesky_ao_num + double precision, allocatable :: cholesky_ao (ao_num,ao_num,1) + + + Cholesky vectors in AO basis: (ik|a): + = (ik|jl) = sum_a (ik|a).(a|jl) + + Last dimension of cholesky_ao is cholesky_ao_num + + https://mogp-emulator.readthedocs.io/en/latest/methods/proc/ProcPivotedCholesky.html + + https://doi.org/10.1016/j.apnum.2011.10.001 : Page 4, Algorithm 1 + + https://www.diva-portal.org/smash/get/diva2:396223/FULLTEXT01.pdf + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_cholesky_threshold` + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_cache` + * :c:data:`ao_integrals_cache_min` + * :c:data:`ao_integrals_map` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_overlap_abs` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`do_direct_integrals` + * :c:data:`elec_num` + * :c:data:`ezfio_work_dir` + * :c:data:`is_periodic` + * :c:data:`n_pt_max_integrals` + * :c:data:`nproc` + * :c:data:`nucl_coord` + * :c:data:`qp_max_mem` + * :c:data:`read_ao_cholesky` + * :c:data:`read_ao_two_e_integrals` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha_chol` + * :c:data:`cholesky_ao_transp` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + + +.. c:var:: cholesky_ao_num + + + File : :file:`ao_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + integer :: cholesky_ao_num + double precision, allocatable :: cholesky_ao (ao_num,ao_num,1) + + + Cholesky vectors in AO basis: (ik|a): + = (ik|jl) = sum_a (ik|a).(a|jl) + + Last dimension of cholesky_ao is cholesky_ao_num + + https://mogp-emulator.readthedocs.io/en/latest/methods/proc/ProcPivotedCholesky.html + + https://doi.org/10.1016/j.apnum.2011.10.001 : Page 4, Algorithm 1 + + https://www.diva-portal.org/smash/get/diva2:396223/FULLTEXT01.pdf + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_cholesky_threshold` + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_cache` + * :c:data:`ao_integrals_cache_min` + * :c:data:`ao_integrals_map` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_nucl` + * :c:data:`ao_num` + * :c:data:`ao_overlap_abs` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`do_direct_integrals` + * :c:data:`elec_num` + * :c:data:`ezfio_work_dir` + * :c:data:`is_periodic` + * :c:data:`n_pt_max_integrals` + * :c:data:`nproc` + * :c:data:`nucl_coord` + * :c:data:`qp_max_mem` + * :c:data:`read_ao_cholesky` + * :c:data:`read_ao_two_e_integrals` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha_chol` + * :c:data:`cholesky_ao_transp` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + + +.. c:var:: cholesky_ao_transp + + + File : :file:`ao_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + double precision, allocatable :: cholesky_ao_transp (cholesky_ao_num,ao_num,ao_num) + + + Transposed of the Cholesky vectors in AO basis set + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`cholesky_ao_num` + + + +.. c:var:: do_direct_integrals + + + File : :file:`ao_two_e_ints/direct.irp.f` + + .. code:: fortran + + logical :: do_direct_integrals + + + Compute integrals on the fly + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`do_ao_cholesky` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`cholesky_ao_num` + * :c:data:`mo_two_e_int_erf_jj_from_ao` + + +.. c:var:: gauleg_t2 + + + File : :file:`ao_two_e_ints/gauss_legendre.irp.f` + + .. code:: fortran + + double precision, allocatable :: gauleg_t2 (n_pt_max_integrals,n_pt_max_integrals/2) + double precision, allocatable :: gauleg_w (n_pt_max_integrals,n_pt_max_integrals/2) + + + t_w(i,1,k) = w(i) + t_w(i,2,k) = t(i) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + + +.. c:var:: gauleg_w + + + File : :file:`ao_two_e_ints/gauss_legendre.irp.f` + + .. code:: fortran + + double precision, allocatable :: gauleg_t2 (n_pt_max_integrals,n_pt_max_integrals/2) + double precision, allocatable :: gauleg_w (n_pt_max_integrals,n_pt_max_integrals/2) + + + t_w(i,1,k) = w(i) + t_w(i,2,k) = t(i) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + + +.. c:function:: general_primitive_integral: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + double precision function general_primitive_integral(dim, & + P_new,P_center,fact_p,p,p_inv,iorder_p, & + Q_new,Q_center,fact_q,q,q_inv,iorder_q) + + + Computes the integral where p,q,r,s are Gaussian primitives + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`add_poly_multiply` + * :c:func:`give_polynom_mult_center_x` + + +.. c:function:: general_primitive_integral_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + complex*16 function general_primitive_integral_cgtos(dim, P_new, P_center, fact_p, p, p_inv, iorder_p, & + Q_new, Q_center, fact_q, q, q_inv, iorder_q) + + + + Computes the integral where p,q,r,s are cos-cGTOS primitives + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`add_cpoly_multiply` + * :c:func:`give_cpolynom_mult_center_x` + * :c:func:`multiply_cpoly` + + +.. c:function:: general_primitive_integral_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + complex*16 function general_primitive_integral_cosgtos( dim, P_new, P_center, fact_p, p, p_inv, iorder_p & + , Q_new, Q_center, fact_q, q, q_inv, iorder_q ) + + + + Computes the integral where p,q,r,s are cos-cGTOS primitives + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`add_cpoly_multiply` + * :c:func:`give_cpolynom_mult_center_x` + * :c:func:`multiply_cpoly` + + +.. c:function:: general_primitive_integral_erf: + + + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` + + .. code:: fortran + + double precision function general_primitive_integral_erf(dim, & + P_new,P_center,fact_p,p,p_inv,iorder_p, & + Q_new,Q_center,fact_q,q,q_inv,iorder_q) + + + Computes the integral where p,q,r,s are Gaussian primitives + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_erf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`add_poly_multiply` + * :c:func:`give_polynom_mult_center_x` + * :c:func:`multiply_poly` + + +.. c:function:: give_cpolynom_mult_center_x: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + subroutine give_cpolynom_mult_center_x(P_center, Q_center, a_x, d_x, p, q, n_pt_in, & + pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, d, n_pt_out) + + + subroutine that returns the explicit polynom in term of the "t" + variable of the following polynoms : + + $I_{x_1}(a_x,d_x,p,q) \, I_{x_1}(a_y,d_y,p,q) \ I_{x_1}(a_z,d_z,p,q)$ + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`general_primitive_integral_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_cgtos` + + +.. c:function:: i_x1_new: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_new(a,c,B_10,B_01,B_00,res,n_pt) + + + recursive function involved in the two-electron integral + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new` + * :c:func:`i_x2_new` + * :c:func:`integrale_new` + * :c:func:`integrale_new_erf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new` + * :c:func:`i_x2_new` + + +.. c:function:: i_x1_new_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_new_cgtos(a, c, B_10, B_01, B_00, res, n_pt) + + + recursive function involved in the two-electron integral + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cgtos` + * :c:func:`i_x2_new_cgtos` + * :c:func:`integrale_new_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cgtos` + * :c:func:`i_x2_new_cgtos` + + +.. c:function:: i_x1_new_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_new_cosgtos(a, c, B_10, B_01, B_00, res, n_pt) + + + recursive function involved in the two-electron integral + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cosgtos` + * :c:func:`i_x2_new_cosgtos` + * :c:func:`integrale_new_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cosgtos` + * :c:func:`i_x2_new_cosgtos` + + +.. c:function:: i_x1_pol_mult_a1: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_a1(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult` + * :c:func:`i_x1_pol_mult_a2` + * :c:func:`i_x1_pol_mult_recurs` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x2_pol_mult` + + +.. c:function:: i_x1_pol_mult_a1_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_a1_cgtos(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a2_cgtos` + * :c:func:`i_x1_pol_mult_cgtos` + * :c:func:`i_x1_pol_mult_recurs_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x2_pol_mult_cgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_a1_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_a1_cosgtos(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a2_cosgtos` + * :c:func:`i_x1_pol_mult_cosgtos` + * :c:func:`i_x1_pol_mult_recurs_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x2_pol_mult_cosgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_a2: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_a2(c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult` + * :c:func:`i_x1_pol_mult_recurs` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1` + * :c:func:`i_x2_pol_mult` + + +.. c:function:: i_x1_pol_mult_a2_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_a2_cgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_cgtos` + * :c:func:`i_x1_pol_mult_recurs_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1_cgtos` + * :c:func:`i_x2_pol_mult_cgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_a2_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_a2_cosgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_cosgtos` + * :c:func:`i_x1_pol_mult_recurs_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1_cosgtos` + * :c:func:`i_x2_pol_mult_cosgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_recurs: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_recurs(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult` + * :c:func:`i_x1_pol_mult_recurs` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1` + * :c:func:`i_x1_pol_mult_a2` * :c:func:`i_x1_pol_mult_recurs` + +.. c:function:: i_x1_pol_mult_recurs_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_recurs_cgtos(a, c, B_10, B_01, B_00, C_00, D_00, d, nd, n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_cgtos` + * :c:func:`i_x1_pol_mult_recurs_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1_cgtos` + * :c:func:`i_x1_pol_mult_a2_cgtos` + * :c:func:`i_x1_pol_mult_recurs_cgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x1_pol_mult_recurs_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x1_pol_mult_recurs_cosgtos(a, c, B_10, B_01, B_00, C_00, D_00, d, nd, n_pt_in) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_cosgtos` + * :c:func:`i_x1_pol_mult_recurs_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1_cosgtos` + * :c:func:`i_x1_pol_mult_a2_cosgtos` + * :c:func:`i_x1_pol_mult_recurs_cosgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x2_new: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_new(c,B_10,B_01,B_00,res,n_pt) + + + recursive function involved in the two-electron integral + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new` + + +.. c:function:: i_x2_new_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_new_cgtos(c, B_10, B_01, B_00, res, n_pt) + + + recursive function involved in the two-electron integral + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cgtos` + + +.. c:function:: i_x2_new_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_new_cosgtos(c, B_10, B_01, B_00, res, n_pt) + + + recursive function involved in the two-electron integral + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cosgtos` + + +.. c:function:: i_x2_pol_mult: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_pol_mult(c,B_10,B_01,B_00,C_00,D_00,d,nd,dim) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult` + * :c:func:`i_x1_pol_mult_a1` + * :c:func:`i_x1_pol_mult_a2` + * :c:func:`i_x2_pol_mult` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x2_pol_mult` + + +.. c:function:: i_x2_pol_mult_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_pol_mult_cgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, dim) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1_cgtos` + * :c:func:`i_x1_pol_mult_a2_cgtos` + * :c:func:`i_x1_pol_mult_cgtos` + * :c:func:`i_x2_pol_mult_cgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x2_pol_mult_cgtos` + * :c:func:`multiply_cpoly` + + +.. c:function:: i_x2_pol_mult_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + recursive subroutine I_x2_pol_mult_cosgtos(c, B_10, B_01, B_00, C_00, D_00, d, nd, dim) + + + Recursive function involved in the two-electron integral + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1_cosgtos` + * :c:func:`i_x1_pol_mult_a2_cosgtos` + * :c:func:`i_x1_pol_mult_cosgtos` + * :c:func:`i_x2_pol_mult_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x2_pol_mult_cosgtos` + * :c:func:`multiply_cpoly` + + + +Subroutines / functions +----------------------- + +.. c:function:: ao_2e_cgtos_schwartz_accel: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + double precision function ao_2e_cgtos_schwartz_accel(i, j, k, l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + * :c:data:`use_pw` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_cpoly_and_cgaussian` + + +.. c:function:: ao_2e_cosgtos_schwartz_accel: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + double precision function ao_2e_cosgtos_schwartz_accel(i, j, k, l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_cpoly_and_cgaussian` + + +.. c:function:: ao_idx2_sq: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine ao_idx2_sq(i,j,ij) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`two_e_integrals_index_2fold` + + +.. c:function:: ao_idx2_sq_rev: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine ao_idx2_sq_rev(i,k,ik) + + + reverse square compound index + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`two_e_integrals_index_reverse_2fold` + + +.. c:function:: ao_idx2_tri_key: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine ao_idx2_tri_key(i,j,ij) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`two_e_integrals_index_2fold` + + +.. c:function:: ao_idx2_tri_rev_key: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine ao_idx2_tri_rev_key(i,k,ik) + + + return i<=k + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`two_e_integrals_index_reverse_2fold` + + +.. c:function:: ao_l4: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + integer function ao_l4(i,j,k,l) + + + Computes the product of l values of i,j,k,and l + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_l` + + +.. c:function:: ao_two_e_integral: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + double precision function ao_two_e_integral(i, j, k, l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_poly_and_gaussian` + + +.. c:function:: ao_two_e_integral_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + double precision function ao_two_e_integral_cgtos(i, j, k, l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + * :c:data:`use_pw` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_cpoly_and_cgaussian` + + +.. c:function:: ao_two_e_integral_cosgtos: + + + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` + + .. code:: fortran + + double precision function ao_two_e_integral_cosgtos(i, j, k, l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_ord_transp_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_cpoly_and_cgaussian` + + +.. c:function:: ao_two_e_integral_erf: + + + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` + + .. code:: fortran + + double precision function ao_two_e_integral_erf(i,j,k,l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`mu_erf` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_poly_and_gaussian` + + +.. c:function:: ao_two_e_integral_schwartz_accel: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + double precision function ao_two_e_integral_schwartz_accel(i,j,k,l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_poly_and_gaussian` + + +.. c:function:: ao_two_e_integral_schwartz_accel_erf: + + + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` + + .. code:: fortran + + double precision function ao_two_e_integral_schwartz_accel_erf(i,j,k,l) + + + integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp` + * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_nucl` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`n_pt_max_integrals` + * :c:data:`nucl_coord` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_poly_and_gaussian` + + +.. c:function:: ao_two_e_integral_zero: + + + File : :file:`ao_two_e_ints/screening.irp.f` + + .. code:: fortran + + logical function ao_two_e_integral_zero(i,j,k,l) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_overlap_abs` + * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`is_periodic` + * :c:data:`read_ao_two_e_integrals` + * :c:data:`use_cgtos` + + +.. c:function:: ao_two_e_integrals_erf_in_map_collector: + + + File : :file:`ao_two_e_ints/integrals_erf_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_erf_in_map_collector(zmq_socket_pull) + + + Collects results from the AO integral calculation + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`insert_into_ao_integrals_erf_map` + + +.. c:function:: ao_two_e_integrals_erf_in_map_slave: + + + File : :file:`ao_two_e_ints/integrals_erf_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_erf_in_map_slave(thread,iproc) + + + Computes a buffer of integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_erf_in_map_slave_inproc` + * :c:func:`ao_two_e_integrals_erf_in_map_slave_tcp` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`compute_ao_integrals_erf_jl` + * :c:func:`end_zmq_push_socket` + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`push_integrals` + + +.. c:function:: ao_two_e_integrals_erf_in_map_slave_inproc: + + + File : :file:`ao_two_e_ints/integrals_erf_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_erf_in_map_slave_inproc(i) + + + Computes a buffer of integrals. i is the ID of the current thread. + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_erf_in_map_slave` + + +.. c:function:: ao_two_e_integrals_erf_in_map_slave_tcp: + + + File : :file:`ao_two_e_ints/integrals_erf_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_erf_in_map_slave_tcp(i) + + + Computes a buffer of integrals. i is the ID of the current thread. + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_erf_in_map_slave` + + +.. c:function:: ao_two_e_integrals_in_map_collector: + + + File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_in_map_collector(zmq_socket_pull) + + + Collects results from the AO integral calculation + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_map` + * :c:data:`ao_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`insert_into_ao_integrals_map` + + +.. c:function:: ao_two_e_integrals_in_map_slave: + + + File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_in_map_slave(thread,iproc) + + + Computes a buffer of integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_in_map_slave_inproc` + * :c:func:`ao_two_e_integrals_in_map_slave_tcp` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`compute_ao_integrals_jl` + * :c:func:`end_zmq_push_socket` + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`push_integrals` + * :c:func:`sscanf_dd` + + +.. c:function:: ao_two_e_integrals_in_map_slave_inproc: + + + File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_in_map_slave_inproc(i) + + + Computes a buffer of integrals. i is the ID of the current thread. + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_in_map_slave` + + +.. c:function:: ao_two_e_integrals_in_map_slave_tcp: + + + File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + + .. code:: fortran + + subroutine ao_two_e_integrals_in_map_slave_tcp(i) + + + Computes a buffer of integrals. i is the ID of the current thread. + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_in_map_slave` + + +.. c:function:: clear_ao_erf_map: + + + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + subroutine clear_ao_erf_map + + + Frees the memory of the |AO| map + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_erf_map` + Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_a1` - * :c:func:`i_x1_pol_mult_a2` - * :c:func:`i_x1_pol_mult_recurs` - * :c:func:`multiply_poly` + * :c:func:`map_deinit` -.. c:function:: i_x2_new: +.. c:function:: clear_ao_map: + + + File : :file:`ao_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine clear_ao_map + + + Frees the memory of the AO map + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_deinit` + + +.. c:function:: compute_ao_integrals_erf_jl: + + + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` + + .. code:: fortran + + subroutine compute_ao_integrals_erf_jl(j,l,n_integrals,buffer_i,buffer_value) + + + Parallel client for AO integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_num` + * :c:data:`ao_two_e_integral_erf_schwartz` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_two_e_integrals_erf_in_map_slave` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`two_e_integrals_index` + + +.. c:function:: compute_ao_integrals_jl: File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - recursive subroutine I_x2_new(c,B_10,B_01,B_00,res,n_pt) + subroutine compute_ao_integrals_jl(j,l,n_integrals,buffer_i,buffer_value) - recursive function involved in the two-electron integral + Parallel client for AO integrals Needs: .. hlist:: :columns: 3 - * :c:data:`n_pt_max_integrals` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_num` Called by: .. hlist:: :columns: 3 - * :c:func:`i_x1_new` + * :c:func:`ao_two_e_integrals_in_map_slave` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_new` + * :c:func:`two_e_integrals_index` -.. c:function:: i_x2_pol_mult: +.. c:function:: compute_ao_two_e_integrals: File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - recursive subroutine I_x2_pol_mult(c,B_10,B_01,B_00,C_00,D_00,d,nd,dim) + subroutine compute_ao_two_e_integrals(j,k,l,sze,buffer_value) - Recursive function involved in the two-electron integral + Compute AO 1/r12 integrals for all i and fixed j,k,l + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + + +.. c:function:: compute_ao_two_e_integrals_erf: + + + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` + + .. code:: fortran + + subroutine compute_ao_two_e_integrals_erf(j,k,l,sze,buffer_value) + + + Compute AO 1/r12 integrals for all i and fixed j,k,l + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_two_e_integral_erf_schwartz` Called by: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult` - * :c:func:`i_x1_pol_mult_a1` - * :c:func:`i_x1_pol_mult_a2` - * :c:func:`i_x2_pol_mult` + * :c:data:`mo_two_e_int_erf_jj_from_ao` + + +.. c:function:: do_schwartz_accel: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + logical function do_schwartz_accel(i,j,k,l) + + + If true, use Schwatrz to accelerate direct integral calculation + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_prim_num` + * :c:data:`do_ao_cholesky` + + +.. c:function:: dump_ao_integrals_erf: + + + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + subroutine dump_ao_integrals_erf(filename) + + + Save to disk the |AO| erf integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_erf_map` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x2_pol_mult` - * :c:func:`multiply_poly` + * :c:func:`ezfio_set_work_empty` +.. c:function:: eri: + + + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + + .. code:: fortran + + double precision function ERI(alpha,beta,delta,gama,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) + + + ATOMIC PRIMTIVE two-electron integral between the 4 primitives :: + primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) + primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) + primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) + primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`integrale_new` + -Subroutines / functions ------------------------ +.. c:function:: eri_cgtos: + + + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` + + .. code:: fortran + + complex*16 function ERI_cgtos(alpha, beta, delta, gama, a_x, b_x, c_x, d_x, a_y, b_y, c_y, d_y, a_z, b_z, c_z, d_z) + + + ATOMIC PRIMTIVE two-electron integral between the 4 primitives :: + primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) + primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) + primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) + primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`integrale_new_cgtos` + -.. c:function:: ao_idx2_sq: +.. c:function:: eri_cosgtos: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` .. code:: fortran - subroutine ao_idx2_sq(i,j,ij) + complex*16 function ERI_cosgtos(alpha, beta, delta, gama, a_x, b_x, c_x, d_x, a_y, b_y, c_y, d_y, a_z, b_z, c_z, d_z) + ATOMIC PRIMTIVE two-electron integral between the 4 primitives :: + primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) + primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) + primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) + primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`two_e_integrals_index_2fold` + * :c:func:`integrale_new_cosgtos` -.. c:function:: ao_idx2_sq_rev: +.. c:function:: eri_erf: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` .. code:: fortran - subroutine ao_idx2_sq_rev(i,k,ik) + double precision function ERI_erf(alpha,beta,delta,gama,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) - reverse square compound index + Atomic primtive two-electron integral between the 4 primitives : + + * primitive 1 : $x_1^{a_x} y_1^{a_y} z_1^{a_z} \exp(-\alpha * r1^2)$ + * primitive 2 : $x_1^{b_x} y_1^{b_y} z_1^{b_z} \exp(- \beta * r1^2)$ + * primitive 3 : $x_2^{c_x} y_2^{c_y} z_2^{c_z} \exp(-\delta * r2^2)$ + * primitive 4 : $x_2^{d_x} y_2^{d_y} z_2^{d_z} \exp(-\gamma * r2^2)$ + - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`two_e_integrals_index_reverse_2fold` + * :c:data:`mu_erf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`integrale_new_erf` -.. c:function:: ao_idx2_tri_key: +.. c:function:: gauleg: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/gauss_legendre.irp.f` .. code:: fortran - subroutine ao_idx2_tri_key(i,j,ij) + subroutine gauleg(x1,x2,x,w,n) + Gauss-Legendre Called by: .. hlist:: :columns: 3 - * :c:func:`two_e_integrals_index_2fold` + * :c:data:`gauleg_t2` + + +.. c:function:: get_ao_erf_map_size: + + + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + function get_ao_erf_map_size() + + + Returns the number of elements in the |AO| map + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_erf_map` -.. c:function:: ao_idx2_tri_rev_key: +.. c:function:: get_ao_integ_chol: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/cholesky.irp.f` .. code:: fortran - subroutine ao_idx2_tri_rev_key(i,k,ik) + double precision function get_ao_integ_chol(i,j,k,l) - return i<=k + CHOLESKY representation of the integral of the AO basis or (ij|kl) + i(r1) j(r1) 1/r12 k(r2) l(r2) - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`two_e_integrals_index_reverse_2fold` + * :c:data:`cholesky_ao_num` + * :c:data:`cholesky_ao_transp` -.. c:function:: ao_l4: +.. c:function:: get_ao_map_size: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - integer function ao_l4(i,j,k,l) + function get_ao_map_size() - Computes the product of l values of i,j,k,and l + Returns the number of elements in the AO map Needs: .. hlist:: :columns: 3 - * :c:data:`ao_l` + * :c:data:`ao_integrals_map` -.. c:function:: ao_two_e_integral: +.. c:function:: get_ao_two_e_integral: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - double precision function ao_two_e_integral(i,j,k,l) + double precision function get_ao_two_e_integral(i, j, k, l, map) result(result) - integral of the AO basis or (ij|kl) - i(r1) j(r1) 1/r12 k(r2) l(r2) + Gets one AO bi-electronic integral from the AO map in PHYSICIST NOTATION + + <1:k, 2:l |1:i, 2:j> Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` - * :c:data:`ao_nucl` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` - * :c:data:`n_pt_max_integrals` - * :c:data:`nucl_coord` + * :c:data:`ao_integrals_cache` + * :c:data:`ao_integrals_cache_min` + * :c:data:`ao_two_e_integrals_in_map` Calls: .. hlist:: :columns: 3 - * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` -.. c:function:: ao_two_e_integral_schwartz_accel: +.. c:function:: get_ao_two_e_integral_erf: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - double precision function ao_two_e_integral_schwartz_accel(i,j,k,l) + double precision function get_ao_two_e_integral_erf(i,j,k,l,map) result(result) - integral of the AO basis or (ij|kl) - i(r1) j(r1) 1/r12 k(r2) l(r2) + Gets one |AO| two-electron integral from the |AO| map Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp` - * :c:data:`ao_expo_ordered_transp` + * :c:data:`ao_integrals_erf_cache` + * :c:data:`ao_integrals_erf_cache_min` * :c:data:`ao_integrals_threshold` - * :c:data:`ao_nucl` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` - * :c:data:`n_pt_max_integrals` - * :c:data:`nucl_coord` + * :c:data:`ao_two_e_integral_erf_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` Calls: .. hlist:: :columns: 3 - * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` -.. c:function:: ao_two_e_integral_zero: +.. c:function:: get_ao_two_e_integral_periodic: - File : :file:`ao_two_e_ints/screening.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - logical function ao_two_e_integral_zero(i,j,k,l) + complex*16 function get_ao_two_e_integral_periodic(i,j,k,l,map) result(result) + Gets one AO bi-electronic integral from the AO map Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_overlap_abs` - * :c:data:`ao_two_e_integral_schwartz` - * :c:data:`is_periodic` - * :c:data:`read_ao_two_e_integrals` + * :c:data:`ao_integrals_cache_min` + * :c:data:`ao_integrals_cache_periodic` + * :c:data:`ao_integrals_map` + * :c:data:`ao_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_get` + * :c:func:`two_e_integrals_index_2fold` -.. c:function:: ao_two_e_integrals_in_map_collector: +.. c:function:: get_ao_two_e_integrals: - File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine ao_two_e_integrals_in_map_collector(zmq_socket_pull) + subroutine get_ao_two_e_integrals(j,k,l,sze,out_val) - Collects results from the AO integral calculation + Gets multiple AO bi-electronic integral from the AO map . + All i are retrieved for j,k,l fixed. + physicist convention : Needs: @@ -736,120 +2661,130 @@ Subroutines / functions :columns: 3 * :c:data:`ao_integrals_map` - * :c:data:`ao_num` - - Called by: - - .. hlist:: - :columns: 3 - * :c:data:`ao_two_e_integrals_in_map` - Calls: + Called by: .. hlist:: :columns: 3 - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`insert_into_ao_integrals_map` + * :c:func:`add_integrals_to_map` + * :c:func:`four_idx_dgemm` -.. c:function:: ao_two_e_integrals_in_map_slave: +.. c:function:: get_ao_two_e_integrals_erf: - File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - subroutine ao_two_e_integrals_in_map_slave(thread,iproc) + subroutine get_ao_two_e_integrals_erf(j,k,l,sze,out_val) - Computes a buffer of integrals + Gets multiple |AO| two-electron integral from the |AO| map . + All i are retrieved for j,k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_two_e_integrals_erf_in_map` Called by: .. hlist:: :columns: 3 - * :c:func:`ao_two_e_integrals_in_map_slave_inproc` - * :c:func:`ao_two_e_integrals_in_map_slave_tcp` + * :c:func:`add_integrals_to_map_erf` + * :c:func:`four_idx_dgemm_erf` - Calls: + +.. c:function:: get_ao_two_e_integrals_erf_non_zero: - .. hlist:: - :columns: 3 - * :c:func:`compute_ao_integrals_jl` - * :c:func:`end_zmq_push_socket` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`push_integrals` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` - -.. c:function:: ao_two_e_integrals_in_map_slave_inproc: + .. code:: fortran + subroutine get_ao_two_e_integrals_erf_non_zero(j,k,l,sze,out_val,out_val_index,non_zero_int) - File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` - .. code:: fortran + Gets multiple |AO| two-electron integrals from the |AO| map . + All non-zero i are retrieved for j,k,l fixed. - subroutine ao_two_e_integrals_in_map_slave_inproc(i) + Needs: + .. hlist:: + :columns: 3 - Computes a buffer of integrals. i is the ID of the current thread. + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_two_e_integral_erf_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` Called by: .. hlist:: :columns: 3 - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`mo_two_e_int_erf_jj_from_ao` Calls: .. hlist:: :columns: 3 - * :c:func:`ao_two_e_integrals_in_map_slave` + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` -.. c:function:: ao_two_e_integrals_in_map_slave_tcp: +.. c:function:: get_ao_two_e_integrals_non_zero: - File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine ao_two_e_integrals_in_map_slave_tcp(i) + subroutine get_ao_two_e_integrals_non_zero(j,k,l,sze,out_val,out_val_index,non_zero_int) - Computes a buffer of integrals. i is the ID of the current thread. + Gets multiple AO bi-electronic integral from the AO map . + All non-zero i are retrieved for j,k,l fixed. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_map` + * :c:data:`ao_integrals_threshold` + * :c:data:`ao_two_e_integrals_in_map` Calls: .. hlist:: :columns: 3 - * :c:func:`ao_two_e_integrals_in_map_slave` + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` -.. c:function:: clear_ao_map: +.. c:function:: get_ao_two_e_integrals_non_zero_jl: File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine clear_ao_map + subroutine get_ao_two_e_integrals_non_zero_jl(j,l,thresh,sze_max,sze,out_val,out_val_index,non_zero_int) - Frees the memory of the AO map + Gets multiple AO bi-electronic integral from the AO map . + All non-zero i are retrieved for j,k,l fixed. Needs: @@ -857,247 +2792,261 @@ Subroutines / functions :columns: 3 * :c:data:`ao_integrals_map` + * :c:data:`ao_two_e_integrals_in_map` Calls: .. hlist:: :columns: 3 - * :c:func:`map_deinit` + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` -.. c:function:: compute_ao_integrals_jl: +.. c:function:: get_ao_two_e_integrals_non_zero_jl_from_list: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine compute_ao_integrals_jl(j,l,n_integrals,buffer_i,buffer_value) + subroutine get_ao_two_e_integrals_non_zero_jl_from_list(j,l,thresh,list,n_list,sze_max,out_val,out_val_index,non_zero_int) - Parallel client for AO integrals + Gets multiple AO two-electron integrals from the AO map . + All non-zero i are retrieved for j,k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_num` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`ao_two_e_integrals_in_map_slave` + * :c:data:`ao_integrals_map` + * :c:data:`ao_two_e_integrals_in_map` Calls: .. hlist:: :columns: 3 + * :c:func:`map_get` * :c:func:`two_e_integrals_index` -.. c:function:: compute_ao_two_e_integrals: +.. c:function:: get_ao_two_e_integrals_periodic: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine compute_ao_two_e_integrals(j,k,l,sze,buffer_value) + subroutine get_ao_two_e_integrals_periodic(j,k,l,sze,out_val) - Compute AO 1/r12 integrals for all i and fixed j,k,l + Gets multiple AO bi-electronic integral from the AO map . + All i are retrieved for j,k,l fixed. + physicist convention : Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_two_e_integral_jj_from_ao` - * :c:data:`mo_two_e_integrals_vv_from_ao` + * :c:data:`ao_integrals_map` + * :c:data:`ao_two_e_integrals_in_map` -.. c:function:: eri: +.. c:function:: give_polynom_mult_center_x: File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - double precision function ERI(alpha,beta,delta,gama,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) + subroutine give_polynom_mult_center_x(P_center,Q_center,a_x,d_x,p,q,n_pt_in,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,d,n_pt_out) - ATOMIC PRIMTIVE two-electron integral between the 4 primitives :: - primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) - primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) - primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) - primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) + subroutine that returns the explicit polynom in term of the "t" + variable of the following polynomw : + + $I_{x_1}(a_x,d_x,p,q) \, I_{x_1}(a_y,d_y,p,q) \ I_{x_1}(a_z,d_z,p,q)$ + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`general_primitive_integral` + * :c:func:`general_primitive_integral_erf` Calls: .. hlist:: :columns: 3 - * :c:func:`integrale_new` + * :c:func:`i_x1_pol_mult` -.. c:function:: gauleg: +.. c:function:: i_x1_pol_mult: - File : :file:`ao_two_e_ints/gauss_legendre.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - subroutine gauleg(x1,x2,x,w,n) + subroutine I_x1_pol_mult(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) - Gauss-Legendre + Recursive function involved in the two-electron integral Called by: .. hlist:: :columns: 3 - * :c:data:`gauleg_t2` + * :c:func:`give_polynom_mult_center_x` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_a1` + * :c:func:`i_x1_pol_mult_a2` + * :c:func:`i_x1_pol_mult_recurs` + * :c:func:`i_x2_pol_mult` -.. c:function:: get_ao_map_size: +.. c:function:: i_x1_pol_mult_cgtos: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` .. code:: fortran - function get_ao_map_size() + subroutine I_x1_pol_mult_cgtos(a, c, B_10, B_01, B_00, C_00, D_00, d, nd, n_pt_in) + + + Recursive function involved in the two-electron integral + Called by: + + .. hlist:: + :columns: 3 - Returns the number of elements in the AO map + * :c:func:`give_cpolynom_mult_center_x` - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` + * :c:func:`i_x1_pol_mult_a1_cgtos` + * :c:func:`i_x1_pol_mult_a2_cgtos` + * :c:func:`i_x1_pol_mult_recurs_cgtos` + * :c:func:`i_x2_pol_mult_cgtos` -.. c:function:: get_ao_two_e_integral: +.. c:function:: i_x1_pol_mult_cosgtos: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` .. code:: fortran - double precision function get_ao_two_e_integral(i,j,k,l,map) result(result) + subroutine I_x1_pol_mult_cosgtos(a, c, B_10, B_01, B_00, C_00, D_00, d, nd, n_pt_in) - Gets one AO bi-electronic integral from the AO map + Recursive function involved in the two-electron integral - Needs: + Called by: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_cache` - * :c:data:`ao_integrals_cache_min` - * :c:data:`ao_two_e_integrals_in_map` + * :c:func:`give_cpolynom_mult_center_x` Calls: .. hlist:: :columns: 3 - * :c:func:`map_get` - * :c:func:`two_e_integrals_index` + * :c:func:`i_x1_pol_mult_a1_cosgtos` + * :c:func:`i_x1_pol_mult_a2_cosgtos` + * :c:func:`i_x1_pol_mult_recurs_cosgtos` + * :c:func:`i_x2_pol_mult_cosgtos` -.. c:function:: get_ao_two_e_integral_periodic: +.. c:function:: idx2_tri_int: File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - complex*16 function get_ao_two_e_integral_periodic(i,j,k,l,map) result(result) + subroutine idx2_tri_int(i,j,ij) - Gets one AO bi-electronic integral from the AO map - Needs: + +.. c:function:: idx2_tri_rev_int: - .. hlist:: - :columns: 3 - * :c:data:`ao_integrals_cache_min` - * :c:data:`ao_integrals_cache_periodic` - * :c:data:`ao_integrals_map` - * :c:data:`ao_two_e_integrals_in_map` + File : :file:`ao_two_e_ints/map_integrals.irp.f` - Calls: + .. code:: fortran - .. hlist:: - :columns: 3 + subroutine idx2_tri_rev_int(i,k,ik) - * :c:func:`map_get` - * :c:func:`two_e_integrals_index_2fold` + + return i<=k -.. c:function:: get_ao_two_e_integrals: +.. c:function:: insert_into_ao_integrals_erf_map: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - subroutine get_ao_two_e_integrals(j,k,l,sze,out_val) + subroutine insert_into_ao_integrals_erf_map(n_integrals,buffer_i, buffer_values) - Gets multiple AO bi-electronic integral from the AO map . - All i are retrieved for j,k,l fixed. - physicist convention : + Create new entry into |AO| map Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`ao_integrals_erf_map` Called by: .. hlist:: :columns: 3 - * :c:func:`add_integrals_to_map` - * :c:func:`add_integrals_to_map_no_exit_34` - * :c:func:`add_integrals_to_map_three_indices` + * :c:func:`ao_two_e_integrals_erf_in_map_collector` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_append` -.. c:function:: get_ao_two_e_integrals_non_zero: +.. c:function:: insert_into_ao_integrals_map: File : :file:`ao_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine get_ao_two_e_integrals_non_zero(j,k,l,sze,out_val,out_val_index,non_zero_int) + subroutine insert_into_ao_integrals_map(n_integrals,buffer_i, buffer_values) - Gets multiple AO bi-electronic integral from the AO map . - All non-zero i are retrieved for j,k,l fixed. + Create new entry into AO map Needs: @@ -1105,300 +3054,328 @@ Subroutines / functions :columns: 3 * :c:data:`ao_integrals_map` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_two_e_integrals_in_map` Called by: .. hlist:: :columns: 3 - * :c:data:`mo_two_e_integral_jj_from_ao` - * :c:data:`mo_two_e_integrals_vv_from_ao` + * :c:func:`ao_two_e_integrals_in_map_collector` Calls: .. hlist:: :columns: 3 - * :c:func:`map_get` - * :c:func:`two_e_integrals_index` + * :c:func:`map_append` -.. c:function:: get_ao_two_e_integrals_non_zero_jl: +.. c:function:: integrale_new: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - subroutine get_ao_two_e_integrals_non_zero_jl(j,l,thresh,sze_max,sze,out_val,out_val_index,non_zero_int) + subroutine integrale_new(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) - Gets multiple AO bi-electronic integral from the AO map . - All non-zero i are retrieved for j,k,l fixed. + Calculates the integral of the polynomial : + + $I_{x_1}(a_x+b_x,c_x+d_x,p,q) \, I_{x_1}(a_y+b_y,c_y+d_y,p,q) \, I_{x_1}(a_z+b_z,c_z+d_z,p,q)$ + in $( 0 ; 1)$ Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`gauleg_t2` + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`eri` Calls: .. hlist:: :columns: 3 - * :c:func:`map_get` - * :c:func:`two_e_integrals_index` + * :c:func:`i_x1_new` -.. c:function:: get_ao_two_e_integrals_non_zero_jl_from_list: +.. c:function:: integrale_new_cgtos: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_coul_integrals_cgtos.irp.f` .. code:: fortran - subroutine get_ao_two_e_integrals_non_zero_jl_from_list(j,l,thresh,list,n_list,sze_max,out_val,out_val_index,non_zero_int) + subroutine integrale_new_cgtos(I_f, a_x, b_x, c_x, d_x, a_y, b_y, c_y, d_y, a_z, b_z, c_z, d_z, p, q, n_pt) - Gets multiple AO two-electron integrals from the AO map . - All non-zero i are retrieved for j,k,l fixed. + Calculates the integral of the polynomial : + + $I_{x_1}(a_x+b_x, c_x+d_x, p, q) \, I_{x_1}(a_y+b_y, c_y+d_y, p, q) \, I_{x_1}(a_z+b_z, c_z+d_z, p, q)$ + in $( 0 ; 1)$ Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`gauleg_t2` + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`eri_cgtos` Calls: .. hlist:: :columns: 3 - * :c:func:`map_get` - * :c:func:`two_e_integrals_index` + * :c:func:`i_x1_new_cgtos` -.. c:function:: get_ao_two_e_integrals_periodic: +.. c:function:: integrale_new_cosgtos: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_Coul_integrals_cosgtos.irp.f` .. code:: fortran - subroutine get_ao_two_e_integrals_periodic(j,k,l,sze,out_val) + subroutine integrale_new_cosgtos(I_f, a_x, b_x, c_x, d_x, a_y, b_y, c_y, d_y, a_z, b_z, c_z, d_z, p, q, n_pt) - Gets multiple AO bi-electronic integral from the AO map . - All i are retrieved for j,k,l fixed. - physicist convention : + Calculates the integral of the polynomial : + + $I_{x_1}(a_x+b_x, c_x+d_x, p, q) \, I_{x_1}(a_y+b_y, c_y+d_y, p, q) \, I_{x_1}(a_z+b_z, c_z+d_z, p, q)$ + in $( 0 ; 1)$ Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`gauleg_t2` + * :c:data:`n_pt_max_integrals` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`eri_cosgtos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_new_cosgtos` -.. c:function:: give_polynom_mult_center_x: +.. c:function:: integrale_new_erf: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals_erf.irp.f` .. code:: fortran - subroutine give_polynom_mult_center_x(P_center,Q_center,a_x,d_x,p,q,n_pt_in,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,d,n_pt_out) + subroutine integrale_new_erf(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) - subroutine that returns the explicit polynom in term of the "t" - variable of the following polynomw : + Calculate the integral of the polynomial : - $I_{x_1}(a_x,d_x,p,q) \, I_{x_1}(a_y,d_y,p,q) \ I_{x_1}(a_z,d_z,p,q)$ + $I_x1(a_x+b_x, c_x+d_x,p,q) \, I_x1(a_y+b_y, c_y+d_y,p,q) \, I_x1(a_z+b_z, c_z+d_z,p,q)$ + + between $( 0 ; 1)$ + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`gauleg_t2` + * :c:data:`mu_erf` + * :c:data:`n_pt_max_integrals` Called by: .. hlist:: :columns: 3 - * :c:func:`general_primitive_integral` + * :c:func:`eri_erf` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult` + * :c:func:`i_x1_new` -.. c:function:: i_x1_pol_mult: +.. c:function:: load_ao_integrals_erf: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - subroutine I_x1_pol_mult(a,c,B_10,B_01,B_00,C_00,D_00,d,nd,n_pt_in) + integer function load_ao_integrals_erf(filename) - Recursive function involved in the two-electron integral + Read from disk the |AO| erf integrals - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`give_polynom_mult_center_x` + * :c:data:`ao_integrals_erf_map` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_pol_mult_a1` - * :c:func:`i_x1_pol_mult_a2` - * :c:func:`i_x1_pol_mult_recurs` - * :c:func:`i_x2_pol_mult` + * :c:func:`cache_map_reallocate` + * :c:func:`map_deinit` + * :c:func:`map_sort` -.. c:function:: idx2_tri_int: +.. c:function:: multiply_poly_c2_inline_2e: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - subroutine idx2_tri_int(i,j,ij) + subroutine multiply_poly_c2_inline_2e(b,nb,c,d,nd) + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) -.. c:function:: idx2_tri_rev_int: +.. c:function:: multiply_poly_local: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - subroutine idx2_tri_rev_int(i,k,ik) + subroutine multiply_poly_local(b,nb,c,nc,d,nd) - return i<=k + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) -.. c:function:: insert_into_ao_integrals_map: +.. c:function:: n_pt_sup: - File : :file:`ao_two_e_ints/map_integrals.irp.f` + File : :file:`ao_two_e_ints/two_e_integrals.irp.f` .. code:: fortran - subroutine insert_into_ao_integrals_map(n_integrals,buffer_i, buffer_values) + integer function n_pt_sup(a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) - Create new entry into AO map + Returns the upper boundary of the degree of the polynomial involved in the + two-electron integral : + + $I_x(a_x,b_x,c_x,d_x) \, I_y(a_y,b_y,c_y,d_y) \, I_z(a_z,b_z,c_z,d_z)$ - Needs: + +.. c:function:: push_integrals: - .. hlist:: - :columns: 3 - * :c:data:`ao_integrals_map` + File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` - Called by: + .. code:: fortran - .. hlist:: - :columns: 3 + subroutine push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id) - * :c:func:`ao_two_e_integrals_in_map_collector` - Calls: + Push integrals in the push socket + + Called by: .. hlist:: :columns: 3 - * :c:func:`map_append` + * :c:func:`ao_two_e_integrals_erf_in_map_slave` + * :c:func:`ao_two_e_integrals_in_map_slave` -.. c:function:: integrale_new: +.. c:function:: save_erf_two_e_integrals_ao: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/routines_save_integrals_erf.irp.f` .. code:: fortran - subroutine integrale_new(I_f,a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z,p,q,n_pt) + subroutine save_erf_two_e_integrals_ao - Calculates the integral of the polynomial : - - $I_{x_1}(a_x+b_x,c_x+d_x,p,q) \, I_{x_1}(a_y+b_y,c_y+d_y,p,q) \, I_{x_1}(a_z+b_z,c_z+d_z,p,q)$ - in $( 0 ; 1)$ Needs: .. hlist:: :columns: 3 - * :c:data:`gauleg_t2` - * :c:data:`n_pt_max_integrals` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`eri` + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_two_e_integrals_erf_in_map` + * :c:data:`ezfio_filename` Calls: .. hlist:: :columns: 3 - * :c:func:`i_x1_new` + * :c:func:`ezfio_set_ao_two_e_ints_io_ao_two_e_integrals_erf` + * :c:func:`ezfio_set_work_empty` + * :c:func:`map_save_to_disk` -.. c:function:: n_pt_sup: +.. c:function:: save_erf_two_e_ints_ao_into_ints_ao: - File : :file:`ao_two_e_ints/two_e_integrals.irp.f` + File : :file:`ao_two_e_ints/routines_save_integrals_erf.irp.f` .. code:: fortran - integer function n_pt_sup(a_x,b_x,c_x,d_x,a_y,b_y,c_y,d_y,a_z,b_z,c_z,d_z) - - - Returns the upper boundary of the degree of the polynomial involved in the - two-electron integral : - - $I_x(a_x,b_x,c_x,d_x) \, I_y(a_y,b_y,c_y,d_y) \, I_z(a_z,b_z,c_z,d_z)$ - - -.. c:function:: push_integrals: + subroutine save_erf_two_e_ints_ao_into_ints_ao - File : :file:`ao_two_e_ints/integrals_in_map_slave.irp.f` - - .. code:: fortran - subroutine push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id) + Needs: + .. hlist:: + :columns: 3 - Push integrals in the push socket + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_two_e_integrals_erf_in_map` + * :c:data:`ezfio_filename` - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`ao_two_e_integrals_in_map_slave` + * :c:func:`ezfio_set_ao_two_e_ints_io_ao_two_e_integrals` + * :c:func:`ezfio_set_work_empty` + * :c:func:`map_save_to_disk` .. c:function:: two_e_integrals_index: @@ -1420,16 +3397,27 @@ Subroutines / functions :columns: 3 * :c:data:`ao_integrals_cache` + * :c:data:`ao_integrals_erf_cache` + * :c:data:`ao_integrals_erf_map` * :c:data:`ao_integrals_map` - * :c:data:`banned_excitation` + * :c:func:`compute_ao_integrals_erf_jl` * :c:func:`compute_ao_integrals_jl` - * :c:func:`four_idx_novvvv` * :c:func:`get_ao_two_e_integral` + * :c:func:`get_ao_two_e_integral_erf` + * :c:func:`get_ao_two_e_integrals_erf_non_zero` * :c:func:`get_ao_two_e_integrals_non_zero` * :c:func:`get_ao_two_e_integrals_non_zero_jl` * :c:func:`get_ao_two_e_integrals_non_zero_jl_from_list` + * :c:func:`get_mo_two_e_integral_erf` + * :c:func:`get_mo_two_e_integrals_erf` + * :c:func:`get_mo_two_e_integrals_erf_coulomb_ii` + * :c:func:`get_mo_two_e_integrals_erf_exch_ii` + * :c:func:`get_mo_two_e_integrals_erf_i1j1` + * :c:func:`get_mo_two_e_integrals_erf_ij` * :c:func:`get_two_e_integral` * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_integrals_map` @@ -1481,6 +3469,13 @@ Subroutines / functions This rule is applied 3 times. First for the symmetry of the pairs (i,k) and (j,l), and then for the symmetry within each pair. + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha` + .. c:function:: two_e_integrals_index_reverse_2fold: diff --git a/docs/source/modules/becke_numerical_grid.rst b/docs/source/modules/becke_numerical_grid.rst index 27a95877..8ab7b867 100644 --- a/docs/source/modules/becke_numerical_grid.rst +++ b/docs/source/modules/becke_numerical_grid.rst @@ -366,6 +366,7 @@ Providers * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`average_on_top` * :c:data:`elec_beta_num_grid_becke` * :c:data:`energy_c_lda` * :c:data:`energy_c_sr_lda` @@ -424,6 +425,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`aos_grad_in_r_array_extra` * :c:data:`aos_in_r_array_extra` @@ -607,6 +609,7 @@ Providers * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`average_on_top` * :c:data:`elec_beta_num_grid_becke` * :c:data:`energy_c_lda` * :c:data:`energy_c_sr_lda` @@ -665,6 +668,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`aos_grad_in_r_array_extra` * :c:data:`aos_in_r_array_extra` @@ -914,6 +918,7 @@ Providers * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`average_on_top` * :c:data:`elec_beta_num_grid_becke` * :c:data:`energy_c_lda` * :c:data:`energy_c_sr_lda` @@ -972,6 +977,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`aos_grad_in_r_array_extra` * :c:data:`aos_in_r_array_extra` @@ -1013,6 +1019,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`aos_grad_in_r_array_extra` * :c:data:`aos_in_r_array_extra` @@ -1126,6 +1133,7 @@ Providers * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`average_on_top` * :c:data:`elec_beta_num_grid_becke` * :c:data:`energy_c_lda` * :c:data:`energy_c_sr_lda` @@ -1196,6 +1204,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`aos_grad_in_r_array_extra` * :c:data:`aos_in_r_array_extra` * :c:data:`aos_in_r_array_extra_transp` * :c:data:`final_grid_points_extra` @@ -1356,6 +1365,7 @@ Providers * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`average_on_top` * :c:data:`basis_mos_in_r_array` * :c:data:`core_density` * :c:data:`core_inact_act_mos_grad_in_r_array` @@ -1371,6 +1381,9 @@ Providers * :c:data:`energy_x_pbe` * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` + * :c:data:`f_hf_cholesky` + * :c:data:`f_hf_cholesky_sparse` + * :c:data:`f_hf_cholesky_sparse_bis` * :c:data:`f_psi_cas_ab` * :c:data:`f_psi_cas_ab_old` * :c:data:`f_psi_hf_ab` @@ -1393,14 +1406,19 @@ Providers * :c:data:`mos_in_r_array_transp` * :c:data:`mos_lapl_in_r_array` * :c:data:`mos_lapl_in_r_array_tranp` + * :c:data:`mos_times_cholesky_r1` + * :c:data:`mos_times_cholesky_r2` * :c:data:`mu_average_prov` * :c:data:`mu_grad_rho` * :c:data:`mu_of_r_dft` * :c:data:`mu_of_r_dft_average` * :c:data:`mu_of_r_hf` + * :c:data:`mu_of_r_hf_old` + * :c:data:`mu_of_r_hf_sparse` * :c:data:`mu_of_r_prov` * :c:data:`mu_of_r_psi_cas` * :c:data:`mu_rsc_of_r` + * :c:data:`on_top_hf_grid` * :c:data:`one_e_act_density_alpha` * :c:data:`one_e_act_density_beta` * :c:data:`one_e_cas_total_density` diff --git a/docs/source/modules/bitmask.rst b/docs/source/modules/bitmask.rst index f07d5dd9..494a4be6 100644 --- a/docs/source/modules/bitmask.rst +++ b/docs/source/modules/bitmask.rst @@ -35,6 +35,42 @@ For an example of how to use the bitmaks, see the file :file:`example.irp.f`. +EZFIO parameters +---------------- + +.. option:: n_act_orb + + Number of active |MOs| + + +.. option:: do_ormas + + if |true| restrict selection based on ORMAS rules + + Default: false + +.. option:: ormas_n_space + + Number of active spaces + + Default: 1 + +.. option:: ormas_mstart + + starting orb for each ORMAS space + + +.. option:: ormas_min_e + + min number of electrons in each ORMAS space + + +.. option:: ormas_max_e + + max number of electrons in each ORMAS space + + + Providers --------- @@ -45,103 +81,18 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - - - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` - * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` - - -.. c:var:: cas_bitmask - - - File : :file:`bitmask/bitmasks.irp.f` - .. code:: fortran - - integer(bit_kind), allocatable :: cas_bitmask (N_int,2,N_cas_bitmask) - - Bitmasks for CAS reference determinants. (N_int, alpha/beta, CAS reference) + Bitmask identifying the active MOs Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` - * :c:data:`full_ijkl_bitmask` - * :c:data:`generators_bitmask_restart` - * :c:data:`hf_bitmask` - * :c:data:`mpi_master` - * :c:data:`n_cas_bitmask` - * :c:data:`n_generators_bitmask` + * :c:data:`list_act` + * :c:data:`n_act_orb` * :c:data:`n_int` Needed by: @@ -150,8 +101,13 @@ Providers :columns: 3 * :c:data:`closed_shell_ref_bitmask` + * :c:data:`n_det_generators` * :c:data:`psi_cas` + * :c:data:`psi_det_generators` + * :c:data:`reunion_of_act_virt_bitmask` * :c:data:`reunion_of_bitmask` + * :c:data:`reunion_of_core_inact_act_bitmask` + * :c:data:`reunion_of_inact_act_bitmask` .. c:var:: closed_shell_ref_bitmask @@ -170,7 +126,7 @@ Providers .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` + * :c:data:`act_bitmask` * :c:data:`n_int` * :c:data:`ref_bitmask` @@ -183,53 +139,17 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + Bitmask identifying the core MOs Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` - * :c:data:`mo_num` + * :c:data:`list_core` * :c:data:`n_core_orb` * :c:data:`n_int` @@ -238,22 +158,8 @@ Providers .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` .. c:var:: core_inact_act_bitmask_4 @@ -275,12 +181,6 @@ Providers * :c:data:`n_int` * :c:data:`reunion_of_core_inact_act_bitmask` - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_two_e_integrals_in_map` .. c:var:: core_inact_virt_bitmask @@ -301,8 +201,10 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`core_bitmask` + * :c:data:`inact_bitmask` * :c:data:`n_int` + * :c:data:`virt_bitmask` @@ -313,94 +215,61 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + Bitmask identifying the deleted MOs Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` - * :c:data:`mo_num` - * :c:data:`n_core_orb` + * :c:data:`list_del` + * :c:data:`n_del_orb` * :c:data:`n_int` + + +.. c:var:: dim_list_act_orb + + + File : :file:`bitmask/core_inact_act_virt.irp.f` + + .. code:: fortran + + integer :: dim_list_act_orb + + + dimensions for the allocation of list_act. + it is at least 1 + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_act_orb` + Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`list_act` -.. c:var:: dim_list_act_orb +.. c:var:: dim_list_core_inact_orb File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: dim_list_core_orb - integer :: dim_list_inact_orb - integer :: dim_list_virt_orb - integer :: dim_list_act_orb - integer :: dim_list_del_orb + integer :: dim_list_core_inact_orb - dimensions for the allocation of list_inact, list_virt, list_core and list_act + dimensions for the allocation of list_core. it is at least 1 Needs: @@ -408,14 +277,14 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`n_core_inact_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`list_core_inact` .. c:var:: dim_list_core_orb @@ -426,13 +295,9 @@ Providers .. code:: fortran integer :: dim_list_core_orb - integer :: dim_list_inact_orb - integer :: dim_list_virt_orb - integer :: dim_list_act_orb - integer :: dim_list_del_orb - dimensions for the allocation of list_inact, list_virt, list_core and list_act + dimensions for the allocation of list_core. it is at least 1 Needs: @@ -447,7 +312,7 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`list_core` .. c:var:: dim_list_del_orb @@ -457,14 +322,10 @@ Providers .. code:: fortran - integer :: dim_list_core_orb - integer :: dim_list_inact_orb - integer :: dim_list_virt_orb - integer :: dim_list_act_orb integer :: dim_list_del_orb - dimensions for the allocation of list_inact, list_virt, list_core and list_act + dimensions for the allocation of list_del. it is at least 1 Needs: @@ -472,14 +333,14 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`n_del_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`list_del` .. c:var:: dim_list_inact_orb @@ -489,14 +350,10 @@ Providers .. code:: fortran - integer :: dim_list_core_orb integer :: dim_list_inact_orb - integer :: dim_list_virt_orb - integer :: dim_list_act_orb - integer :: dim_list_del_orb - dimensions for the allocation of list_inact, list_virt, list_core and list_act + dimensions for the allocation of list_inact. it is at least 1 Needs: @@ -504,7 +361,7 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`n_inact_orb` Needed by: @@ -521,14 +378,10 @@ Providers .. code:: fortran - integer :: dim_list_core_orb - integer :: dim_list_inact_orb integer :: dim_list_virt_orb - integer :: dim_list_act_orb - integer :: dim_list_del_orb - dimensions for the allocation of list_inact, list_virt, list_core and list_act + dimensions for the allocation of list_virt. it is at least 1 Needs: @@ -536,14 +389,14 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`n_virt_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`list_virt` .. c:var:: full_ijkl_bitmask @@ -563,7 +416,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mo_class` * :c:data:`mo_num` * :c:data:`n_int` @@ -572,12 +424,10 @@ Providers .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` * :c:data:`fock_operator_closed_shell_ref_bitmask` * :c:data:`fock_wee_closed_shell` * :c:data:`full_ijkl_bitmask_4` * :c:data:`generators_bitmask` - * :c:data:`generators_bitmask_restart` .. c:var:: full_ijkl_bitmask_4 @@ -615,7 +465,7 @@ Providers .. code:: fortran - integer(bit_kind), allocatable :: generators_bitmask (N_int,2,6,N_generators_bitmask) + integer(bit_kind), allocatable :: generators_bitmask (N_int,2,6) Bitmasks for generator determinants. @@ -643,50 +493,31 @@ Providers * :c:data:`ezfio_filename` * :c:data:`full_ijkl_bitmask` - * :c:data:`mpi_master` - * :c:data:`n_generators_bitmask` * :c:data:`n_int` + * :c:data:`reunion_of_act_virt_bitmask` + * :c:data:`reunion_of_inact_act_bitmask` -.. c:var:: generators_bitmask_restart +.. c:var:: hf_bitmask File : :file:`bitmask/bitmasks.irp.f` .. code:: fortran - integer(bit_kind), allocatable :: generators_bitmask_restart (N_int,2,6,N_generators_bitmask_restart) + integer(bit_kind), allocatable :: hf_bitmask (N_int,2) - Bitmasks for generator determinants. - (N_int, alpha/beta, hole/particle, generator). - - 3rd index is : - - * 1 : hole for single exc - - * 2 : particle for single exc - - * 3 : hole for 1st exc of double - - * 4 : particle for 1st exc of double - - * 5 : hole for 2nd exc of double - - * 6 : particle for 2nd exc of double - + Hartree Fock bit mask Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` - * :c:data:`full_ijkl_bitmask` - * :c:data:`mpi_master` - * :c:data:`n_generators_bitmask` - * :c:data:`n_generators_bitmask_restart` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` * :c:data:`n_int` Needed by: @@ -694,28 +525,34 @@ Providers .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` + * :c:data:`double_exc_bitmask` + * :c:data:`max_degree_exc` + * :c:data:`psi_cas` + * :c:data:`psi_det` + * :c:data:`ref_bitmask` + * :c:data:`single_exc_bitmask` + * :c:data:`unpaired_alpha_electrons` -.. c:var:: hf_bitmask +.. c:var:: inact_bitmask - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer(bit_kind), allocatable :: hf_bitmask (N_int,2) + integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - Hartree Fock bit mask + Bitmask identifying the inactive MOs Needs: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` + * :c:data:`list_inact` + * :c:data:`n_inact_orb` * :c:data:`n_int` Needed by: @@ -723,112 +560,13 @@ Providers .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`degree_max_generators` - * :c:data:`double_exc_bitmask` - * :c:data:`max_degree_exc` - * :c:data:`psi_cas` - * :c:data:`psi_det` - * :c:data:`ref_bitmask` - * :c:data:`single_exc_bitmask` - * :c:data:`unpaired_alpha_electrons` + * :c:data:`inact_virt_bitmask` + * :c:data:`reunion_of_bitmask` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`reunion_of_inact_act_bitmask` -.. c:var:: i_bitmask_gen - - - File : :file:`bitmask/bitmasks.irp.f` - - .. code:: fortran - - integer :: i_bitmask_gen - - - Current bitmask for the generators - - - -.. c:var:: inact_bitmask - - - File : :file:`bitmask/core_inact_act_virt.irp.f` - - .. code:: fortran - - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - - - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` - * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` - - -.. c:var:: inact_virt_bitmask +.. c:var:: inact_virt_bitmask File : :file:`bitmask/bitmasks.irp.f` @@ -846,8 +584,10 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`core_bitmask` + * :c:data:`inact_bitmask` * :c:data:`n_int` + * :c:data:`virt_bitmask` @@ -886,77 +626,74 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) integer, allocatable :: list_act (dim_list_act_orb) integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are in the active. Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_act_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` + * :c:data:`n_act_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` + * :c:data:`act_bitmask` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`bielecci` + * :c:data:`bielecci_no` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_2_idx_transp` + * :c:data:`cholesky_no_total_transp` * :c:data:`core_fock_operator` * :c:data:`core_fock_operator_erf` + * :c:data:`d0tu` + * :c:data:`d0tu_alpha_ao` * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`etwo` + * :c:data:`excit` + * :c:data:`fapq` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`natorbsci_mos` + * :c:data:`occnum` + * :c:data:`one_ints_no` + * :c:data:`p0tuvx_peter` + * :c:data:`state_av_act_2_rdm_aa_mo` + * :c:data:`state_av_act_2_rdm_ab_mo` + * :c:data:`state_av_act_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` + * :c:data:`super_ci_dm` + * :c:data:`umat` .. c:var:: list_act_reverse @@ -966,77 +703,96 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) integer, allocatable :: list_act (dim_list_act_orb) integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are in the active. Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_act_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` + * :c:data:`n_act_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` + * :c:data:`act_bitmask` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`bielecci` + * :c:data:`bielecci_no` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_2_idx_transp` + * :c:data:`cholesky_no_total_transp` * :c:data:`core_fock_operator` * :c:data:`core_fock_operator_erf` + * :c:data:`d0tu` + * :c:data:`d0tu_alpha_ao` * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`etwo` + * :c:data:`excit` + * :c:data:`fapq` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`natorbsci_mos` + * :c:data:`occnum` + * :c:data:`one_ints_no` + * :c:data:`p0tuvx_peter` + * :c:data:`state_av_act_2_rdm_aa_mo` + * :c:data:`state_av_act_2_rdm_ab_mo` + * :c:data:`state_av_act_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` + * :c:data:`super_ci_dm` + * :c:data:`umat` + + +.. c:var:: list_all_but_del_orb + + + File : :file:`bitmask/core_inact_act_virt.irp.f` + + .. code:: fortran + + integer, allocatable :: list_all_but_del_orb (n_all_but_del_orb) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_class` + * :c:data:`mo_num` + * :c:data:`n_all_but_del_orb` + .. c:var:: list_core @@ -1046,44 +802,11 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) integer, allocatable :: list_core (dim_list_core_orb) integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are in the core. Needs: @@ -1094,29 +817,78 @@ Providers * :c:data:`mo_class` * :c:data:`mo_num` * :c:data:`n_core_orb` - * :c:data:`n_int` Needed by: .. hlist:: :columns: 3 + * :c:data:`core_bitmask` * :c:data:`core_energy` * :c:data:`core_energy_erf` * :c:data:`core_fock_operator` * :c:data:`core_fock_operator_erf` * :c:data:`eigenvectors_fock_matrix_mo` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`one_e_dm_mo_alpha_for_dft` + * :c:data:`one_e_dm_mo_alpha_for_dft_no_core` + * :c:data:`one_e_dm_mo_beta_for_dft` + * :c:data:`one_e_dm_mo_beta_for_dft_no_core` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` + + +.. c:var:: list_core_inact + + + File : :file:`bitmask/core_inact_act_virt.irp.f` + + .. code:: fortran + + integer, allocatable :: list_core_inact (dim_list_core_inact_orb) + integer, allocatable :: list_core_inact_reverse (mo_num) + + + List of indices of the core and inactive MOs + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`dim_list_core_inact_orb` + * :c:data:`mo_num` + * :c:data:`n_core_inact_orb` + * :c:data:`n_int` * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`cholesky_no_total_transp` + * :c:data:`d0tu_alpha_ao` + * :c:data:`etwo` + * :c:data:`excit` + * :c:data:`fipq` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`occnum` + * :c:data:`super_ci_dm` + * :c:data:`umat` .. c:var:: list_core_inact_act @@ -1127,21 +899,30 @@ Providers .. code:: fortran integer, allocatable :: list_core_inact_act (n_core_inact_act_orb) - integer, allocatable :: list_core_inact_act_reverse (n_core_inact_act_orb) + integer, allocatable :: list_core_inact_act_reverse (mo_num) + List of indices of the core inactive and active MOs Needs: .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`mo_num` * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb` * :c:data:`n_int` * :c:data:`reunion_of_core_inact_act_bitmask` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`etwo` + * :c:data:`fapq` + * :c:data:`fipq` + * :c:data:`two_e_dm_mo` .. c:var:: list_core_inact_act_reverse @@ -1152,148 +933,91 @@ Providers .. code:: fortran integer, allocatable :: list_core_inact_act (n_core_inact_act_orb) - integer, allocatable :: list_core_inact_act_reverse (n_core_inact_act_orb) + integer, allocatable :: list_core_inact_act_reverse (mo_num) + List of indices of the core inactive and active MOs Needs: .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`mo_num` * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb` * :c:data:`n_int` * :c:data:`reunion_of_core_inact_act_bitmask` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`etwo` + * :c:data:`fapq` + * :c:data:`fipq` + * :c:data:`two_e_dm_mo` -.. c:var:: list_core_reverse +.. c:var:: list_core_inact_reverse File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) + integer, allocatable :: list_core_inact (dim_list_core_inact_orb) + integer, allocatable :: list_core_inact_reverse (mo_num) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of indices of the core and inactive MOs Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` + * :c:data:`dim_list_core_inact_orb` * :c:data:`mo_num` - * :c:data:`n_core_orb` + * :c:data:`n_core_inact_orb` * :c:data:`n_int` + * :c:data:`reunion_of_core_inact_bitmask` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`cholesky_no_total_transp` + * :c:data:`d0tu_alpha_ao` + * :c:data:`etwo` + * :c:data:`excit` + * :c:data:`fipq` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`occnum` + * :c:data:`super_ci_dm` + * :c:data:`umat` -.. c:var:: list_del +.. c:var:: list_core_reverse File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) integer, allocatable :: list_core (dim_list_core_orb) integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are in the core. Needs: @@ -1304,29 +1028,62 @@ Providers * :c:data:`mo_class` * :c:data:`mo_num` * :c:data:`n_core_orb` - * :c:data:`n_int` Needed by: .. hlist:: :columns: 3 + * :c:data:`core_bitmask` * :c:data:`core_energy` * :c:data:`core_energy_erf` * :c:data:`core_fock_operator` * :c:data:`core_fock_operator_erf` * :c:data:`eigenvectors_fock_matrix_mo` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`one_e_dm_mo_alpha_for_dft` + * :c:data:`one_e_dm_mo_alpha_for_dft_no_core` + * :c:data:`one_e_dm_mo_beta_for_dft` + * :c:data:`one_e_dm_mo_beta_for_dft_no_core` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` + + +.. c:var:: list_del + + + File : :file:`bitmask/core_inact_act_virt.irp.f` + + .. code:: fortran + + integer, allocatable :: list_del (dim_list_del_orb) + integer, allocatable :: list_del_reverse (mo_num) + + + List of MO indices which are deleted. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`dim_list_del_orb` + * :c:data:`mo_class` + * :c:data:`mo_num` + * :c:data:`n_del_orb` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`del_bitmask` .. c:var:: list_del_reverse @@ -1336,77 +1093,28 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) + integer, allocatable :: list_del (dim_list_del_orb) integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are deleted. Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_del_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` + * :c:data:`n_del_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`del_bitmask` .. c:var:: list_inact @@ -1417,76 +1125,37 @@ Providers .. code:: fortran integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are inactive. Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_inact_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` + * :c:data:`n_inact_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` * :c:data:`eigenvectors_fock_matrix_mo` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`inact_bitmask` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` .. c:var:: list_inact_act @@ -1497,101 +1166,49 @@ Providers .. code:: fortran integer, allocatable :: list_inact_act (n_inact_act_orb) + integer, allocatable :: list_inact_act_reverse (mo_num) + List of indices of the inactive and active MOs Needs: .. hlist:: :columns: 3 - * :c:data:`list_inact` - * :c:data:`n_core_orb` + * :c:data:`mo_num` * :c:data:`n_inact_act_orb` + * :c:data:`n_int` + * :c:data:`reunion_of_inact_act_bitmask` -.. c:var:: list_inact_reverse +.. c:var:: list_inact_act_reverse File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) + integer, allocatable :: list_inact_act (n_inact_act_orb) + integer, allocatable :: list_inact_act_reverse (mo_num) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of indices of the inactive and active MOs Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` + * :c:data:`n_inact_act_orb` * :c:data:`n_int` + * :c:data:`reunion_of_inact_act_bitmask` - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` -.. c:var:: list_virt +.. c:var:: list_inact_reverse File : :file:`bitmask/core_inact_act_virt.irp.f` @@ -1599,353 +1216,259 @@ Providers .. code:: fortran integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are inactive. Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_inact_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` + * :c:data:`n_inact_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` * :c:data:`eigenvectors_fock_matrix_mo` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`inact_bitmask` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` -.. c:var:: list_virt_reverse +.. c:var:: list_virt File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) - integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are virtual Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_virt_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`n_core_orb` - * :c:data:`n_int` + * :c:data:`n_virt_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` + * :c:data:`cholesky_no_total_transp` * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`excit` * :c:data:`fock_matrix_mo` - * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`virt_bitmask_4` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`super_ci_dm` + * :c:data:`umat` + * :c:data:`virt_bitmask` -.. c:var:: mpi_bit_kind - - - File : :file:`bitmask/mpi.irp.f` - - .. code:: fortran - - integer :: mpi_bit_kind - - - MPI bit kind type - - - -.. c:var:: n_act_orb +.. c:var:: list_virt_reverse File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_core_orb - integer :: n_inact_orb - integer :: n_act_orb - integer :: n_virt_orb - integer :: n_del_orb + integer, allocatable :: list_virt (dim_list_virt_orb) + integer, allocatable :: list_virt_reverse (mo_num) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + List of MO indices which are virtual Needs: .. hlist:: :columns: 3 + * :c:data:`dim_list_virt_orb` * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`mpi_master` + * :c:data:`n_virt_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`dim_list_core_orb` + * :c:data:`cholesky_no_total_transp` * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`excit` * :c:data:`fock_matrix_mo` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb_allocate` - * :c:data:`n_inact_act_orb` - * :c:data:`n_inact_orb_allocate` - * :c:data:`n_virt_orb_allocate` - * :c:data:`pt2_f` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`super_ci_dm` + * :c:data:`umat` + * :c:data:`virt_bitmask` -.. c:var:: n_cas_bitmask +.. c:var:: mo_coef_begin_iteration - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/track_orb.irp.f` .. code:: fortran - integer :: n_cas_bitmask + double precision, allocatable :: mo_coef_begin_iteration (ao_num,mo_num) - Number of bitmasks for CAS + Void provider to store the coefficients of the |MO| basis at the beginning of the SCF iteration + + Useful to track some orbitals Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` - * :c:data:`mpi_master` - * :c:data:`n_int` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`ao_num` + * :c:data:`mo_num` - * :c:data:`cas_bitmask` - * :c:data:`psi_cas` -.. c:var:: n_core_inact_act_orb +.. c:var:: mpi_bit_kind - File : :file:`bitmask/core_inact_act_virt.irp.f` + File : :file:`bitmask/mpi.irp.f` .. code:: fortran - integer :: n_core_inact_act_orb - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_core_orb` + integer :: mpi_bit_kind - Needed by: - .. hlist:: - :columns: 3 + MPI bit kind type - * :c:data:`list_core_inact_act` -.. c:var:: n_core_inact_orb +.. c:var:: n_act_orb - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_core_inact_orb + integer :: n_act_orb + Number of active MOs Needs: .. hlist:: :columns: 3 - * :c:data:`n_int` - * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`mo_class` + * :c:data:`mo_num` + * :c:data:`mpi_master` + Needed by: - -.. c:var:: n_core_orb + .. hlist:: + :columns: 3 + + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` + * :c:data:`act_bitmask` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`bielecci` + * :c:data:`bielecci_no` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_2_idx_transp` + * :c:data:`cholesky_no_total_transp` + * :c:data:`core_fock_operator` + * :c:data:`core_fock_operator_erf` + * :c:data:`d0tu` + * :c:data:`d0tu_alpha_ao` + * :c:data:`dim_list_act_orb` + * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`etwo` + * :c:data:`excit` + * :c:data:`fapq` + * :c:data:`fock_matrix_mo` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`list_act` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`n_c_a_prov` + * :c:data:`n_core_inact_act_orb` + * :c:data:`n_inact_act_orb` + * :c:data:`natorbsci` + * :c:data:`natorbsci_mos` + * :c:data:`nmonoex` + * :c:data:`nsomomax` + * :c:data:`occnum` + * :c:data:`one_ints_no` + * :c:data:`p0tuvx` + * :c:data:`p0tuvx_no` + * :c:data:`p0tuvx_peter` + * :c:data:`state_av_act_2_rdm_aa_mo` + * :c:data:`state_av_act_2_rdm_ab_mo` + * :c:data:`state_av_act_2_rdm_bb_mo` + * :c:data:`state_av_act_2_rdm_spin_trace_mo` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` + * :c:data:`super_ci_dm` + * :c:data:`umat` + + +.. c:var:: n_all_but_del_orb File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_core_orb - integer :: n_inact_orb - integer :: n_act_orb - integer :: n_virt_orb - integer :: n_del_orb + integer :: n_all_but_del_orb - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital Needs: @@ -1954,179 +1477,186 @@ Providers * :c:data:`mo_class` * :c:data:`mo_num` - * :c:data:`mpi_master` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`dim_list_core_orb` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb_allocate` - * :c:data:`n_inact_act_orb` - * :c:data:`n_inact_orb_allocate` - * :c:data:`n_virt_orb_allocate` - * :c:data:`pt2_f` + * :c:data:`list_all_but_del_orb` -.. c:var:: n_core_orb_allocate +.. c:var:: n_core_inact_act_orb - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_core_orb_allocate + integer :: n_core_inact_act_orb + Number of core inactive and active MOs Needs: .. hlist:: :columns: 3 + * :c:data:`n_act_orb` * :c:data:`n_core_orb` + * :c:data:`n_inact_orb` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`list_core_inact_act` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` + * :c:data:`two_e_dm_mo` -.. c:var:: n_del_orb +.. c:var:: n_core_inact_orb File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_core_orb - integer :: n_inact_orb - integer :: n_act_orb - integer :: n_virt_orb - integer :: n_del_orb + integer :: n_core_inact_orb - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + n_core + n_inact Needs: .. hlist:: :columns: 3 - * :c:data:`mo_class` - * :c:data:`mo_num` - * :c:data:`mpi_master` + * :c:data:`n_int` + * :c:data:`reunion_of_core_inact_bitmask` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`dim_list_core_orb` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb_allocate` - * :c:data:`n_inact_act_orb` - * :c:data:`n_inact_orb_allocate` - * :c:data:`n_virt_orb_allocate` - * :c:data:`pt2_f` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`cholesky_no_total_transp` + * :c:data:`d0tu_alpha_ao` + * :c:data:`dim_list_core_inact_orb` + * :c:data:`etwo` + * :c:data:`excit` + * :c:data:`fipq` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`list_core_inact` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`n_c_a_prov` + * :c:data:`nmonoex` + * :c:data:`occnum` + * :c:data:`super_ci_dm` + * :c:data:`umat` -.. c:var:: n_generators_bitmask +.. c:var:: n_core_orb - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_generators_bitmask + integer :: n_core_orb - Number of bitmasks for generators + Number of core MOs Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` + * :c:data:`mo_class` + * :c:data:`mo_num` * :c:data:`mpi_master` - * :c:data:`n_int` Needed by: .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`generators_bitmask` - * :c:data:`generators_bitmask_restart` + * :c:data:`core_bitmask` + * :c:data:`core_energy` + * :c:data:`core_energy_erf` + * :c:data:`core_fock_operator` + * :c:data:`core_fock_operator_erf` + * :c:data:`dim_list_core_orb` + * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`fock_matrix_mo` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`list_core` + * :c:data:`n_core_inact_act_orb` + * :c:data:`one_e_dm_mo_alpha_for_dft` + * :c:data:`one_e_dm_mo_alpha_for_dft_no_core` + * :c:data:`one_e_dm_mo_beta_for_dft` + * :c:data:`one_e_dm_mo_beta_for_dft_no_core` + * :c:data:`pt2_f` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` -.. c:var:: n_generators_bitmask_restart +.. c:var:: n_del_orb - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/core_inact_act_virt.irp.f` .. code:: fortran - integer :: n_generators_bitmask_restart + integer :: n_del_orb - Number of bitmasks for generators + Number of deleted MOs Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` + * :c:data:`mo_class` + * :c:data:`mo_num` * :c:data:`mpi_master` - * :c:data:`n_int` Needed by: .. hlist:: :columns: 3 - * :c:data:`generators_bitmask_restart` + * :c:data:`del_bitmask` + * :c:data:`dim_list_del_orb` + * :c:data:`list_del` .. c:var:: n_inact_act_orb @@ -2139,13 +1669,15 @@ Providers integer :: n_inact_act_orb + n_inact + n_act Needs: .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`n_act_orb` + * :c:data:`n_inact_orb` Needed by: @@ -2162,34 +1694,10 @@ Providers .. code:: fortran - integer :: n_core_orb integer :: n_inact_orb - integer :: n_act_orb - integer :: n_virt_orb - integer :: n_del_orb - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + Number of inactive MOs Needs: @@ -2205,43 +1713,21 @@ Providers .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`dim_list_core_orb` + * :c:data:`dim_list_inact_orb` * :c:data:`eigenvectors_fock_matrix_mo` * :c:data:`fock_matrix_mo` - * :c:data:`list_core_inact_act` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`inact_bitmask` * :c:data:`list_inact` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_vv_from_ao` * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb_allocate` * :c:data:`n_inact_act_orb` - * :c:data:`n_inact_orb_allocate` - * :c:data:`n_virt_orb_allocate` - * :c:data:`pt2_f` - - -.. c:var:: n_inact_orb_allocate - - - File : :file:`bitmask/bitmasks.irp.f` - - .. code:: fortran - - integer :: n_inact_orb_allocate - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_core_orb` - + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` .. c:var:: n_int @@ -2269,14 +1755,18 @@ Providers .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` + * :c:data:`act_bitmask` + * :c:data:`cfg_seniority_index` * :c:data:`ci_electronic_energy` * :c:data:`closed_shell_ref_bitmask` * :c:data:`coef_hf_selector` + * :c:data:`core_bitmask` * :c:data:`core_inact_act_bitmask_4` - * :c:data:`degree_max_generators` - * :c:data:`det_to_occ_pattern` + * :c:data:`del_bitmask` + * :c:data:`det_to_configuration` + * :c:data:`dettocsftransformationmatrix` * :c:data:`diagonal_h_matrix_on_psi_det` + * :c:data:`dominant_dets_of_cfgs` * :c:data:`double_exc_bitmask` * :c:data:`exc_degree_per_selectors` * :c:data:`fock_operator_closed_shell_ref_bitmask` @@ -2284,26 +1774,41 @@ Providers * :c:data:`full_ijkl_bitmask` * :c:data:`full_ijkl_bitmask_4` * :c:data:`generators_bitmask` - * :c:data:`generators_bitmask_restart` * :c:data:`global_selection_buffer` + * :c:data:`gradvec_old` * :c:data:`h_apply_buffer_allocated` * :c:data:`h_matrix_all_dets` * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`hessmat_old` * :c:data:`hf_bitmask` + * :c:data:`inact_bitmask` * :c:data:`inact_virt_bitmask` + * :c:data:`list_core_inact` * :c:data:`list_core_inact_act` - * :c:data:`list_inact` + * :c:data:`list_inact_act` * :c:data:`max_degree_exc` * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_cas_bitmask` + * :c:data:`multi_s_dipole_moment` * :c:data:`n_core_inact_orb` - * :c:data:`n_generators_bitmask` - * :c:data:`n_generators_bitmask_restart` + * :c:data:`n_det_generators` + * :c:data:`n_dominant_dets_of_cfgs` + * :c:data:`n_elec_alpha_for_psi_configuration` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` + * :c:data:`orb_swap` + * :c:data:`ormas_bitmask` + * :c:data:`p0tuvx` + * :c:data:`p0tuvx_peter` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_cas` * :c:data:`psi_cas_sorted_bit` + * :c:data:`psi_configuration` + * :c:data:`psi_configuration_sorted` + * :c:data:`psi_configuration_to_psi_det` + * :c:data:`psi_csf_coef` * :c:data:`psi_det` * :c:data:`psi_det_alpha` * :c:data:`psi_det_alpha_unique` @@ -2313,29 +1818,32 @@ Providers * :c:data:`psi_det_hii` * :c:data:`psi_det_sorted` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det_sorted_gen` * :c:data:`psi_energy` * :c:data:`psi_energy_two_e` + * :c:data:`psi_energy_two_e_trans` * :c:data:`psi_non_cas` * :c:data:`psi_non_cas_sorted_bit` - * :c:data:`psi_occ_pattern` * :c:data:`psi_selectors` * :c:data:`psi_selectors_diag_h_mat` * :c:data:`ref_bitmask` * :c:data:`ref_bitmask_energy` * :c:data:`ref_closed_shell_bitmask` + * :c:data:`reunion_of_act_virt_bitmask` * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` * :c:data:`reunion_of_core_inact_act_bitmask` * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`reunion_of_inact_act_bitmask` * :c:data:`s2_matrix_all_dets` * :c:data:`s2_values` * :c:data:`single_exc_bitmask` * :c:data:`singles_alpha_csc` * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_alpha_csc_map` * :c:data:`singles_beta_csc` * :c:data:`singles_beta_csc_idx` + * :c:data:`singles_beta_csc_map` * :c:data:`unpaired_alpha_electrons` + * :c:data:`virt_bitmask` * :c:data:`virt_bitmask_4` @@ -2346,34 +1854,10 @@ Providers .. code:: fortran - integer :: n_core_orb - integer :: n_inact_orb - integer :: n_act_orb integer :: n_virt_orb - integer :: n_del_orb - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + Number of virtual MOs Needs: @@ -2389,43 +1873,213 @@ Providers .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`dim_list_core_orb` + * :c:data:`cholesky_no_total_transp` + * :c:data:`dim_list_virt_orb` * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`excit` * :c:data:`fock_matrix_mo` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_vv_from_ao` - * :c:data:`n_core_inact_act_orb` - * :c:data:`n_core_orb_allocate` - * :c:data:`n_inact_act_orb` - * :c:data:`n_inact_orb_allocate` - * :c:data:`n_virt_orb_allocate` - * :c:data:`pt2_f` + * :c:data:`gradvec2` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`list_virt` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mat_tmp_dm_super_ci` + * :c:data:`n_c_a_prov` + * :c:data:`nmonoex` + * :c:data:`super_ci_dm` + * :c:data:`umat` + * :c:data:`virt_bitmask` -.. c:var:: n_virt_orb_allocate +.. c:var:: ormas_bitmask - File : :file:`bitmask/bitmasks.irp.f` + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: ormas_bitmask (N_int,ormas_n_space) + + + bitmask for each ormas space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + * :c:data:`ormas_list_orb` + * :c:data:`ormas_n_orb` + * :c:data:`ormas_n_space` + + + +.. c:var:: ormas_list_orb + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + integer, allocatable :: ormas_list_orb (ormas_max_n_orb,ormas_n_space) + + + list of orbitals in each ormas space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ormas_n_orb` + * :c:data:`ormas_n_space` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ormas_bitmask` + + +.. c:var:: ormas_max_e + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + integer, allocatable :: ormas_max_e (ormas_n_space) + + + max nelec in each active space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_num` + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + * :c:data:`ormas_n_space` + + + +.. c:var:: ormas_max_n_orb + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + integer, allocatable :: ormas_n_orb (ormas_n_space) + integer :: ormas_max_n_orb + + + number of orbitals in each ormas space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + * :c:data:`ormas_mstart` + * :c:data:`ormas_n_space` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ormas_bitmask` + * :c:data:`ormas_list_orb` + + +.. c:var:: ormas_min_e + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + integer, allocatable :: ormas_min_e (ormas_n_space) + + + min nelec in each active space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + * :c:data:`ormas_n_space` + + + +.. c:var:: ormas_mstart + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + integer, allocatable :: ormas_mstart (ormas_n_space) + + + first orbital idx in each active space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + * :c:data:`ormas_n_space` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ormas_n_orb` + + +.. c:var:: ormas_n_orb + + + File : :file:`bitmask/bitmasks_ormas.irp.f` .. code:: fortran - integer :: n_virt_orb_allocate + integer, allocatable :: ormas_n_orb (ormas_n_space) + integer :: ormas_max_n_orb + number of orbitals in each ormas space Needs: .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`mo_num` + * :c:data:`ormas_mstart` + * :c:data:`ormas_n_space` + + Needed by: + .. hlist:: + :columns: 3 + + * :c:data:`ormas_bitmask` + * :c:data:`ormas_list_orb` .. c:var:: ref_bitmask @@ -2463,37 +2117,43 @@ Providers * :c:data:`ref_closed_shell_bitmask` -.. c:var:: reunion_of_bitmask +.. c:var:: reunion_of_act_virt_bitmask File : :file:`bitmask/bitmasks.irp.f` .. code:: fortran - integer(bit_kind), allocatable :: reunion_of_bitmask (N_int,2) + integer(bit_kind), allocatable :: reunion_of_act_virt_bitmask (N_int,2) - Reunion of the inactive, active and virtual bitmasks + Reunion of the inactive and active bitmasks Needs: .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`list_inact` + * :c:data:`act_bitmask` * :c:data:`n_int` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`generators_bitmask` -.. c:var:: reunion_of_cas_inact_bitmask +.. c:var:: reunion_of_bitmask File : :file:`bitmask/bitmasks.irp.f` .. code:: fortran - integer(bit_kind), allocatable :: reunion_of_cas_inact_bitmask (N_int,2) + integer(bit_kind), allocatable :: reunion_of_bitmask (N_int,2) Reunion of the inactive, active and virtual bitmasks @@ -2503,8 +2163,10 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`act_bitmask` + * :c:data:`inact_bitmask` * :c:data:`n_int` + * :c:data:`virt_bitmask` @@ -2525,7 +2187,7 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`act_bitmask` * :c:data:`n_int` * :c:data:`reunion_of_core_inact_bitmask` @@ -2555,7 +2217,8 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` + * :c:data:`core_bitmask` + * :c:data:`inact_bitmask` * :c:data:`n_int` Needed by: @@ -2563,10 +2226,43 @@ Providers .. hlist:: :columns: 3 + * :c:data:`list_core_inact` * :c:data:`n_core_inact_orb` + * :c:data:`n_det_generators` + * :c:data:`psi_det_generators` * :c:data:`reunion_of_core_inact_act_bitmask` +.. c:var:: reunion_of_inact_act_bitmask + + + File : :file:`bitmask/bitmasks.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: reunion_of_inact_act_bitmask (N_int,2) + + + Reunion of the inactive and active bitmasks + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`inact_bitmask` + * :c:data:`n_int` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`generators_bitmask` + * :c:data:`list_inact_act` + + .. c:var:: unpaired_alpha_electrons @@ -2596,76 +2292,30 @@ Providers .. code:: fortran - integer, allocatable :: list_inact (dim_list_inact_orb) - integer, allocatable :: list_virt (dim_list_virt_orb) - integer, allocatable :: list_inact_reverse (mo_num) - integer, allocatable :: list_virt_reverse (mo_num) - integer, allocatable :: list_del_reverse (mo_num) - integer, allocatable :: list_del (mo_num) - integer, allocatable :: list_core (dim_list_core_orb) - integer, allocatable :: list_core_reverse (mo_num) - integer, allocatable :: list_act (dim_list_act_orb) - integer, allocatable :: list_act_reverse (mo_num) - integer(bit_kind), allocatable :: core_bitmask (N_int,2) - integer(bit_kind), allocatable :: inact_bitmask (N_int,2) - integer(bit_kind), allocatable :: act_bitmask (N_int,2) integer(bit_kind), allocatable :: virt_bitmask (N_int,2) - integer(bit_kind), allocatable :: del_bitmask (N_int,2) - inact_bitmask : Bitmask of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - n_inact_orb : Number of inactive orbitals - virt_bitmask : Bitmaks of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - n_virt_orb : Number of virtual orbitals - list_inact : List of the inactive orbitals which are supposed to be doubly excited - in post CAS methods - list_virt : List of vritual orbitals which are supposed to be recieve electrons - in post CAS methods - list_inact_reverse : reverse list of inactive orbitals - list_inact_reverse(i) = 0 ::> not an inactive - list_inact_reverse(i) = k ::> IS the kth inactive - list_virt_reverse : reverse list of virtual orbitals - list_virt_reverse(i) = 0 ::> not an virtual - list_virt_reverse(i) = k ::> IS the kth virtual - list_act(i) = index of the ith active orbital - - list_act_reverse : reverse list of active orbitals - list_act_reverse(i) = 0 ::> not an active - list_act_reverse(i) = k ::> IS the kth active orbital + Bitmask identifying the virtual MOs Needs: .. hlist:: :columns: 3 - * :c:data:`dim_list_core_orb` - * :c:data:`mo_class` - * :c:data:`mo_num` - * :c:data:`n_core_orb` + * :c:data:`list_virt` * :c:data:`n_int` + * :c:data:`n_virt_orb` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`core_energy_erf` - * :c:data:`core_fock_operator` - * :c:data:`core_fock_operator_erf` - * :c:data:`eigenvectors_fock_matrix_mo` - * :c:data:`fock_matrix_mo` * :c:data:`inact_virt_bitmask` - * :c:data:`list_core_inact_act` - * :c:data:`list_inact_act` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` + * :c:data:`n_det_generators` + * :c:data:`psi_det_generators` + * :c:data:`reunion_of_act_virt_bitmask` * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` - * :c:data:`reunion_of_core_inact_act_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` * :c:data:`virt_bitmask_4` @@ -2685,8 +2335,8 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_inact` * :c:data:`n_int` + * :c:data:`virt_bitmask` @@ -2711,6 +2361,7 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`debug_cfg` * :c:func:`debug_det` * :c:func:`debug_spindet` @@ -2725,7 +2376,7 @@ Subroutines / functions subroutine bitstring_to_list( string, list, n_elements, Nint) - Gives the inidices(+1) of the bits set to 1 in the bit string + Gives the indices(+1) of the bits set to 1 in the bit string Called by: @@ -2734,13 +2385,16 @@ Subroutines / functions * :c:func:`add_integrals_to_map` * :c:func:`add_integrals_to_map_erf` - * :c:func:`add_integrals_to_map_no_exit_34` - * :c:func:`add_integrals_to_map_three_indices` * :c:func:`create_microlist` * :c:func:`example_bitmask` + * :c:func:`generate_cas_space` * :c:func:`getmobiles` + * :c:data:`list_core_inact` * :c:data:`list_core_inact_act` + * :c:data:`list_inact_act` * :c:data:`ref_bitmask_energy` + * :c:func:`splash_p` + * :c:func:`spot_hasbeen` .. c:function:: bitstring_to_str: @@ -2760,11 +2414,10 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`add_integrals_to_map` * :c:func:`add_integrals_to_map_erf` - * :c:func:`add_integrals_to_map_three_indices` * :c:func:`example_bitmask` * :c:func:`print_det` + * :c:func:`print_det_one_dimension` * :c:func:`print_spindet` @@ -2802,6 +2455,48 @@ Subroutines / functions * :c:data:`ref_closed_shell_bitmask` +.. c:function:: configuration_to_str: + + + File : :file:`bitmask/bitmasks_routines.irp.f` + + .. code:: fortran + + subroutine configuration_to_str( output, string, Nint ) + + + Transform the bit string of a configuration to a string for printing + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`debug_cfg` + + +.. c:function:: debug_cfg: + + + File : :file:`bitmask/bitmasks_routines.irp.f` + + .. code:: fortran + + subroutine debug_cfg(string,Nint) + + + Subroutine to print the content of a determinant in '+-' notation and + hexadecimal representation. + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`bitstring_to_hexa` + * :c:func:`configuration_to_str` + + .. c:function:: debug_det: @@ -2823,6 +2518,7 @@ Subroutines / functions * :c:func:`build_fock_tmp` * :c:func:`example_determinants` * :c:func:`get_excitation_degree_vector_single_or_exchange_verbose` + * :c:func:`get_particles_general` * :c:func:`number_of_holes_verbose` * :c:func:`number_of_particles_verbose` * :c:func:`routine_example_psi_det` @@ -2858,6 +2554,30 @@ Subroutines / functions * :c:func:`print_spindet` +.. c:function:: det_allowed_ormas: + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + logical function det_allowed_ormas(key_in) + + + return true if det has allowable ormas occupations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + * :c:data:`ormas_bitmask` + * :c:data:`ormas_max_e` + * :c:data:`ormas_min_e` + * :c:data:`ormas_n_space` + + .. c:function:: example_bitmask: @@ -2875,10 +2595,16 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_core_orb` + * :c:data:`list_act` + * :c:data:`list_core` * :c:data:`list_inact` - * :c:data:`n_int` + * :c:data:`list_virt` * :c:data:`mo_num` + * :c:data:`n_act_orb` + * :c:data:`n_core_orb` + * :c:data:`n_inact_orb` + * :c:data:`n_int` + * :c:data:`n_virt_orb` Calls: @@ -2891,27 +2617,34 @@ Subroutines / functions * :c:func:`set_bit_to_integer` -.. c:function:: initialize_bitmask_to_restart_ones: +.. c:function:: initialize_mo_coef_begin_iteration: - File : :file:`bitmask/modify_bitmasks.irp.f` + File : :file:`bitmask/track_orb.irp.f` .. code:: fortran - subroutine initialize_bitmask_to_restart_ones + subroutine initialize_mo_coef_begin_iteration - Initialization of the generators_bitmask to the restart bitmask + + Initialize :c:data:`mo_coef_begin_iteration` to the current :c:data:`mo_coef` Needs: .. hlist:: :columns: 3 - * :c:data:`generators_bitmask_restart` - * :c:data:`n_generators_bitmask` - * :c:data:`generators_bitmask` - * :c:data:`n_int` + * :c:data:`mo_coef` + * :c:data:`mo_coef_begin_iteration` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`damping_scf` + * :c:func:`roothaan_hall_scf` .. c:function:: is_a_1h: @@ -3059,7 +2792,7 @@ Subroutines / functions logical function that returns True if the determinant 'key_in' belongs to the 2h-2p excitation class of the DDCI space - this is calculated using the CAS_bitmask that defines the active + this is calculated using the act_bitmask that defines the active orbital space, the inact_bitmasl that defines the inactive oribital space and the virt_bitmask that defines the virtual orbital space @@ -3068,10 +2801,10 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` - * :c:data:`list_inact` + * :c:data:`act_bitmask` * :c:data:`n_int` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` .. c:function:: is_i_in_virtual: @@ -3090,8 +2823,27 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`list_inact` * :c:data:`n_int` + * :c:data:`virt_bitmask` + + +.. c:function:: is_integer_in_string: + + + File : :file:`bitmask/bitmasks_routines.irp.f` + + .. code:: fortran + + logical function is_integer_in_string(bite,string,Nint) + + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`set_bit_to_integer` .. c:function:: is_the_hole_in_det: @@ -3150,8 +2902,29 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`act_bitmask` + * :c:data:`core_bitmask` + * :c:data:`del_bitmask` + * :c:func:`generate_cas_space` * :c:data:`hf_bitmask` - * :c:data:`list_inact` + * :c:data:`inact_bitmask` + * :c:func:`orb_range_2_rdm_openmp_work_1` + * :c:func:`orb_range_2_rdm_openmp_work_2` + * :c:func:`orb_range_2_rdm_openmp_work_3` + * :c:func:`orb_range_2_rdm_openmp_work_4` + * :c:func:`orb_range_2_rdm_openmp_work_n_int` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_1` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_2` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_3` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_4` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_n_int` + * :c:func:`orb_range_2_trans_rdm_openmp_work_1` + * :c:func:`orb_range_2_trans_rdm_openmp_work_2` + * :c:func:`orb_range_2_trans_rdm_openmp_work_3` + * :c:func:`orb_range_2_trans_rdm_openmp_work_4` + * :c:func:`orb_range_2_trans_rdm_openmp_work_n_int` + * :c:data:`ormas_bitmask` + * :c:data:`virt_bitmask` .. c:function:: modify_bitmasks_for_hole: @@ -3172,10 +2945,9 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_generators_bitmask` * :c:data:`generators_bitmask` - * :c:data:`n_int` * :c:data:`index_holes_bitmask` + * :c:data:`n_int` .. c:function:: modify_bitmasks_for_hole_in_out: @@ -3196,7 +2968,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_generators_bitmask` * :c:data:`generators_bitmask` * :c:data:`index_holes_bitmask` @@ -3219,9 +2990,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`index_particl_bitmask` - * :c:data:`n_generators_bitmask` * :c:data:`generators_bitmask` + * :c:data:`index_particl_bitmask` * :c:data:`n_int` @@ -3236,15 +3006,38 @@ Subroutines / functions Function that returns the number of holes in the inact space + + popcnt( + xor( + iand( + reunion_of_core_inact_bitmask(1,1), + xor( + key_in(1,1), + iand( + key_in(1,1), + act_bitmask(1,1)) + ) + ), + reunion_of_core_inact_bitmask(1,1)) ) + + (key_in && act_bitmask) + +---------------------+ + electrons in cas xor key_in + +---------------------------------+ + electrons outside of cas && reunion_of_core_inact_bitmask + +------------------------------------------------------------------+ + electrons in the core/inact space xor reunion_of_core_inact_bitmask + +---------------------------------------------------------------------------------+ + holes Needs: .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`act_bitmask` * :c:data:`n_int` + * :c:data:`reunion_of_core_inact_bitmask` .. c:function:: number_of_holes_verbose: @@ -3264,9 +3057,9 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`act_bitmask` * :c:data:`n_int` + * :c:data:`reunion_of_core_inact_bitmask` Calls: @@ -3293,9 +3086,9 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`list_inact` + * :c:data:`act_bitmask` * :c:data:`n_int` + * :c:data:`virt_bitmask` .. c:function:: number_of_particles_verbose: @@ -3315,9 +3108,9 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`cas_bitmask` - * :c:data:`list_inact` + * :c:data:`act_bitmask` * :c:data:`n_int` + * :c:data:`virt_bitmask` Calls: @@ -3327,6 +3120,28 @@ Subroutines / functions * :c:func:`debug_det` +.. c:function:: ormas_occ: + + + File : :file:`bitmask/bitmasks_ormas.irp.f` + + .. code:: fortran + + subroutine ormas_occ(key_in, occupancies) + + + number of electrons in each ormas space + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + * :c:data:`ormas_bitmask` + * :c:data:`ormas_n_space` + + .. c:function:: print_det: @@ -3346,10 +3161,7 @@ Subroutines / functions * :c:func:`debug_det` * :c:func:`example_determinants` - * :c:func:`print_generators_bitmasks_holes` - * :c:func:`print_generators_bitmasks_holes_for_one_generator` * :c:func:`print_generators_bitmasks_particles` - * :c:func:`print_generators_bitmasks_particles_for_one_generator` Calls: @@ -3359,42 +3171,34 @@ Subroutines / functions * :c:func:`bitstring_to_str` -.. c:function:: print_generators_bitmasks_holes: +.. c:function:: print_det_one_dimension: - File : :file:`bitmask/modify_bitmasks.irp.f` + File : :file:`bitmask/bitmasks_routines.irp.f` .. code:: fortran - subroutine print_generators_bitmasks_holes - - - - Needs: + subroutine print_det_one_dimension(string,Nint) - .. hlist:: - :columns: 3 - * :c:data:`generators_bitmask` - * :c:data:`n_int` - * :c:data:`index_holes_bitmask` + Subroutine to print the content of a determinant using the '+-' notation Calls: .. hlist:: :columns: 3 - * :c:func:`print_det` + * :c:func:`bitstring_to_str` -.. c:function:: print_generators_bitmasks_holes_for_one_generator: +.. c:function:: print_generators_bitmasks_holes: File : :file:`bitmask/modify_bitmasks.irp.f` .. code:: fortran - subroutine print_generators_bitmasks_holes_for_one_generator(i_gen) + subroutine print_generators_bitmasks_holes @@ -3404,15 +3208,8 @@ Subroutines / functions :columns: 3 * :c:data:`generators_bitmask` - * :c:data:`n_int` * :c:data:`index_holes_bitmask` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`print_det` + * :c:data:`n_int` .. c:function:: print_generators_bitmasks_particles: @@ -3431,8 +3228,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`index_particl_bitmask` * :c:data:`generators_bitmask` + * :c:data:`index_particl_bitmask` * :c:data:`n_int` Calls: @@ -3443,59 +3240,72 @@ Subroutines / functions * :c:func:`print_det` -.. c:function:: print_generators_bitmasks_particles_for_one_generator: +.. c:function:: print_spindet: - File : :file:`bitmask/modify_bitmasks.irp.f` + File : :file:`bitmask/bitmasks_routines.irp.f` .. code:: fortran - subroutine print_generators_bitmasks_particles_for_one_generator(i_gen) + subroutine print_spindet(string,Nint) + Subroutine to print the content of a determinant using the '+-' notation - Needs: + Called by: .. hlist:: :columns: 3 - * :c:data:`index_particl_bitmask` - * :c:data:`generators_bitmask` - * :c:data:`n_int` + * :c:func:`debug_spindet` Calls: .. hlist:: :columns: 3 - * :c:func:`print_det` + * :c:func:`bitstring_to_str` -.. c:function:: print_spindet: +.. c:function:: reorder_core_orb: - File : :file:`bitmask/bitmasks_routines.irp.f` + File : :file:`bitmask/track_orb.irp.f` .. code:: fortran - subroutine print_spindet(string,Nint) + subroutine reorder_core_orb - Subroutine to print the content of a determinant using the '+-' notation + routines that takes the current :c:data:`mo_coef` and reorder the core orbitals (see :c:data:`list_core` and :c:data:`n_core_orb`) according to the overlap with :c:data:`mo_coef_begin_iteration` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_overlap` + * :c:data:`list_core` + * :c:data:`mo_coef` + * :c:data:`mo_coef_begin_iteration` + * :c:data:`mo_num` + * :c:data:`n_core_orb` Called by: .. hlist:: :columns: 3 - * :c:func:`debug_spindet` + * :c:func:`damping_scf` + * :c:func:`roothaan_hall_scf` Calls: .. hlist:: :columns: 3 - * :c:func:`bitstring_to_str` + * :c:func:`dsort` .. c:function:: set_bit_to_integer: @@ -3516,6 +3326,8 @@ Subroutines / functions :columns: 3 * :c:func:`example_bitmask` + * :c:func:`is_integer_in_string` + * :c:data:`orb_swap` .. c:function:: set_bitmask_hole_as_input: @@ -3525,21 +3337,20 @@ Subroutines / functions .. code:: fortran - subroutine set_bitmask_hole_as_input(input_bimask) + subroutine set_bitmask_hole_as_input(input_bitmask) set the generators_bitmask for the holes - as the input_bimask + as the input_bitmask Needs: .. hlist:: :columns: 3 - * :c:data:`n_generators_bitmask` * :c:data:`generators_bitmask` - * :c:data:`n_int` * :c:data:`index_holes_bitmask` + * :c:data:`n_int` Touches: @@ -3556,20 +3367,19 @@ Subroutines / functions .. code:: fortran - subroutine set_bitmask_particl_as_input(input_bimask) + subroutine set_bitmask_particl_as_input(input_bitmask) set the generators_bitmask for the particles - as the input_bimask + as the input_bitmask Needs: .. hlist:: :columns: 3 - * :c:data:`index_particl_bitmask` - * :c:data:`n_generators_bitmask` * :c:data:`generators_bitmask` + * :c:data:`index_particl_bitmask` * :c:data:`n_int` Touches: diff --git a/docs/source/modules/cipsi.rst b/docs/source/modules/cipsi.rst index 77212469..75f3e0ef 100644 --- a/docs/source/modules/cipsi.rst +++ b/docs/source/modules/cipsi.rst @@ -28,11 +28,11 @@ The :c:func:`run_cipsi` subroutine iteratively: The difference between :c:func:`run_stochastic_cipsi` and :c:func:`run_cipsi` is that :c:func:`run_stochastic_cipsi` selects the determinants on the fly with the computation -of the stochastic |PT2| :cite:`Garniron_2017.2`. Hence, it is a semi-stochastic selection. It +of the stochastic |PT2| :cite:`Garniron_2017b`. Hence, it is a semi-stochastic selection. It * Selects the most important determinants from the external space and adds them to the internal space, on the fly with the computation of the PT2 with the stochastic algorithm - presented in :cite:`Garniron_2017.2`. + presented in :cite:`Garniron_2017b`. * If :option:`determinants s2_eig` is |true|, it adds all the necessary determinants to allow the eigenstates of |H| to be eigenstates of |S^2| * Extrapolates the variational energy by fitting @@ -138,87 +138,134 @@ value is stable with the number of points. EZFIO parameters ---------------- -.. option:: pert_2rdm +.. option:: save_wf_after_selection - If true, computes the one- and two-body rdms with perturbation theory + If true, saves the wave function after the selection, before the diagonalization Default: False +.. option:: seniority_max + + Maximum number of allowed open shells. Using -1 selects all determinants + + Default: -1 + +.. option:: excitation_ref + + 1: Hartree-Fock determinant, 2:All determinants of the dominant configuration + + Default: 1 + +.. option:: excitation_max + + Maximum number of excitation with respect to the Hartree-Fock determinant. Using -1 selects all determinants + + Default: -1 + +.. option:: excitation_alpha_max + + Maximum number of excitation for alpha determinants with respect to the Hartree-Fock determinant. Using -1 selects all determinants + + Default: -1 + +.. option:: excitation_beta_max + + Maximum number of excitation for beta determinants with respect to the Hartree-Fock determinant. Using -1 selects all determinants + + Default: -1 + +.. option:: twice_hierarchy_max + + Twice the maximum hierarchy parameter (excitation degree plus half the seniority number). Using -1 selects all determinants + + Default: -1 + Providers --------- -.. c:var:: global_selection_buffer +.. c:var:: initialize_pt2_e0_denominator - File : :file:`cipsi/run_pt2_slave.irp.f` + File : :file:`cipsi/energy.irp.f` .. code:: fortran - type(selection_buffer) :: global_selection_buffer + logical :: initialize_pt2_e0_denominator - Global buffer for the OpenMP selection + If true, initialize pt2_E0_denominator - Needs: + Needed by: .. hlist:: :columns: 3 - * :c:data:`global_selection_buffer_lock` - * :c:data:`n_det_generators` - * :c:data:`n_int` - + * :c:data:`pt2_e0_denominator` -.. c:var:: global_selection_buffer_lock +.. c:var:: pt2_e0_denominator - File : :file:`cipsi/run_pt2_slave.irp.f` + File : :file:`cipsi/energy.irp.f` .. code:: fortran - integer(omp_lock_kind) :: global_selection_buffer_lock + double precision, allocatable :: pt2_e0_denominator (N_states) - Global buffer for the OpenMP selection + E0 in the denominator of the PT2 - Needed by: + Needs: .. hlist:: :columns: 3 - * :c:data:`global_selection_buffer` + * :c:data:`barycentric_electronic_energy` + * :c:data:`h0_type` + * :c:data:`initialize_pt2_e0_denominator` + * :c:data:`mpi_master` + * :c:data:`n_states` + * :c:data:`nuclear_repulsion` + * :c:data:`psi_coef` + * :c:data:`psi_det_hii` + * :c:data:`psi_energy` + -.. c:var:: initialize_pt2_e0_denominator + +Subroutines / functions +----------------------- + +.. c:function:: bitstring_to_list_in_selection: - File : :file:`cipsi/energy.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - logical :: initialize_pt2_e0_denominator + subroutine bitstring_to_list_in_selection( string, list, n_elements, Nint) - If true, initialize pt2_E0_denominator + Gives the indices(+1) of the bits set to 1 in the bit string - Needed by: + Called by: .. hlist:: :columns: 3 - * :c:data:`pt2_e0_denominator` + * :c:func:`splash_pq` + * :c:func:`spot_isinwf` -.. c:var:: list_orb_pert_rdm +.. c:function:: fill_buffer_double: - File : :file:`cipsi/pert_rdm_providers.irp.f` + File : :file:`cipsi/selection.irp.f_template_915` .. code:: fortran - integer, allocatable :: list_orb_pert_rdm (n_orb_pert_rdm) + subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2_data, mat, buf) @@ -227,40 +274,64 @@ Providers .. hlist:: :columns: 3 - * :c:data:`list_act` - * :c:data:`n_orb_pert_rdm` - - - -.. c:var:: list_orb_reverse_pert_rdm - - - File : :file:`cipsi/pert_rdm_providers.irp.f` - - .. code:: fortran + * :c:data:`c0_weight` + * :c:data:`det_to_configuration` + * :c:data:`do_only_1h1p` + * :c:data:`do_ormas` + * :c:data:`dominant_dets_of_cfgs` + * :c:data:`elec_alpha_num` + * :c:data:`excitation_alpha_max` + * :c:data:`excitation_beta_max` + * :c:data:`excitation_max` + * :c:data:`excitation_ref` + * :c:data:`h0_type` + * :c:data:`hf_bitmask` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + * :c:data:`n_dominant_dets_of_cfgs` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`pseudo_sym` + * :c:data:`psi_configuration_hii` + * :c:data:`psi_det_generators` + * :c:data:`psi_det_hii` + * :c:data:`selection_weight` + * :c:data:`seniority_max` + * :c:data:`thresh_sym` + * :c:data:`twice_hierarchy_max` + * :c:data:`weight_selection` - integer, allocatable :: list_orb_reverse_pert_rdm (mo_num) + Called by: + .. hlist:: + :columns: 3 + * :c:func:`select_singles_and_doubles` - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`list_act` - * :c:data:`mo_num` - + * :c:func:`add_to_selection_buffer` + * :c:func:`apply_hole` + * :c:func:`apply_holes` + * :c:func:`apply_particle` + * :c:func:`apply_particles` + * :c:func:`configuration_to_dets_size` + * :c:func:`dsyev` + * :c:func:`get_excitation_degree` + * :c:func:`get_excitation_degree_spin` -.. c:var:: n_orb_pert_rdm +.. c:function:: fill_buffer_single: - File : :file:`cipsi/pert_rdm_providers.irp.f` + File : :file:`cipsi/selection.irp.f_template_915` .. code:: fortran - integer :: n_orb_pert_rdm + subroutine fill_buffer_single(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2_data, mat, buf) @@ -269,60 +340,103 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_act_orb` + * :c:data:`c0_weight` + * :c:data:`det_to_configuration` + * :c:data:`do_only_1h1p` + * :c:data:`do_ormas` + * :c:data:`dominant_dets_of_cfgs` + * :c:data:`elec_alpha_num` + * :c:data:`excitation_alpha_max` + * :c:data:`excitation_beta_max` + * :c:data:`excitation_max` + * :c:data:`excitation_ref` + * :c:data:`h0_type` + * :c:data:`hf_bitmask` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + * :c:data:`n_dominant_dets_of_cfgs` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`pseudo_sym` + * :c:data:`psi_configuration_hii` + * :c:data:`psi_det_generators` + * :c:data:`psi_det_hii` + * :c:data:`selection_weight` + * :c:data:`seniority_max` + * :c:data:`thresh_sym` + * :c:data:`twice_hierarchy_max` + * :c:data:`weight_selection` - Needed by: + Called by: .. hlist:: :columns: 3 - * :c:data:`list_orb_pert_rdm` - * :c:data:`pert_2rdm_provider` + * :c:func:`select_singles` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`add_to_selection_buffer` + * :c:func:`apply_hole` + * :c:func:`apply_holes` + * :c:func:`apply_particle` + * :c:func:`apply_particles` + * :c:func:`configuration_to_dets_size` + * :c:func:`dsyev` + * :c:func:`get_excitation_degree` + * :c:func:`get_excitation_degree_spin` -.. c:var:: nthreads_pt2 +.. c:function:: get_d0: - File : :file:`cipsi/environment.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - integer :: nthreads_pt2 + subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - Number of threads for Davidson Needs: .. hlist:: :columns: 3 - * :c:data:`mpi_master` - * :c:data:`nproc` - - - -.. c:var:: pert_2rdm_lock - + * :c:data:`mo_integrals_map` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` - File : :file:`cipsi/pert_rdm_providers.irp.f` + Called by: - .. code:: fortran + .. hlist:: + :columns: 3 - integer(omp_lock_kind) :: pert_2rdm_lock + * :c:func:`splash_pq` + Calls: + .. hlist:: + :columns: 3 + * :c:func:`apply_particles` + * :c:func:`get_mo_two_e_integrals` + * :c:func:`i_h_j` -.. c:var:: pert_2rdm_provider +.. c:function:: get_d0_reference: - File : :file:`cipsi/pert_rdm_providers.irp.f` + File : :file:`cipsi/selection_old.irp.f` .. code:: fortran - double precision, allocatable :: pert_2rdm_provider (n_orb_pert_rdm,n_orb_pert_rdm,n_orb_pert_rdm,n_orb_pert_rdm) + subroutine get_d0_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) @@ -331,22 +445,27 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_orb_pert_rdm` + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` + + Calls: + + .. hlist:: + :columns: 3 + * :c:func:`apply_particles` + * :c:func:`i_h_j` -.. c:var:: pt2_cw +.. c:function:: get_d1: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - double precision, allocatable :: pt2_w (N_det_generators) - double precision, allocatable :: pt2_cw (0:N_det_generators) - double precision :: pt2_w_t - double precision :: pt2_u_0 - integer, allocatable :: pt2_n_0 (pt2_N_teeth+1) + subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) @@ -355,59 +474,65 @@ Providers .. hlist:: :columns: 3 - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_stoch_istate` - * :c:data:`qp_max_mem` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` - Needed by: + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`splash_pq` + + Calls: .. hlist:: :columns: 3 - * :c:data:`pt2_f` - * :c:data:`pt2_j` + * :c:func:`apply_particles` + * :c:func:`get_mo_two_e_integrals` + * :c:func:`i_h_j` -.. c:var:: pt2_e0_denominator +.. c:function:: get_d1_reference: - File : :file:`cipsi/energy.irp.f` + File : :file:`cipsi/selection_old.irp.f` .. code:: fortran - double precision, allocatable :: pt2_e0_denominator (N_states) + subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - E0 in the denominator of the PT2 Needs: .. hlist:: :columns: 3 - * :c:data:`barycentric_electronic_energy` - * :c:data:`h0_type` - * :c:data:`initialize_pt2_e0_denominator` - * :c:data:`mpi_master` + * :c:data:`mo_num` + * :c:data:`n_int` * :c:data:`n_states` - * :c:data:`nuclear_repulsion` - * :c:data:`psi_coef` - * :c:data:`psi_det_hii` - * :c:data:`psi_energy` + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`apply_particles` + * :c:func:`i_h_j` -.. c:var:: pt2_f +.. c:function:: get_d2: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - integer, allocatable :: pt2_f (N_det_generators) - integer :: pt2_n_tasks_max + subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) @@ -416,84 +541,84 @@ Providers .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` - * :c:data:`mpi_master` - * :c:data:`n_core_orb` - * :c:data:`n_det_generators` - * :c:data:`pt2_min_parallel_tasks` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_w` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` + + Called by: + + .. hlist:: + :columns: 3 + * :c:func:`splash_pq` -.. c:var:: pt2_j +.. c:function:: get_d2_reference: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection_old.irp.f` .. code:: fortran - integer, allocatable :: pt2_j (N_det_generators) - integer, allocatable :: pt2_r (N_det_generators) + subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - pt2_J contains the list of generators after ordering them according to the - Monte Carlo sampling. - - pt2_R(i) is the number of combs drawn when determinant i is computed. Needs: .. hlist:: :columns: 3 - * :c:data:`n_det_generators` - * :c:data:`pt2_n_tasks` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_u` - * :c:data:`pt2_w` - * :c:data:`qp_max_mem` - + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` -.. c:var:: pt2_match_weight +.. c:function:: get_m0: - File : :file:`cipsi/selection.irp.f` + File : :file:`cipsi/selection_singles.irp.f` .. code:: fortran - double precision, allocatable :: pt2_match_weight (N_states) + subroutine get_m0(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) - Weights adjusted along the selection to make the PT2 contributions - of each state coincide. Needs: .. hlist:: :columns: 3 + * :c:data:`mo_num` + * :c:data:`n_int` * :c:data:`n_states` - Needed by: + Called by: .. hlist:: :columns: 3 - * :c:data:`selection_weight` + * :c:func:`splash_p` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`apply_particle` + * :c:func:`i_h_j` -.. c:var:: pt2_mindetinfirstteeth +.. c:function:: get_m1: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection_singles.irp.f` .. code:: fortran - integer :: pt2_n_teeth - integer :: pt2_mindetinfirstteeth + subroutine get_m1(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) @@ -502,1782 +627,34 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mpi_master` - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_stoch_istate` + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` - Needed by: + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`splash_p` + + Calls: .. hlist:: :columns: 3 - * :c:data:`pt2_f` - * :c:data:`pt2_j` - * :c:data:`pt2_w` + * :c:func:`apply_particle` + * :c:func:`i_h_j` -.. c:var:: pt2_n_0 +.. c:function:: get_m2: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection_singles.irp.f` .. code:: fortran - double precision, allocatable :: pt2_w (N_det_generators) - double precision, allocatable :: pt2_cw (0:N_det_generators) - double precision :: pt2_w_t - double precision :: pt2_u_0 - integer, allocatable :: pt2_n_0 (pt2_N_teeth+1) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_stoch_istate` - * :c:data:`qp_max_mem` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_f` - * :c:data:`pt2_j` - - -.. c:var:: pt2_n_tasks - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer :: pt2_n_tasks - - - Number of parallel tasks for the Monte Carlo - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_j` - - -.. c:var:: pt2_n_tasks_max - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer, allocatable :: pt2_f (N_det_generators) - integer :: pt2_n_tasks_max - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` - * :c:data:`mpi_master` - * :c:data:`n_core_orb` - * :c:data:`n_det_generators` - * :c:data:`pt2_min_parallel_tasks` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_w` - - - -.. c:var:: pt2_n_teeth - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer :: pt2_n_teeth - integer :: pt2_mindetinfirstteeth - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mpi_master` - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_stoch_istate` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_f` - * :c:data:`pt2_j` - * :c:data:`pt2_w` - - -.. c:var:: pt2_overlap - - - File : :file:`cipsi/energy.irp.f` - - .. code:: fortran - - double precision, allocatable :: pt2_overlap (N_states,N_states) - - - Overlap between the perturbed wave functions - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_states` - - - -.. c:var:: pt2_r - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer, allocatable :: pt2_j (N_det_generators) - integer, allocatable :: pt2_r (N_det_generators) - - - pt2_J contains the list of generators after ordering them according to the - Monte Carlo sampling. - - pt2_R(i) is the number of combs drawn when determinant i is computed. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`pt2_n_tasks` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_u` - * :c:data:`pt2_w` - * :c:data:`qp_max_mem` - - - -.. c:var:: pt2_stoch_istate - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer :: pt2_stoch_istate - - - State for stochatsic PT2 - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_w` - - -.. c:var:: pt2_u - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - double precision, allocatable :: pt2_u (N_det_generators) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_j` - - -.. c:var:: pt2_u_0 - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - double precision, allocatable :: pt2_w (N_det_generators) - double precision, allocatable :: pt2_cw (0:N_det_generators) - double precision :: pt2_w_t - double precision :: pt2_u_0 - integer, allocatable :: pt2_n_0 (pt2_N_teeth+1) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_stoch_istate` - * :c:data:`qp_max_mem` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_f` - * :c:data:`pt2_j` - - -.. c:var:: pt2_w - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - double precision, allocatable :: pt2_w (N_det_generators) - double precision, allocatable :: pt2_cw (0:N_det_generators) - double precision :: pt2_w_t - double precision :: pt2_u_0 - integer, allocatable :: pt2_n_0 (pt2_N_teeth+1) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_stoch_istate` - * :c:data:`qp_max_mem` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_f` - * :c:data:`pt2_j` - - -.. c:var:: pt2_w_t - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - double precision, allocatable :: pt2_w (N_det_generators) - double precision, allocatable :: pt2_cw (0:N_det_generators) - double precision :: pt2_w_t - double precision :: pt2_u_0 - integer, allocatable :: pt2_n_0 (pt2_N_teeth+1) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_stoch_istate` - * :c:data:`qp_max_mem` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_f` - * :c:data:`pt2_j` - - -.. c:var:: selection_weight - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - double precision, allocatable :: selection_weight (N_states) - - - Weights used in the selection criterion - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`c0_weight` - * :c:data:`n_states` - * :c:data:`pt2_match_weight` - * :c:data:`state_average_weight` - * :c:data:`variance_match_weight` - * :c:data:`weight_selection` - - - -.. c:var:: variance_match_weight - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - double precision, allocatable :: variance_match_weight (N_states) - - - Weights adjusted along the selection to make the variances - of each state coincide. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_states` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`selection_weight` - - - -Subroutines / functions ------------------------ - -.. c:function:: add_to_selection_buffer: - - - File : :file:`cipsi/selection_buffer.irp.f` - - .. code:: fortran - - subroutine add_to_selection_buffer(b, det, val) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`fill_buffer_double` - * :c:func:`fill_buffer_double_rdm` - * :c:func:`pt2_collector` - * :c:func:`selection_collector` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`sort_selection_buffer` - - -.. c:function:: bitstring_to_list_in_selection: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine bitstring_to_list_in_selection( string, list, n_elements, Nint) - - - Gives the inidices(+1) of the bits set to 1 in the bit string - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - * :c:func:`spot_isinwf` - - -.. c:function:: create_selection_buffer: - - - File : :file:`cipsi/selection_buffer.irp.f` - - .. code:: fortran - - subroutine create_selection_buffer(N, size_in, res) - - - Allocates the memory for a selection buffer. - The arrays have dimension size_in and the maximum number of elements is N - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:data:`global_selection_buffer` - * :c:func:`pt2_collector` - * :c:func:`run_pt2_slave_large` - * :c:func:`run_pt2_slave_small` - * :c:func:`run_selection_slave` - * :c:func:`selection_collector` - * :c:func:`zmq_pt2` - * :c:func:`zmq_selection` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`check_mem` - - -.. c:function:: delete_selection_buffer: - - - File : :file:`cipsi/selection_buffer.irp.f` - - .. code:: fortran - - subroutine delete_selection_buffer(b) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:data:`global_selection_buffer` - * :c:func:`pt2_collector` - * :c:func:`run_pt2_slave_large` - * :c:func:`run_pt2_slave_small` - * :c:func:`run_selection_slave` - * :c:func:`selection_collector` - * :c:func:`zmq_pt2` - * :c:func:`zmq_selection` - - -.. c:function:: fill_buffer_double: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2_data, mat, buf) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`det_to_occ_pattern` - * :c:data:`do_only_1h1p` - * :c:data:`h0_type` - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`pseudo_sym` - * :c:data:`psi_det_generators` - * :c:data:`psi_det_hii` - * :c:data:`psi_occ_pattern_hii` - * :c:data:`selection_weight` - * :c:data:`thresh_sym` - * :c:data:`weight_selection` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`select_singles_and_doubles` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`add_to_selection_buffer` - * :c:func:`apply_holes` - * :c:func:`apply_particles` - * :c:func:`dsyevd` - - -.. c:function:: fill_buffer_double_rdm: - - - File : :file:`cipsi/pert_rdm_providers.irp.f` - - .. code:: fortran - - subroutine fill_buffer_double_rdm(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2_data, mat, buf, psi_det_connection, psi_coef_connection_reverse, n_det_connection) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`det_to_occ_pattern` - * :c:data:`do_only_1h1p` - * :c:data:`h0_type` - * :c:data:`hf_bitmask` - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_orb_pert_rdm` - * :c:data:`n_states` - * :c:data:`pert_2rdm_lock` - * :c:data:`pert_2rdm_provider` - * :c:data:`psi_det_generators` - * :c:data:`psi_det_hii` - * :c:data:`psi_occ_pattern_hii` - * :c:data:`selection_weight` - * :c:data:`weight_selection` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`select_singles_and_doubles` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`add_to_selection_buffer` - * :c:func:`apply_holes` - * :c:func:`apply_particles` - * :c:func:`get_excitation_degree` - * :c:func:`give_2rdm_pert_contrib` - * :c:func:`update_keys_values` - - -.. c:function:: get_d0: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_integrals_map` - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`apply_particles` - * :c:func:`get_mo_two_e_integrals` - * :c:func:`i_h_j` - - -.. c:function:: get_d0_reference: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_d0_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`apply_particles` - * :c:func:`i_h_j` - - -.. c:function:: get_d1: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_integrals_map` - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`apply_particles` - * :c:func:`get_mo_two_e_integrals` - * :c:func:`i_h_j` - - -.. c:function:: get_d1_reference: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`apply_particles` - * :c:func:`i_h_j` - - -.. c:function:: get_d2: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - - -.. c:function:: get_d2_reference: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - - -.. c:function:: get_mask_phase: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine get_mask_phase(det1, pm, Nint) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - - -.. c:function:: get_phase_bi: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - double precision function get_phase_bi(phasemask, s1, s2, h1, p1, h2, p2, Nint) - - - - -.. c:function:: give_2rdm_pert_contrib: - - - File : :file:`cipsi/update_2rdm.irp.f` - - .. code:: fortran - - subroutine give_2rdm_pert_contrib(det,coef,psi_det_connection,psi_coef_connection_reverse,n_det_connection,nkeys,keys,values,sze_buff) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`elec_alpha_num` - * :c:data:`n_int` - * :c:data:`n_orb_pert_rdm` - * :c:data:`n_states` - * :c:data:`pert_2rdm_lock` - * :c:data:`pert_2rdm_provider` - * :c:data:`state_average_weight` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`fill_buffer_double_rdm` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`get_excitation` - * :c:func:`update_buffer_single_exc_rdm` - * :c:func:`update_keys_values` - - -.. c:function:: make_selection_buffer_s2: - - - File : :file:`cipsi/selection_buffer.irp.f` - - .. code:: fortran - - subroutine make_selection_buffer_s2(b) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`elec_alpha_num` - * :c:data:`n_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`zmq_pt2` - * :c:func:`zmq_selection` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`check_mem` - * :c:func:`dsort` - * :c:func:`i8sort` - * :c:func:`occ_pattern_to_dets` - * :c:func:`occ_pattern_to_dets_size` - - -.. c:function:: merge_selection_buffers: - - - File : :file:`cipsi/selection_buffer.irp.f` - - .. code:: fortran - - subroutine merge_selection_buffers(b1, b2) - - - Merges the selection buffers b1 and b2 into b2 - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`run_pt2_slave_large` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`check_mem` - - -.. c:function:: past_d1: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine past_d1(bannedOrb, p) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_num` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - - -.. c:function:: past_d2: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine past_d2(banned, p, sp) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mo_num` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`splash_pq` - - -.. c:function:: provide_everything: - - - File : :file:`cipsi/slave_cipsi.irp.f` - - .. code:: fortran - - subroutine provide_everything - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ci_energy` - * :c:data:`generators_bitmask` - * :c:data:`h_apply_buffer_allocated` - * :c:data:`mo_num` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mpi_master` - * :c:data:`n_det` - * :c:data:`n_det_generators` - * :c:data:`n_det_selectors` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`pseudo_sym` - * :c:data:`psi_coef` - * :c:data:`psi_det_generators` - * :c:data:`psi_det` - * :c:data:`psi_det_generators` - * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_selectors` - * :c:data:`pt2_e0_denominator` - * :c:data:`pt2_stoch_istate` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_generators` - * :c:data:`zmq_context` - * :c:data:`zmq_state` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`run_slave_cipsi` - - -.. c:function:: pt2_add: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_add(p1, w, p2) - - - p1 =! p1 +( w * p2) - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_collector` - * :c:func:`selection_collector` - - -.. c:function:: pt2_add2: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_add2(p1, w, p2) - - - p1 =! p1 +( w * p2**2) - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_collector` - - -.. c:function:: pt2_addr: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_addr(p1, a, b, p2) - - - p1 =! p1 +( a / b * p2) - - -.. c:function:: pt2_alloc: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_alloc(pt2_data,N) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_collector` - * :c:func:`run_cipsi` - * :c:func:`run_pt2_slave_large` - * :c:func:`run_pt2_slave_small` - * :c:func:`run_selection_slave` - * :c:func:`run_stochastic_cipsi` - * :c:func:`selection_collector` - - -.. c:function:: pt2_collector: - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2_data, pt2_data_err, b, N_) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`n_states` - * :c:data:`pt2_f` - * :c:data:`pt2_j` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_stoch_istate` - * :c:data:`pt2_u` - * :c:data:`pt2_w` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`zmq_pt2` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`add_to_selection_buffer` - * :c:func:`check_mem` - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`pt2_add` - * :c:func:`pt2_add2` - * :c:func:`pt2_alloc` - * :c:func:`pt2_dealloc` - * :c:func:`pull_pt2_results` - * :c:func:`sleep` - * :c:func:`sort_selection_buffer` - * :c:func:`wall_time` - - -.. c:function:: pt2_dealloc: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_dealloc(pt2_data) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_collector` - * :c:func:`run_cipsi` - * :c:func:`run_pt2_slave_large` - * :c:func:`run_pt2_slave_small` - * :c:func:`run_selection_slave` - * :c:func:`run_stochastic_cipsi` - * :c:func:`selection_collector` - - -.. c:function:: pt2_deserialize: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_deserialize(pt2_data, n, x) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pull_pt2_results` - * :c:func:`pull_selection_results` - - -.. c:function:: pt2_find_sample: - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer function pt2_find_sample(v, w) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - - -.. c:function:: pt2_find_sample_lr: - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - integer function pt2_find_sample_lr(v, w, l_in, r_in) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - - -.. c:function:: pt2_serialize: - - - File : :file:`cipsi/pt2_type.irp.f` - - .. code:: fortran - - subroutine pt2_serialize(pt2_data, n, x) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`push_pt2_results_async_send` - * :c:func:`push_selection_results` - - -.. c:function:: pt2_slave_inproc: - - - File : :file:`cipsi/pt2_stoch_routines.irp.f` - - .. code:: fortran - - subroutine pt2_slave_inproc(i) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`global_selection_buffer` - * :c:data:`pt2_e0_denominator` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`zmq_pt2` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`run_pt2_slave` - - -.. c:function:: pull_pt2_results: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine pull_pt2_results(zmq_socket_pull, index, pt2_data, task_id, n_tasks, b) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_collector` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_deserialize` - - -.. c:function:: pull_selection_results: - - - File : :file:`cipsi/run_selection_slave.irp.f` - - .. code:: fortran - - subroutine pull_selection_results(zmq_socket_pull, pt2_data, val, det, N, task_id, ntasks) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`selection_collector` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_deserialize` - - -.. c:function:: push_pt2_results: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine push_pt2_results(zmq_socket_push, index, pt2_data, b, task_id, n_tasks) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`run_pt2_slave_small` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`push_pt2_results_async_recv` - * :c:func:`push_pt2_results_async_send` - - -.. c:function:: push_pt2_results_async_recv: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine push_pt2_results_async_recv(zmq_socket_push,mini,sending) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`push_pt2_results` - * :c:func:`run_pt2_slave_large` - - -.. c:function:: push_pt2_results_async_send: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine push_pt2_results_async_send(zmq_socket_push, index, pt2_data, b, task_id, n_tasks, sending) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`push_pt2_results` - * :c:func:`run_pt2_slave_large` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_serialize` - - -.. c:function:: push_selection_results: - - - File : :file:`cipsi/run_selection_slave.irp.f` - - .. code:: fortran - - subroutine push_selection_results(zmq_socket_push, pt2_data, b, task_id, ntasks) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`run_selection_slave` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_serialize` - - -.. c:function:: remove_duplicates_in_selection_buffer: - - - File : :file:`cipsi/selection_buffer.irp.f` - - .. code:: fortran - - subroutine remove_duplicates_in_selection_buffer(b) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`zmq_pt2` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`check_mem` - * :c:func:`i8sort` - - -.. c:function:: run_cipsi: - - - File : :file:`cipsi/cipsi.irp.f` - - .. code:: fortran - - subroutine run_cipsi - - - Selected Full Configuration Interaction with deterministic selection and - stochastic PT2. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`correlation_energy_ratio_max` - * :c:data:`do_pt2` - * :c:data:`h_apply_buffer_allocated` - * :c:data:`n_det` - * :c:data:`n_det_max` - * :c:data:`n_iter` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`psi_coef` - * :c:data:`psi_det` - * :c:data:`psi_det_sorted` - * :c:data:`psi_energy` - * :c:data:`psi_energy_with_nucl_rep` - * :c:data:`psi_occ_pattern` - * :c:data:`pt2_max` - * :c:data:`pt2_relative_error` - * :c:data:`ref_bitmask_energy` - * :c:data:`s2_eig` - * :c:data:`selection_factor` - * :c:data:`threshold_generators` - * :c:data:`variance_max` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`fci` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`check_mem` - * :c:func:`copy_h_apply_buffer_to_wf` - * :c:func:`diagonalize_ci` - * :c:func:`ezfio_get_hartree_fock_energy` - * :c:func:`ezfio_has_hartree_fock_energy` - * :c:func:`make_s2_eigenfunction` - * :c:func:`print_extrapolated_energy` - * :c:func:`print_summary` - * :c:func:`pt2_alloc` - * :c:func:`pt2_dealloc` - * :c:func:`save_energy` - * :c:func:`save_iterations` - * :c:func:`save_wavefunction` - * :c:func:`write_double` - * :c:func:`zmq_pt2` - * :c:func:`zmq_selection` - - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`ci_electronic_energy` - * :c:data:`ci_electronic_energy` - * :c:data:`ci_energy` - * :c:data:`ci_electronic_energy` - * :c:data:`n_det` - * :c:data:`n_iter` - * :c:data:`psi_occ_pattern` - * :c:data:`c0_weight` - * :c:data:`psi_coef` - * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_energy` - * :c:data:`psi_occ_pattern` - * :c:data:`psi_energy` - * :c:data:`pt2_match_weight` - * :c:data:`pt2_overlap` - * :c:data:`pt2_stoch_istate` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_davidson_pt2` - * :c:data:`threshold_generators` - * :c:data:`variance_match_weight` - - -.. c:function:: run_pt2_slave: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine run_pt2_slave(thread,iproc,energy) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_states_diag` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`pt2_slave_inproc` - * :c:func:`run_slave_main` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`run_pt2_slave_large` - - -.. c:function:: run_pt2_slave_large: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine run_pt2_slave_large(thread,iproc,energy) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`elec_alpha_num` - * :c:data:`global_selection_buffer` - * :c:data:`global_selection_buffer_lock` - * :c:data:`mo_num` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`pt2_f` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`run_pt2_slave` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_zmq_push_socket` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`merge_selection_buffers` - * :c:func:`omp_set_lock` - * :c:func:`omp_unset_lock` - * :c:func:`pt2_alloc` - * :c:func:`pt2_dealloc` - * :c:func:`push_pt2_results_async_recv` - * :c:func:`push_pt2_results_async_send` - * :c:func:`select_connected` - * :c:func:`sleep` - * :c:func:`sort_selection_buffer` - * :c:func:`wall_time` - - -.. c:function:: run_pt2_slave_small: - - - File : :file:`cipsi/run_pt2_slave.irp.f` - - .. code:: fortran - - subroutine run_pt2_slave_small(thread,iproc,energy) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`elec_alpha_num` - * :c:data:`mo_num` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`nproc` - * :c:data:`pt2_f` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_zmq_push_socket` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`pt2_alloc` - * :c:func:`pt2_dealloc` - * :c:func:`push_pt2_results` - * :c:func:`select_connected` - * :c:func:`sort_selection_buffer` - * :c:func:`usleep` - * :c:func:`wall_time` - - -.. c:function:: run_selection_slave: - - - File : :file:`cipsi/run_selection_slave.irp.f` - - .. code:: fortran - - subroutine run_selection_slave(thread,iproc,energy) + subroutine get_m2(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) @@ -2286,108 +663,58 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`mo_num` * :c:data:`n_int` * :c:data:`n_states` - * :c:data:`pseudo_sym` - * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`psi_det_sorted` - * :c:data:`psi_det_sorted` - * :c:data:`psi_selectors_coef_transp` - * :c:data:`pt2_f` - * :c:data:`weight_selection` Called by: .. hlist:: :columns: 3 - * :c:func:`run_slave_main` - * :c:func:`selection_slave_inproc` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_zmq_push_socket` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`pt2_alloc` - * :c:func:`pt2_dealloc` - * :c:func:`push_selection_results` - * :c:func:`select_connected` - * :c:func:`sort_selection_buffer` - * :c:func:`usleep` + * :c:func:`splash_p` -.. c:function:: run_slave_cipsi: +.. c:function:: get_mask_phase: - File : :file:`cipsi/slave_cipsi.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - subroutine run_slave_cipsi - - - Helper program for distributed parallelism - - Needs: + subroutine get_mask_phase(det1, pm, Nint) - .. hlist:: - :columns: 3 - * :c:data:`distributed_davidson` - * :c:data:`read_wf` Called by: .. hlist:: :columns: 3 - * :c:func:`fci` - * :c:func:`pt2` + * :c:func:`splash_p` + * :c:func:`splash_pq` - Calls: + +.. c:function:: get_phase_bi: - .. hlist:: - :columns: 3 - * :c:func:`omp_set_nested` - * :c:func:`provide_everything` - * :c:func:`run_slave_main` - * :c:func:`switch_qp_run_to_master` + File : :file:`cipsi/selection.irp.f` - Touches: + .. code:: fortran + + double precision function get_phase_bi(phasemask, s1, s2, h1, p1, h2, p2, Nint) - .. hlist:: - :columns: 3 - * :c:data:`distributed_davidson` - * :c:data:`pt2_e0_denominator` - * :c:data:`pt2_stoch_istate` - * :c:data:`read_wf` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_generators` -.. c:function:: run_slave_main: +.. c:function:: provide_for_selection_slave: - File : :file:`cipsi/slave_cipsi.irp.f` + File : :file:`cipsi/run_selection_slave.irp.f` .. code:: fortran - subroutine run_slave_main + subroutine provide_for_selection_slave @@ -2396,79 +723,60 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`det_to_occ_pattern` - * :c:data:`elec_alpha_num` - * :c:data:`global_selection_buffer` - * :c:data:`h0_type` - * :c:data:`mo_num` - * :c:data:`mpi_master` - * :c:data:`mpi_rank` - * :c:data:`n_det` - * :c:data:`n_det_generators` - * :c:data:`n_det_selectors` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`nthreads_pt2` - * :c:data:`psi_coef` - * :c:data:`psi_det` - * :c:data:`pt2_e0_denominator` - * :c:data:`pt2_f` - * :c:data:`pt2_stoch_istate` - * :c:data:`qp_max_mem` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_generators` - * :c:data:`zmq_context` - * :c:data:`zmq_state` + * :c:data:`psi_det_sorted` + * :c:data:`psi_det_sorted` + * :c:data:`psi_selectors_coef_transp` Called by: .. hlist:: :columns: 3 - * :c:func:`run_slave_cipsi` + * :c:func:`run_selection_slave` + + +.. c:function:: provide_for_zmq_pt2: - Calls: + + File : :file:`cipsi/pt2_stoch_routines.irp.f` + + .. code:: fortran + + subroutine provide_for_zmq_pt2 + + + + Needs: .. hlist:: :columns: 3 - * :c:func:`check_mem` - * :c:func:`davidson_slave_tcp` - * :c:func:`mpi_print` - * :c:func:`omp_set_nested` - * :c:func:`resident_memory` - * :c:func:`run_pt2_slave` - * :c:func:`run_selection_slave` - * :c:func:`usleep` - * :c:func:`wait_for_states` - * :c:func:`wall_time` - * :c:func:`write_double` + * :c:data:`psi_det_hii` + * :c:data:`psi_det_sorted` + * :c:data:`psi_det_sorted` + * :c:data:`psi_selectors_coef_transp` - Touches: + Called by: .. hlist:: :columns: 3 - * :c:data:`pt2_e0_denominator` - * :c:data:`pt2_stoch_istate` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_generators` + * :c:func:`run_slave_main` + * :c:func:`zmq_pt2` -.. c:function:: run_stochastic_cipsi: +.. c:function:: run_cipsi: - File : :file:`cipsi/stochastic_cipsi.irp.f` + File : :file:`cipsi/cipsi.irp.f` .. code:: fortran - subroutine run_stochastic_cipsi + subroutine run_cipsi - Selected Full Configuration Interaction with Stochastic selection and PT2. + Selected Full Configuration Interaction with deterministic selection and + stochastic PT2. Needs: @@ -2476,33 +784,27 @@ Subroutines / functions :columns: 3 * :c:data:`correlation_energy_ratio_max` + * :c:data:`do_pt2` * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` * :c:data:`n_det_max` - * :c:data:`n_iter` * :c:data:`n_states` * :c:data:`n_states_diag` * :c:data:`psi_coef` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_sorted` * :c:data:`psi_energy` * :c:data:`psi_energy_with_nucl_rep` - * :c:data:`psi_occ_pattern` * :c:data:`pt2_max` * :c:data:`pt2_relative_error` * :c:data:`ref_bitmask_energy` * :c:data:`s2_eig` + * :c:data:`save_wf_after_selection` * :c:data:`selection_factor` * :c:data:`threshold_generators` * :c:data:`variance_max` - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`fci` - Calls: .. hlist:: @@ -2513,16 +815,19 @@ Subroutines / functions * :c:func:`diagonalize_ci` * :c:func:`ezfio_get_hartree_fock_energy` * :c:func:`ezfio_has_hartree_fock_energy` + * :c:func:`increment_n_iter` * :c:func:`make_s2_eigenfunction` * :c:func:`print_extrapolated_energy` + * :c:func:`print_mol_properties` * :c:func:`print_summary` * :c:func:`pt2_alloc` * :c:func:`pt2_dealloc` * :c:func:`save_energy` - * :c:func:`save_iterations` * :c:func:`save_wavefunction` + * :c:func:`write_cipsi_json` * :c:func:`write_double` * :c:func:`zmq_pt2` + * :c:func:`zmq_selection` Touches: @@ -2533,17 +838,16 @@ Subroutines / functions * :c:data:`ci_electronic_energy` * :c:data:`ci_energy` * :c:data:`ci_electronic_energy` + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`n_iter` - * :c:data:`psi_occ_pattern` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_energy` - * :c:data:`psi_occ_pattern` * :c:data:`psi_energy` * :c:data:`pt2_match_weight` * :c:data:`pt2_overlap` @@ -2555,191 +859,114 @@ Subroutines / functions * :c:data:`variance_match_weight` -.. c:function:: select_connected: - - - File : :file:`cipsi/selection.irp.f` - - .. code:: fortran - - subroutine select_connected(i_generator,E0,pt2_data,b,subset,csubset) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`generators_bitmask` - * :c:data:`mo_num` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_det_generators` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`run_pt2_slave_large` - * :c:func:`run_pt2_slave_small` - * :c:func:`run_selection_slave` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`build_fock_tmp` - * :c:func:`select_singles_and_doubles` - - -.. c:function:: select_singles_and_doubles: +.. c:function:: run_stochastic_cipsi: - File : :file:`cipsi/selection.irp.f` + File : :file:`cipsi/stochastic_cipsi.irp.f` .. code:: fortran - subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2_data,buf,subset,csubset) + subroutine run_stochastic_cipsi(Ev,PT2) - WARNING /!\ : It is assumed that the generators and selectors are psi_det_sorted + Selected Full Configuration Interaction with Stochastic selection and PT2. Needs: .. hlist:: :columns: 3 - * :c:data:`banned_excitation` - * :c:data:`mo_num` + * :c:data:`correlation_energy_ratio_max` + * :c:data:`distributed_davidson` + * :c:data:`h_apply_buffer_allocated` + * :c:data:`mo_two_e_integrals_in_map` * :c:data:`n_det` - * :c:data:`n_det_selectors` - * :c:data:`n_int` + * :c:data:`n_det_max` * :c:data:`n_states` - * :c:data:`pert_2rdm` - * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`psi_det_generators` - * :c:data:`psi_det_sorted` + * :c:data:`n_states_diag` + * :c:data:`psi_coef` + * :c:data:`psi_configuration` + * :c:data:`psi_det` * :c:data:`psi_det_sorted` - * :c:data:`psi_selectors_coef_transp` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`select_connected` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`apply_hole` - * :c:func:`bitstring_to_list_ab` - * :c:func:`fill_buffer_double` - * :c:func:`fill_buffer_double_rdm` - * :c:func:`get_excitation_degree_spin` - * :c:func:`isort` - * :c:func:`splash_pq` - * :c:func:`spot_isinwf` - - -.. c:function:: selection_collector: - - - File : :file:`cipsi/zmq_selection.irp.f` - - .. code:: fortran - - subroutine selection_collector(zmq_socket_pull, b, N, pt2_data) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det_generators` - * :c:data:`n_states` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`zmq_selection` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`add_to_selection_buffer` - * :c:func:`check_mem` - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`pt2_add` - * :c:func:`pt2_alloc` - * :c:func:`pt2_dealloc` - * :c:func:`pull_selection_results` - * :c:func:`sort_selection_buffer` - - -.. c:function:: selection_slave_inproc: - - - File : :file:`cipsi/zmq_selection.irp.f` - - .. code:: fortran - - subroutine selection_slave_inproc(i) - - + * :c:data:`psi_energy` + * :c:data:`psi_energy_with_nucl_rep` + * :c:data:`pt2_max` + * :c:data:`pt2_relative_error` + * :c:data:`ref_bitmask_energy` + * :c:data:`s2_eig` + * :c:data:`save_wf_after_selection` + * :c:data:`selection_factor` + * :c:data:`threshold_generators` + * :c:data:`variance_max` - Needs: + Called by: .. hlist:: :columns: 3 - * :c:data:`pt2_e0_denominator` + * :c:func:`run_optimization_mos_cipsi` - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`zmq_selection` + * :c:func:`check_mem` + * :c:func:`copy_h_apply_buffer_to_wf` + * :c:func:`diagonalize_ci` + * :c:func:`ezfio_get_hartree_fock_energy` + * :c:func:`ezfio_has_hartree_fock_energy` + * :c:func:`increment_n_iter` + * :c:func:`make_s2_eigenfunction` + * :c:func:`print_extrapolated_energy` + * :c:func:`print_mol_properties` + * :c:func:`print_summary` + * :c:func:`pt2_alloc` + * :c:func:`pt2_dealloc` + * :c:func:`save_energy` + * :c:func:`save_wavefunction` + * :c:func:`write_cipsi_json` + * :c:func:`write_double` + * :c:func:`zmq_pt2` - Calls: + Touches: .. hlist:: :columns: 3 - * :c:func:`run_selection_slave` + * :c:data:`ci_electronic_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`ci_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`psi_configuration` + * :c:data:`n_det` + * :c:data:`c0_weight` + * :c:data:`psi_coef` + * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` + * :c:data:`psi_det` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_energy` + * :c:data:`psi_energy` + * :c:data:`pt2_match_weight` + * :c:data:`pt2_overlap` + * :c:data:`pt2_stoch_istate` + * :c:data:`selection_weight` + * :c:data:`state_average_weight` + * :c:data:`threshold_davidson_pt2` + * :c:data:`threshold_generators` + * :c:data:`variance_match_weight` -.. c:function:: sort_selection_buffer: +.. c:function:: select_connected: - File : :file:`cipsi/selection_buffer.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - subroutine sort_selection_buffer(b) + subroutine select_connected(i_generator,E0,pt2_data,b,subset,csubset) @@ -2748,42 +975,42 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`generators_bitmask` + * :c:data:`mo_num` * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_generators` Called by: .. hlist:: :columns: 3 - * :c:func:`add_to_selection_buffer` - * :c:func:`pt2_collector` * :c:func:`run_pt2_slave_large` * :c:func:`run_pt2_slave_small` * :c:func:`run_selection_slave` - * :c:func:`selection_collector` Calls: .. hlist:: :columns: 3 - * :c:func:`check_mem` - * :c:func:`dsort` + * :c:func:`build_fock_tmp` + * :c:func:`select_singles` + * :c:func:`select_singles_and_doubles` -.. c:function:: splash_pq: +.. c:function:: select_singles: - File : :file:`cipsi/selection.irp.f` + File : :file:`cipsi/selection_singles.irp.f` .. code:: fortran - subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, interesting) + subroutine select_singles(i_gen,hole_mask,particle_mask,fock_diag_tmp,E0,pt2_data,buf) - Computes the contributions A(r,s) by - comparing the external determinant to all the internal determinants det(i). - an applying two particles (r,s) to the mask. + Select determinants connected to i_det by H Needs: @@ -2791,9 +1018,13 @@ Subroutines / functions :columns: 3 * :c:data:`mo_num` + * :c:data:`n_det` + * :c:data:`n_det_selectors` * :c:data:`n_int` * :c:data:`n_states` + * :c:data:`psi_det_generators` * :c:data:`psi_det_sorted` + * :c:data:`psi_selectors` * :c:data:`psi_selectors_coef_transp` Called by: @@ -2801,66 +1032,87 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`select_singles_and_doubles` + * :c:func:`select_connected` Calls: .. hlist:: :columns: 3 - * :c:func:`bitstring_to_list_in_selection` - * :c:func:`get_d0` - * :c:func:`get_d1` - * :c:func:`get_d2` - * :c:func:`get_mask_phase` - * :c:func:`past_d1` - * :c:func:`past_d2` + * :c:func:`apply_hole` + * :c:func:`bitstring_to_list_ab` + * :c:func:`fill_buffer_single` + * :c:func:`splash_p` + * :c:func:`spot_hasbeen` -.. c:function:: spot_isinwf: +.. c:function:: select_singles_and_doubles: File : :file:`cipsi/selection.irp.f` .. code:: fortran - subroutine spot_isinwf(mask, det, i_gen, N, banned, fullMatch, interesting) + subroutine select_singles_and_doubles(i_generator, hole_mask, particle_mask, fock_diag_tmp, E0, pt2_data, buf, subset, csubset) - Identify the determinants in det which are in the internal space. These are - the determinants that can be produced by creating two particles on the mask. + WARNING /!\ : It is assumed that the generators and selectors are psi_det_sorted Needs: .. hlist:: :columns: 3 + * :c:data:`banned_excitation` * :c:data:`mo_num` + * :c:data:`n_det` + * :c:data:`n_det_selectors` * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`psi_det_generators` + * :c:data:`psi_det_sorted` + * :c:data:`psi_det_sorted` + * :c:data:`psi_selectors_coef_transp` Called by: .. hlist:: :columns: 3 - * :c:func:`select_singles_and_doubles` + * :c:func:`select_connected` Calls: .. hlist:: :columns: 3 - * :c:func:`bitstring_to_list_in_selection` + * :c:func:`apply_hole` + * :c:func:`bitstring_to_list_ab` + * :c:func:`fill_buffer_double` + * :c:func:`get_excitation_degree_spin` + * :c:func:`isort_noidx` + * :c:func:`splash_pq` + * :c:func:`spot_isinwf` -.. c:function:: testteethbuilding: +.. c:function:: splash_p: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection_singles.irp.f` .. code:: fortran - logical function testTeethBuilding(minF, N) + subroutine splash_p(mask, sp, det, coefs, N_sel, bannedOrb, vect) @@ -2869,261 +1121,173 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_det_generators` - * :c:data:`psi_det_sorted_gen` - * :c:data:`pt2_stoch_istate` + * :c:data:`mo_num` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_sorted` - Calls: + Called by: .. hlist:: :columns: 3 - * :c:func:`check_mem` - - -.. c:function:: update_buffer_double_exc_rdm: - - - File : :file:`cipsi/update_2rdm.irp.f` - - .. code:: fortran - - subroutine update_buffer_double_exc_rdm(exc,phase,contrib,nkeys,keys,values,sze_buff) - - + * :c:func:`select_singles` - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`list_orb_reverse_pert_rdm` + * :c:func:`bitstring_to_list` + * :c:func:`get_m0` + * :c:func:`get_m1` + * :c:func:`get_m2` + * :c:func:`get_mask_phase` -.. c:function:: update_buffer_single_exc_rdm: +.. c:function:: splash_pq: - File : :file:`cipsi/update_2rdm.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - subroutine update_buffer_single_exc_rdm(det1,det2,exc,phase,contrib,nkeys,keys,values,sze_buff) + subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, interesting) + Computes the contributions A(r,s) by + comparing the external determinant to all the internal determinants det(i). + an applying two particles (r,s) to the mask. Needs: .. hlist:: :columns: 3 - * :c:data:`list_orb_reverse_pert_rdm` + * :c:data:`mo_num` * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_sorted` + * :c:data:`psi_selectors_coef_transp` Called by: .. hlist:: :columns: 3 - * :c:func:`give_2rdm_pert_contrib` + * :c:func:`select_singles_and_doubles` Calls: .. hlist:: :columns: 3 - * :c:func:`bitstring_to_list_ab` + * :c:func:`bitstring_to_list_in_selection` + * :c:func:`get_d0` + * :c:func:`get_d1` + * :c:func:`get_d2` + * :c:func:`get_mask_phase` -.. c:function:: update_pt2_and_variance_weights: +.. c:function:: spot_hasbeen: - File : :file:`cipsi/selection.irp.f` + File : :file:`cipsi/selection_singles.irp.f` .. code:: fortran - subroutine update_pt2_and_variance_weights(pt2_data, N_st) + subroutine spot_hasBeen(mask, sp, det, i_gen, N, banned, fullMatch) - Updates the PT2- and Variance- matching weights. Needs: .. hlist:: :columns: 3 - * :c:data:`n_det` - * :c:data:`n_states` - * :c:data:`pt2_match_weight` - * :c:data:`pt2_relative_error` - * :c:data:`threshold_davidson` - * :c:data:`threshold_davidson_pt2` - * :c:data:`variance_match_weight` + * :c:data:`mo_num` + * :c:data:`n_int` Called by: .. hlist:: :columns: 3 - * :c:func:`zmq_pt2` - * :c:func:`zmq_selection` + * :c:func:`select_singles` - Touches: + Calls: .. hlist:: :columns: 3 - * :c:data:`pt2_match_weight` - * :c:data:`threshold_davidson_pt2` - * :c:data:`variance_match_weight` + * :c:func:`bitstring_to_list` -.. c:function:: zmq_pt2: +.. c:function:: spot_isinwf: - File : :file:`cipsi/pt2_stoch_routines.irp.f` + File : :file:`cipsi/selection.irp.f` .. code:: fortran - subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in) + subroutine spot_isinwf(mask, det, i_gen, N, banned, fullMatch, interesting) + Identify the determinants in det that are in the internal space. These are + the determinants that can be produced by creating two particles on the mask. Needs: .. hlist:: :columns: 3 - * :c:data:`det_to_occ_pattern` - * :c:data:`elec_alpha_num` - * :c:data:`global_selection_buffer` - * :c:data:`h0_type` * :c:data:`mo_num` - * :c:data:`mo_one_e_integrals` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_det` - * :c:data:`n_det_generators` * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`nproc` - * :c:data:`nthreads_pt2` - * :c:data:`pseudo_sym` - * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`psi_det_hii` - * :c:data:`psi_det_sorted` - * :c:data:`psi_det_sorted` - * :c:data:`psi_occ_pattern_hii` - * :c:data:`psi_selectors` - * :c:data:`psi_selectors_coef_transp` - * :c:data:`pt2_e0_denominator` - * :c:data:`pt2_f` - * :c:data:`pt2_j` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_overlap` - * :c:data:`pt2_j` - * :c:data:`pt2_stoch_istate` - * :c:data:`pt2_u` - * :c:data:`pt2_w` - * :c:data:`qp_max_mem` - * :c:data:`s2_eig` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_generators` Called by: .. hlist:: :columns: 3 - * :c:func:`run_cipsi` - * :c:func:`run_stochastic_cipsi` + * :c:func:`select_singles_and_doubles` Calls: .. hlist:: :columns: 3 - * :c:func:`check_mem` - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_parallel_job` - * :c:func:`fill_h_apply_buffer_no_selection` - * :c:func:`make_selection_buffer_s2` - * :c:func:`new_parallel_job` - * :c:func:`omp_set_nested` - * :c:func:`pt2_collector` - * :c:func:`pt2_slave_inproc` - * :c:func:`remove_duplicates_in_selection_buffer` - * :c:func:`resident_memory` - * :c:func:`update_pt2_and_variance_weights` - * :c:func:`write_double` - * :c:func:`write_int` - * :c:func:`zmq_selection` - - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_match_weight` - * :c:data:`pt2_overlap` - * :c:data:`pt2_stoch_istate` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_davidson_pt2` - * :c:data:`variance_match_weight` + * :c:func:`bitstring_to_list_in_selection` -.. c:function:: zmq_selection: +.. c:function:: write_cipsi_json: - File : :file:`cipsi/zmq_selection.irp.f` + File : :file:`cipsi/write_cipsi_json.irp.f` .. code:: fortran - subroutine ZMQ_selection(N_in, pt2_data) + subroutine write_cipsi_json(pt2_data, pt2_data_err) + Writes JSON data for CIPSI runs Needs: .. hlist:: :columns: 3 - * :c:data:`do_pt2` - * :c:data:`elec_alpha_num` - * :c:data:`mo_num` + * :c:data:`energy_iterations` + * :c:data:`json_int_fmt` + * :c:data:`json_unit` * :c:data:`n_det` - * :c:data:`n_det_generators` - * :c:data:`n_det_selectors` - * :c:data:`n_int` + * :c:data:`n_iter` * :c:data:`n_states` - * :c:data:`nproc` - * :c:data:`pseudo_sym` - * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`psi_det_sorted` - * :c:data:`psi_selectors` - * :c:data:`pt2_e0_denominator` - * :c:data:`pt2_f` - * :c:data:`pt2_overlap` - * :c:data:`qp_max_mem` + * :c:data:`nsomomax` + * :c:data:`only_expected_s2` + * :c:data:`psi_configuration` + * :c:data:`psi_energy` + * :c:data:`psi_energy_with_nucl_rep` * :c:data:`s2_eig` - * :c:data:`selection_weight` - * :c:data:`state_average_weight` - * :c:data:`threshold_generators` Called by: @@ -3131,31 +1295,13 @@ Subroutines / functions :columns: 3 * :c:func:`run_cipsi` - * :c:func:`zmq_pt2` + * :c:func:`run_stochastic_cipsi` Calls: .. hlist:: :columns: 3 - * :c:func:`create_selection_buffer` - * :c:func:`delete_selection_buffer` - * :c:func:`end_parallel_job` - * :c:func:`fill_h_apply_buffer_no_selection` - * :c:func:`make_selection_buffer_s2` - * :c:func:`new_parallel_job` - * :c:func:`selection_collector` - * :c:func:`selection_slave_inproc` - * :c:func:`update_pt2_and_variance_weights` - * :c:func:`write_double` - - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_match_weight` - * :c:data:`pt2_overlap` - * :c:data:`threshold_davidson_pt2` - * :c:data:`variance_match_weight` + * :c:func:`lock_io` + * :c:func:`unlock_io` diff --git a/docs/source/modules/cis.rst b/docs/source/modules/cis.rst index 3c96a6c6..888e3371 100644 --- a/docs/source/modules/cis.rst +++ b/docs/source/modules/cis.rst @@ -119,15 +119,15 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`psi_occ_pattern` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_occ_pattern` .. c:function:: h_apply_cis_diexc: @@ -328,15 +328,15 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`psi_occ_pattern` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_occ_pattern` .. c:function:: h_apply_cis_sym_diexc: diff --git a/docs/source/modules/cisd.rst b/docs/source/modules/cisd.rst index b488f3ac..e0900eb8 100644 --- a/docs/source/modules/cisd.rst +++ b/docs/source/modules/cisd.rst @@ -53,15 +53,145 @@ EZFIO parameters Variational |CISD| energy +.. option:: lcc_energy + + lccsd energy + + Programs -------- * :ref:`cisd` + * :ref:`lccsd` + +Providers +--------- + +.. c:var:: lccsd_coef + + + File : :file:`lccsd_prov.irp.f` + + .. code:: fortran + + double precision, allocatable :: lccsd_coef (N_det,N_states) + double precision, allocatable :: lccsd_energies (N_states) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`big_array_coulomb_integrals` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`davidson_sze_max` + * :c:data:`disk_based_davidson` + * :c:data:`mo_integrals_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`n_states_diag` + * :c:data:`nproc` + * :c:data:`nthreads_davidson` + * :c:data:`psi_det` + * :c:data:`qp_max_mem` + * :c:data:`ref_bitmask` + * :c:data:`state_following` + * :c:data:`threshold_davidson` + + + +.. c:var:: lccsd_energies + + + File : :file:`lccsd_prov.irp.f` + + .. code:: fortran + + double precision, allocatable :: lccsd_coef (N_det,N_states) + double precision, allocatable :: lccsd_energies (N_states) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`big_array_coulomb_integrals` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`davidson_sze_max` + * :c:data:`disk_based_davidson` + * :c:data:`mo_integrals_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`n_states_diag` + * :c:data:`nproc` + * :c:data:`nthreads_davidson` + * :c:data:`psi_det` + * :c:data:`qp_max_mem` + * :c:data:`ref_bitmask` + * :c:data:`state_following` + * :c:data:`threshold_davidson` + + + Subroutines / functions ----------------------- +.. c:function:: get_lccsd_2: + + + File : :file:`lccsd.irp.f` + + .. code:: fortran + + subroutine get_lccsd_2 + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ha_to_ev` + * :c:data:`lccsd_coef` + * :c:data:`n_det` + * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`save_threshold` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`run` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ezfio_set_cisd_lcc_energy` + * :c:func:`save_wavefunction_truncated` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`psi_coef` + + .. c:function:: h_apply_cisd: @@ -99,6 +229,7 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`run` * :c:func:`run_cisd` Calls: @@ -119,15 +250,15 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`psi_occ_pattern` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_occ_pattern` .. c:function:: h_apply_cisd_diexc: @@ -315,6 +446,7 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`run` * :c:func:`run_cisd` Calls: @@ -335,15 +467,15 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`psi_occ_pattern` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_occ_pattern` .. c:function:: h_apply_cisd_sym_diexc: @@ -534,13 +666,13 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`psi_occ_pattern` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_occ_pattern` diff --git a/docs/source/modules/davidson.rst b/docs/source/modules/davidson.rst index 718458bd..e1ed4458 100644 --- a/docs/source/modules/davidson.rst +++ b/docs/source/modules/davidson.rst @@ -31,53 +31,23 @@ The important providers for that module are: EZFIO parameters ---------------- -.. option:: threshold_davidson +.. option:: csf_based - Thresholds of Davidson's algorithm - - Default: 1.e-10 - -.. option:: n_states_diag - - Number of states to consider during the Davdison diagonalization - - Default: 4 - -.. option:: davidson_sze_max - - Number of micro-iterations before re-contracting - - Default: 15 - -.. option:: state_following - - If |true|, the states are re-ordered to match the input states + If |true|, use the CSF-based algorithm Default: False -.. option:: disk_based_davidson - - If |true|, a memory-mapped file may be used to store the W and S2 vectors if not enough RAM is available - - Default: True - -.. option:: distributed_davidson - - If |true|, use the distributed algorithm - - Default: True - .. option:: only_expected_s2 If |true|, use filter out all vectors with bad |S^2| values Default: True -.. option:: n_det_max_full +.. option:: without_diagonal - Maximum number of determinants where |H| is fully diagonalized + If |true|, don't use denominator - Default: 1000 + Default: False Providers @@ -102,7 +72,9 @@ Providers .. hlist:: :columns: 3 + * :c:data:`csf_based` * :c:data:`diag_algorithm` + * :c:data:`distributed_davidson` * :c:data:`dressing_column_h` * :c:data:`expected_s2` * :c:data:`h_matrix_all_dets` @@ -111,12 +83,14 @@ Providers * :c:data:`n_int` * :c:data:`n_states` * :c:data:`n_states_diag` + * :c:data:`nsomomax` * :c:data:`nthreads_davidson` * :c:data:`only_expected_s2` * :c:data:`psi_coef` * :c:data:`psi_det` * :c:data:`s2_eig` * :c:data:`s2_matrix_all_dets` + * :c:data:`state_following` * :c:data:`threshold_davidson` Needed by: @@ -146,7 +120,9 @@ Providers .. hlist:: :columns: 3 + * :c:data:`csf_based` * :c:data:`diag_algorithm` + * :c:data:`distributed_davidson` * :c:data:`dressing_column_h` * :c:data:`expected_s2` * :c:data:`h_matrix_all_dets` @@ -155,12 +131,14 @@ Providers * :c:data:`n_int` * :c:data:`n_states` * :c:data:`n_states_diag` + * :c:data:`nsomomax` * :c:data:`nthreads_davidson` * :c:data:`only_expected_s2` * :c:data:`psi_coef` * :c:data:`psi_det` * :c:data:`s2_eig` * :c:data:`s2_matrix_all_dets` + * :c:data:`state_following` * :c:data:`threshold_davidson` Needed by: @@ -189,6 +167,7 @@ Providers :columns: 3 * :c:data:`ci_electronic_energy` + * :c:data:`distributed_davidson` * :c:data:`mpi_master` * :c:data:`n_det` * :c:data:`n_states` @@ -217,7 +196,9 @@ Providers .. hlist:: :columns: 3 + * :c:data:`csf_based` * :c:data:`diag_algorithm` + * :c:data:`distributed_davidson` * :c:data:`dressing_column_h` * :c:data:`expected_s2` * :c:data:`h_matrix_all_dets` @@ -226,12 +207,14 @@ Providers * :c:data:`n_int` * :c:data:`n_states` * :c:data:`n_states_diag` + * :c:data:`nsomomax` * :c:data:`nthreads_davidson` * :c:data:`only_expected_s2` * :c:data:`psi_coef` * :c:data:`psi_det` * :c:data:`s2_eig` * :c:data:`s2_matrix_all_dets` + * :c:data:`state_following` * :c:data:`threshold_davidson` Needed by: @@ -294,70 +277,64 @@ Providers -.. c:var:: n_states_diag +.. c:var:: overlap_states - File : :file:`davidson/input.irp.f` + File : :file:`davidson/overlap_states.irp.f` .. code:: fortran - integer :: n_states_diag + double precision, allocatable :: overlap_states (N_states,N_states) + double precision, allocatable :: overlap_states_inv (N_states,N_states) - Number of states to consider during the Davdison diagonalization + + S_kl = ck.T x cl + = psi_coef(:,k).T x psi_coef(:,l) + Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` - * :c:data:`mpi_master` + * :c:data:`n_det` * :c:data:`n_states` - * :c:data:`output_wall_time_0` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`psi_coef` - * :c:data:`ci_electronic_energy` - * :c:data:`ci_energy` - * :c:data:`psi_energy` -.. c:var:: nthreads_davidson +.. c:var:: overlap_states_inv - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/overlap_states.irp.f` .. code:: fortran - integer :: nthreads_davidson + double precision, allocatable :: overlap_states (N_states,N_states) + double precision, allocatable :: overlap_states_inv (N_states,N_states) - Number of threads for Davidson + + S_kl = ck.T x cl + = psi_coef(:,k).T x psi_coef(:,l) + Needs: .. hlist:: :columns: 3 - * :c:data:`mpi_master` - * :c:data:`nproc` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`n_det` + * :c:data:`n_states` + * :c:data:`psi_coef` - * :c:data:`ci_electronic_energy` .. c:var:: psi_energy - File : :file:`davidson/u0_h_u0.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f` .. code:: fortran @@ -391,7 +368,9 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ci_energy_no_diag` * :c:data:`psi_energy_with_nucl_rep` + * :c:data:`pt2_e0_denominator` .. c:var:: psi_energy_two_e @@ -420,10 +399,40 @@ Providers +.. c:var:: psi_energy_two_e_trans + + + File : :file:`davidson/u0_wee_u0.irp.f` + + .. code:: fortran + + double precision, allocatable :: psi_energy_two_e_trans (N_states,N_states) + + + psi_energy_two_e_trans(istate,jstate) = + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`big_array_coulomb_integrals` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`mo_integrals_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`psi_det` + * :c:data:`ref_bitmask_energy` + + + .. c:var:: psi_energy_with_nucl_rep - File : :file:`davidson/u0_h_u0.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f` .. code:: fortran @@ -446,7 +455,7 @@ Providers .. c:var:: psi_s2 - File : :file:`davidson/u0_h_u0.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f` .. code:: fortran @@ -480,28 +489,9 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ci_energy_no_diag` * :c:data:`psi_energy_with_nucl_rep` - - -.. c:var:: threshold_davidson_pt2 - - - File : :file:`davidson/diagonalization_hs2_dressed.irp.f` - - .. code:: fortran - - double precision :: threshold_davidson_pt2 - - - Threshold of Davidson's algorithm, using PT2 as a guide - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`threshold_davidson` - + * :c:data:`pt2_e0_denominator` @@ -542,174 +532,93 @@ Subroutines / functions * :c:func:`davidson_pull_results` -.. c:function:: davidson_diag_hjj_sjj: +.. c:function:: davidson_csf_collector: - File : :file:`davidson/diagonalization_hs2_dressed.irp.f` + File : :file:`davidson/davidson_parallel_csf.irp.f` .. code:: fortran - subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_st,N_st_diag_in,Nint,dressing_state,converged) + subroutine davidson_csf_collector(zmq_to_qp_run_socket, zmq_socket_pull, v0, sze, N_st) - Davidson diagonalization with specific diagonal elements of the H matrix - - H_jj : specific diagonal H matrix elements to diagonalize de Davidson - - S2_out : Output : s^2 - - dets_in : bitmasks corresponding to determinants - - u_in : guess coefficients on the various states. Overwritten - on exit - - dim_in : leftmost dimension of u_in - - sze : Number of determinants - - N_st : Number of eigenstates - - N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze - - Initial guess vectors are not necessarily orthonormal + Routine collecting the results of the workers in Davidson's algorithm. Needs: .. hlist:: :columns: 3 - * :c:data:`davidson_sze_max` - * :c:data:`disk_based_davidson` - * :c:data:`distributed_davidson` - * :c:data:`dressed_column_idx` - * :c:data:`dressing_column_h` - * :c:data:`expected_s2` - * :c:data:`ezfio_work_dir` * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`nproc` - * :c:data:`nthreads_davidson` - * :c:data:`nuclear_repulsion` - * :c:data:`only_expected_s2` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_order_reverse` - * :c:data:`psi_coef` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`qp_max_mem` - * :c:data:`s2_eig` - * :c:data:`state_following` - * :c:data:`threshold_davidson` - * :c:data:`threshold_davidson_from_pt2` - * :c:data:`threshold_davidson_pt2` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`davidson_diag_hs2` Calls: .. hlist:: :columns: 3 - * :c:func:`c_f_pointer` - * :c:func:`check_mem` - * :c:func:`dgemm` - * :c:func:`dswap` - * :c:func:`h_s2_u_0_nstates_openmp` - * :c:func:`h_s2_u_0_nstates_zmq` - * :c:func:`lapack_diag` - * :c:func:`mmap` - * :c:func:`munmap` - * :c:func:`normalize` - * :c:func:`nullify_small_elements` - * :c:func:`ortho_qr` - * :c:func:`ortho_qr_unblocked` - * :c:func:`random_number` - * :c:func:`resident_memory` - * :c:func:`sgemm` - * :c:func:`write_double` - * :c:func:`write_int` - * :c:func:`write_time` - - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`nthreads_davidson` + * :c:func:`davidson_csf_pull_results` -.. c:function:: davidson_diag_hs2: +.. c:function:: davidson_csf_pull_results: - File : :file:`davidson/diagonalization_hs2_dressed.irp.f` + File : :file:`davidson/davidson_parallel_csf.irp.f` .. code:: fortran - subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_diag,Nint,dressing_state,converged) + subroutine davidson_csf_pull_results(zmq_socket_pull, v_t, imin, imax, task_id) - Davidson diagonalization. - - dets_in : bitmasks corresponding to determinants - - u_in : guess coefficients on the various states. Overwritten - on exit - - dim_in : leftmost dimension of u_in - - sze : Number of determinants - - N_st : Number of eigenstates - - Initial guess vectors are not necessarily orthonormal + Pull the results of $H | U \rangle$ on the master. Needs: .. hlist:: :columns: 3 - * :c:data:`dressing_column_h` - * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_int` + * :c:data:`n_det` + * :c:data:`n_states_diag` Called by: .. hlist:: :columns: 3 - * :c:data:`ci_electronic_energy` + * :c:func:`davidson_csf_collector` - Calls: + +.. c:function:: davidson_csf_push_results: - .. hlist:: - :columns: 3 - * :c:func:`davidson_diag_hjj_sjj` + File : :file:`davidson/davidson_parallel_csf.irp.f` - Touches: + .. code:: fortran + + subroutine davidson_csf_push_results(zmq_socket_push, v_t, imin, imax, task_id) + + + Push the results of $H | U \rangle$ from a worker to the master. + + Needs: .. hlist:: :columns: 3 - * :c:data:`nthreads_davidson` + * :c:data:`n_det` + * :c:data:`n_states_diag` -.. c:function:: davidson_pull_results: +.. c:function:: davidson_csf_push_results_async_send: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/davidson_parallel_csf.irp.f` .. code:: fortran - subroutine davidson_pull_results(zmq_socket_pull, v_t, s_t, imin, imax, task_id) + subroutine davidson_csf_push_results_async_send(zmq_socket_push, v_t, imin, imax, task_id,sending) - Pull the results of $H | U \rangle$ on the master. + Push the results of $H | U \rangle$ from a worker to the master. Needs: @@ -724,20 +633,20 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`davidson_collector` + * :c:func:`davidson_csf_slave_work` -.. c:function:: davidson_push_results: +.. c:function:: davidson_csf_run_slave: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/davidson_parallel_csf.irp.f` .. code:: fortran - subroutine davidson_push_results(zmq_socket_push, v_t, s_t, imin, imax, task_id) + subroutine davidson_csf_run_slave(thread,iproc) - Push the results of $H | U \rangle$ from a worker to the master. + Slave routine for Davidson's diagonalization. Needs: @@ -747,46 +656,1294 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_states_diag` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_csf_slave_inproc` + * :c:func:`davidson_csf_slave_tcp` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_csf_slave_work` + * :c:func:`end_zmq_push_socket` + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`sleep` + -.. c:function:: davidson_push_results_async_recv: +.. c:function:: davidson_csf_slave_inproc: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/davidson_parallel_csf.irp.f` .. code:: fortran - subroutine davidson_push_results_async_recv(zmq_socket_push,sending) + subroutine davidson_csf_slave_inproc(i) - Push the results of $H | U \rangle$ from a worker to the master. - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`davidson_slave_work` + * :c:func:`davidson_csf_run_slave` -.. c:function:: davidson_push_results_async_send: +.. c:function:: davidson_csf_slave_tcp: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/davidson_parallel_csf.irp.f` .. code:: fortran - subroutine davidson_push_results_async_send(zmq_socket_push, v_t, s_t, imin, imax, task_id,sending) + subroutine davidson_csf_slave_tcp(i) - Push the results of $H | U \rangle$ from a worker to the master. - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`n_det` + * :c:func:`davidson_csf_run_slave` + + +.. c:function:: davidson_csf_slave_work: + + + File : :file:`davidson/davidson_parallel_csf.irp.f` + + .. code:: fortran + + subroutine davidson_csf_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, worker_id) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mpi_initialized` + * :c:data:`mpi_rank` + * :c:data:`n_det` + * :c:data:`n_states_diag` + * :c:data:`nproc` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`ref_bitmask_energy` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_csf_run_slave` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_csf_push_results_async_send` + * :c:func:`davidson_push_results_async_recv` + * :c:func:`h_u_0_nstates_openmp_work` + + +.. c:function:: davidson_diag_csf_hjj: + + + File : :file:`davidson/diagonalization_hcsf_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N_st,N_st_diag_in,Nint,dressing_state,converged) + + + Davidson diagonalization with specific diagonal elements of the H matrix + + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten + on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`davidson_sze_max` + * :c:data:`disk_based_davidson` + * :c:data:`distributed_davidson` + * :c:data:`dressed_column_idx` + * :c:data:`dressing_column_h` + * :c:data:`expected_s2` + * :c:data:`ezfio_work_dir` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`nproc` + * :c:data:`nthreads_davidson` + * :c:data:`nuclear_repulsion` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_coef` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`qp_max_mem` + * :c:data:`state_following` + * :c:data:`threshold_davidson` + * :c:data:`threshold_davidson_from_pt2` + * :c:data:`threshold_davidson_pt2` + * :c:data:`without_diagonal` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_h_csf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`c_f_pointer` + * :c:func:`check_mem` + * :c:func:`convertwffromcsftodet` + * :c:func:`convertwffromdettocsf` + * :c:func:`dgemm` + * :c:func:`dsygv` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_zmq` + * :c:func:`mmap` + * :c:func:`munmap` + * :c:func:`normalize` + * :c:func:`nullify_small_elements` + * :c:func:`random_number` + * :c:func:`resident_memory` + * :c:func:`write_double` + * :c:func:`write_int` + * :c:func:`write_time` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_h: + + + File : :file:`davidson/diagonalization_h_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_h(dets_in,u_in,dim_in,energies,sze,N_st,N_st_diag,Nint,dressing_state,converged) + + + Davidson diagonalization. + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten + on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + Initial guess vectors are not necessarily orthonormal + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`dressing_column_h` + * :c:data:`mo_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_hjj` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_h_csf: + + + File : :file:`davidson/diagonalization_hcsf_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_h_csf(dets_in,u_in,dim_in,energies,sze,sze_csf,N_st,N_st_diag,Nint,dressing_state,converged) + + + Davidson diagonalization. + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten + on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`dressing_column_h` + * :c:data:`mo_two_e_integrals_in_map` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ci_electronic_energy` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_csf_hjj` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_hjj: + + + File : :file:`davidson/diagonalization_h_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,Nint,dressing_state,converged) + + + Davidson diagonalization with specific diagonal elements of the H matrix + + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten + on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze + + Initial guess vectors are not necessarily orthonormal + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`davidson_sze_max` + * :c:data:`disk_based_davidson` + * :c:data:`distributed_davidson` + * :c:data:`dressed_column_idx` + * :c:data:`dressing_column_h` + * :c:data:`expected_s2` + * :c:data:`ezfio_work_dir` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`nproc` + * :c:data:`nthreads_davidson` + * :c:data:`nuclear_repulsion` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_coef` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`qp_max_mem` + * :c:data:`state_following` + * :c:data:`threshold_davidson` + * :c:data:`threshold_davidson_from_pt2` + * :c:data:`threshold_davidson_pt2` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_h` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`c_f_pointer` + * :c:func:`check_mem` + * :c:func:`dgemm` + * :c:func:`dsygv` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_zmq` + * :c:func:`mmap` + * :c:func:`munmap` + * :c:func:`normalize` + * :c:func:`nullify_small_elements` + * :c:func:`random_number` + * :c:func:`resident_memory` + * :c:func:`write_double` + * :c:func:`write_int` + * :c:func:`write_time` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_hjj_sjj: + + + File : :file:`davidson/diagonalization_hs2_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_st,N_st_diag_in,Nint,dressing_state,converged) + + + Davidson diagonalization with specific diagonal elements of the H matrix + + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + + S2_out : Output : s^2 + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten + on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze + + Initial guess vectors are not necessarily orthonormal + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`davidson_sze_max` + * :c:data:`disk_based_davidson` + * :c:data:`distributed_davidson` + * :c:data:`dressed_column_idx` + * :c:data:`dressing_column_h` + * :c:data:`expected_s2` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`nproc` + * :c:data:`nthreads_davidson` + * :c:data:`nuclear_repulsion` + * :c:data:`only_expected_s2` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_coef` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`qp_max_mem` + * :c:data:`state_following` + * :c:data:`threshold_davidson` + * :c:data:`threshold_davidson_from_pt2` + * :c:data:`threshold_davidson_pt2` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_hs2` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`check_mem` + * :c:func:`dgemm` + * :c:func:`dswap` + * :c:func:`dsygv` + * :c:func:`h_s2_u_0_nstates_openmp` + * :c:func:`h_s2_u_0_nstates_zmq` + * :c:func:`mmap_create_d` + * :c:func:`mmap_create_s` + * :c:func:`mmap_destroy` + * :c:func:`normalize` + * :c:func:`nullify_small_elements` + * :c:func:`random_number` + * :c:func:`resident_memory` + * :c:func:`sgemm` + * :c:func:`write_double` + * :c:func:`write_int` + * :c:func:`write_time` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_hs2: + + + File : :file:`davidson/diagonalization_hs2_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_diag,Nint,dressing_state,converged) + + + Davidson diagonalization. + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten + on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + Initial guess vectors are not necessarily orthonormal + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`dressing_column_h` + * :c:data:`mo_two_e_integrals_in_map` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ci_electronic_energy` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_hjj_sjj` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_nonsym_h: + + + File : :file:`davidson/diagonalization_nonsym_h_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_nonsym_h(dets_in, u_in, dim_in, energies, sze, N_st, N_st_diag, Nint, dressing_state, converged) + + + + non-sym Davidson diagonalization. + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + Initial guess vectors are not necessarily orthonormal + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`dressing_column_h` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`overlap_states` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_nonsym_hjj` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_diag_nonsym_hjj: + + + File : :file:`davidson/diagonalization_nonsym_h_dressed.irp.f` + + .. code:: fortran + + subroutine davidson_diag_nonsym_hjj(dets_in, u_in, H_jj, energies, dim_in, sze, N_st, N_st_diag_in, Nint, dressing_state, converged) + + + + non-sym Davidson diagonalization with specific diagonal elements of the H matrix + + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + + dets_in : bitmasks corresponding to determinants + + u_in : guess coefficients on the various states. Overwritten on exit + + dim_in : leftmost dimension of u_in + + sze : Number of determinants + + N_st : Number of eigenstates + + N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze + + Initial guess vectors are not necessarily orthonormal + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`davidson_sze_max` + * :c:data:`disk_based_davidson` + * :c:data:`distributed_davidson` + * :c:data:`dressing_column_h` + * :c:data:`expected_s2` + * :c:data:`ezfio_work_dir` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`nproc` + * :c:data:`nthreads_davidson` + * :c:data:`nuclear_repulsion` + * :c:data:`overlap_states` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_coef` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`qp_max_mem` + * :c:data:`state_following` + * :c:data:`threshold_davidson_from_pt2` + * :c:data:`threshold_davidson_pt2` + * :c:data:`threshold_nonsym_davidson` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_nonsym_h` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`c_f_pointer` + * :c:func:`check_mem` + * :c:func:`dgemm` + * :c:func:`diag_nonsym_right` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_zmq` + * :c:func:`mmap` + * :c:func:`munmap` + * :c:func:`normalize` + * :c:func:`nullify_small_elements` + * :c:func:`ortho_qr` + * :c:func:`random_number` + * :c:func:`resident_memory` + * :c:func:`write_double` + * :c:func:`write_int` + * :c:func:`write_time` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`nthreads_davidson` + + +.. c:function:: davidson_nos2_collector: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_collector(zmq_to_qp_run_socket, zmq_socket_pull, v0, sze, N_st) + + + Routine collecting the results of the workers in Davidson's algorithm. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`h_u_0_nstates_zmq` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_pull_results` + + +.. c:function:: davidson_nos2_pull_results: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_pull_results(zmq_socket_pull, v_t, imin, imax, task_id) + + + Pull the results of $H | U \rangle$ on the master. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_collector` + + +.. c:function:: davidson_nos2_push_results: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_push_results(zmq_socket_push, v_t, imin, imax, task_id) + + + Push the results of $H | U \rangle$ from a worker to the master. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + +.. c:function:: davidson_nos2_push_results_async_send: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_push_results_async_send(zmq_socket_push, v_t, imin, imax, task_id,sending) + + + Push the results of $H | U \rangle$ from a worker to the master. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_slave_work` + + +.. c:function:: davidson_nos2_run_slave: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_run_slave(thread,iproc) + + + Slave routine for Davidson's diagonalization. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_slave_inproc` + * :c:func:`davidson_nos2_slave_tcp` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_slave_work` + * :c:func:`end_zmq_push_socket` + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`sleep` + + +.. c:function:: davidson_nos2_slave_inproc: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_slave_inproc(i) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`h_u_0_nstates_zmq` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_run_slave` + + +.. c:function:: davidson_nos2_slave_tcp: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_slave_tcp(i) + + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_run_slave` + + +.. c:function:: davidson_nos2_slave_work: + + + File : :file:`davidson/davidson_parallel_nos2.irp.f` + + .. code:: fortran + + subroutine davidson_nos2_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, worker_id) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mpi_initialized` + * :c:data:`mpi_rank` + * :c:data:`n_det` + * :c:data:`n_states_diag` + * :c:data:`nproc` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`ref_bitmask_energy` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_run_slave` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_push_results_async_send` + * :c:func:`davidson_push_results_async_recv` + * :c:func:`h_u_0_nstates_openmp_work` + + +.. c:function:: davidson_pull_results: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_pull_results(zmq_socket_pull, v_t, s_t, imin, imax, task_id) + + + Pull the results of $H | U \rangle$ on the master. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_collector` + + +.. c:function:: davidson_push_results: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_push_results(zmq_socket_push, v_t, s_t, imin, imax, task_id) + + + Push the results of $H | U \rangle$ from a worker to the master. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + +.. c:function:: davidson_push_results_async_recv: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_push_results_async_recv(zmq_socket_push,sending) + + + Push the results of $H | U \rangle$ from a worker to the master. + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_csf_slave_work` + * :c:func:`davidson_nos2_slave_work` + * :c:func:`davidson_slave_work` + + +.. c:function:: davidson_push_results_async_send: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_push_results_async_send(zmq_socket_push, v_t, s_t, imin, imax, task_id,sending) + + + Push the results of $H | U \rangle$ from a worker to the master. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_slave_work` + + +.. c:function:: davidson_run_slave: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_run_slave(thread,iproc) + + + Slave routine for Davidson's diagonalization. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states_diag` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_slave_inproc` + * :c:func:`davidson_slave_tcp` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_slave_work` + * :c:func:`end_zmq_push_socket` + * :c:func:`end_zmq_to_qp_run_socket` + * :c:func:`sleep` + + +.. c:function:: davidson_slave_inproc: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_slave_inproc(i) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`h_s2_u_0_nstates_zmq` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_run_slave` + + +.. c:function:: davidson_slave_tcp: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_slave_tcp(i) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`run_slave_main` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_run_slave` + + +.. c:function:: davidson_slave_work: + + + File : :file:`davidson/davidson_parallel.irp.f` + + .. code:: fortran + + subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, worker_id) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mpi_initialized` + * :c:data:`mpi_rank` + * :c:data:`n_det` * :c:data:`n_states_diag` + * :c:data:`nproc` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`ref_bitmask_energy` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_run_slave` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_push_results_async_recv` + * :c:func:`davidson_push_results_async_send` + * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`lock_io` + * :c:func:`unlock_io` + + +.. c:function:: diagonalize_ci: + + + File : :file:`davidson/diagonalize_ci.irp.f` + + .. code:: fortran + + subroutine diagonalize_CI + + + Replace the coefficients of the |CI| states by the coefficients of the + eigenstates of the |CI| matrix. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ci_electronic_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`ci_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`distributed_davidson` + * :c:data:`n_det` + * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`psi_energy` + * :c:data:`psi_energy` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`remove_small_contributions` + * :c:func:`run_cipsi` + * :c:func:`run_orb_opt_trust_v2` + * :c:func:`run_stochastic_cipsi` + * :c:func:`update_parameters` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`ci_electronic_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`ci_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`psi_coef` + * :c:data:`psi_energy` + * :c:data:`psi_energy` + + +.. c:function:: h_s2_u_0_nstates_openmp: + + + File : :file:`davidson/u0_hs2_u0.irp.f` + + .. code:: fortran + + subroutine H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) + + + Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$. + + Assumes that the determinants are in psi_det + + istart, iend, ishift, istep are used in ZMQ parallelization. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_bilinear_matrix_values` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`u_0_hs2_u_0` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dset_order` + * :c:func:`dtranspose` + * :c:func:`h_s2_u_0_nstates_openmp_work` + + +.. c:function:: h_s2_u_0_nstates_openmp_work: + + + File : :file:`davidson/u0_hs2_u0.irp.f` + + .. code:: fortran + + subroutine H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + + + Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ + + Default should be 1,N_det,0,1 + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`ref_bitmask_energy` Called by: @@ -794,19 +1951,87 @@ Subroutines / functions :columns: 3 * :c:func:`davidson_slave_work` + * :c:func:`h_s2_u_0_nstates_openmp` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`h_s2_u_0_nstates_openmp_work_1` + * :c:func:`h_s2_u_0_nstates_openmp_work_2` + * :c:func:`h_s2_u_0_nstates_openmp_work_3` + * :c:func:`h_s2_u_0_nstates_openmp_work_4` + * :c:func:`h_s2_u_0_nstates_openmp_work_n_int` + + +.. c:function:: h_s2_u_0_nstates_openmp_work_1: + + + File : :file:`davidson/u0_hs2_u0.irp.f_template_807` + + .. code:: fortran + + subroutine H_S2_u_0_nstates_openmp_work_1(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + + + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + + Default should be 1,N_det,0,1 + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`nthreads_davidson` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`h_s2_u_0_nstates_openmp_work` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`get_all_spin_singles_1` + * :c:func:`get_all_spin_singles_and_doubles_1` + * :c:func:`get_s2` + * :c:func:`i_h_j_double_alpha_beta` + * :c:func:`i_h_j_double_spin` + * :c:func:`i_h_j_single_spin` -.. c:function:: davidson_run_slave: +.. c:function:: h_s2_u_0_nstates_openmp_work_2: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f_template_807` .. code:: fortran - subroutine davidson_run_slave(thread,iproc) + subroutine H_S2_u_0_nstates_openmp_work_2(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Slave routine for Davidson's diagonalization. + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + + Default should be 1,N_det,0,1 Needs: @@ -814,184 +2039,236 @@ Subroutines / functions :columns: 3 * :c:data:`n_det` - * :c:data:`n_states_diag` + * :c:data:`n_int` + * :c:data:`nthreads_davidson` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`davidson_slave_inproc` - * :c:func:`davidson_slave_tcp` + * :c:func:`h_s2_u_0_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`davidson_slave_work` - * :c:func:`end_zmq_push_socket` - * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`sleep` + * :c:func:`get_all_spin_singles_2` + * :c:func:`get_all_spin_singles_and_doubles_2` + * :c:func:`get_s2` + * :c:func:`i_h_j_double_alpha_beta` + * :c:func:`i_h_j_double_spin` + * :c:func:`i_h_j_single_spin` -.. c:function:: davidson_slave_inproc: +.. c:function:: h_s2_u_0_nstates_openmp_work_3: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f_template_807` .. code:: fortran - subroutine davidson_slave_inproc(i) + subroutine H_S2_u_0_nstates_openmp_work_3(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + + Default should be 1,N_det,0,1 - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_zmq` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`nthreads_davidson` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` - Calls: + Called by: .. hlist:: :columns: 3 - * :c:func:`davidson_run_slave` - - -.. c:function:: davidson_slave_tcp: - - - File : :file:`davidson/davidson_parallel.irp.f` - - .. code:: fortran - - subroutine davidson_slave_tcp(i) - - + * :c:func:`h_s2_u_0_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`davidson_run_slave` + * :c:func:`get_all_spin_singles_3` + * :c:func:`get_all_spin_singles_and_doubles_3` + * :c:func:`get_s2` + * :c:func:`i_h_j_double_alpha_beta` + * :c:func:`i_h_j_double_spin` + * :c:func:`i_h_j_single_spin` -.. c:function:: davidson_slave_work: +.. c:function:: h_s2_u_0_nstates_openmp_work_4: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f_template_807` .. code:: fortran - subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze, worker_id) + subroutine H_S2_u_0_nstates_openmp_work_4(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + + Default should be 1,N_det,0,1 Needs: .. hlist:: :columns: 3 - * :c:data:`mpi_initialized` - * :c:data:`mpi_rank` * :c:data:`n_det` - * :c:data:`n_states_diag` - * :c:data:`nproc` + * :c:data:`n_int` + * :c:data:`nthreads_davidson` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` - * :c:data:`ref_bitmask_energy` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`davidson_run_slave` + * :c:func:`h_s2_u_0_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`davidson_push_results_async_recv` - * :c:func:`davidson_push_results_async_send` - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`get_all_spin_singles_4` + * :c:func:`get_all_spin_singles_and_doubles_4` + * :c:func:`get_s2` + * :c:func:`i_h_j_double_alpha_beta` + * :c:func:`i_h_j_double_spin` + * :c:func:`i_h_j_single_spin` -.. c:function:: diagonalize_ci: +.. c:function:: h_s2_u_0_nstates_openmp_work_n_int: - File : :file:`davidson/diagonalize_ci.irp.f` + File : :file:`davidson/u0_hs2_u0.irp.f_template_807` .. code:: fortran - subroutine diagonalize_CI + subroutine H_S2_u_0_nstates_openmp_work_N_int(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Replace the coefficients of the |CI| states by the coefficients of the - eigenstates of the |CI| matrix. + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + + Default should be 1,N_det,0,1 Needs: .. hlist:: :columns: 3 - * :c:data:`ci_electronic_energy` - * :c:data:`ci_electronic_energy` - * :c:data:`ci_energy` - * :c:data:`ci_electronic_energy` * :c:data:`n_det` - * :c:data:`n_states` - * :c:data:`psi_coef` - * :c:data:`psi_energy` - * :c:data:`psi_energy` + * :c:data:`n_int` + * :c:data:`nthreads_davidson` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` - Touches: + Called by: .. hlist:: :columns: 3 - * :c:data:`ci_electronic_energy` - * :c:data:`ci_electronic_energy` - * :c:data:`ci_energy` - * :c:data:`ci_electronic_energy` - * :c:data:`psi_coef` - * :c:data:`psi_energy` - * :c:data:`psi_energy` + * :c:func:`h_s2_u_0_nstates_openmp_work` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`get_all_spin_singles_and_doubles_n_int` + * :c:func:`get_all_spin_singles_n_int` + * :c:func:`get_s2` + * :c:func:`i_h_j_double_alpha_beta` + * :c:func:`i_h_j_double_spin` + * :c:func:`i_h_j_single_spin` -.. c:function:: h_s2_u_0_nstates_openmp: +.. c:function:: h_s2_u_0_nstates_zmq: - File : :file:`davidson/u0_h_u0.irp.f` + File : :file:`davidson/davidson_parallel.irp.f` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) + subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) - Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$. + Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ - Assumes that the determinants are in psi_det + n : number of determinants - istart, iend, ishift, istep are used in ZMQ parallelization. + H_jj : array of $\langle j | H | j \rangle$ + + S2_jj : array of $\langle j | S^2 | j \rangle$ Needs: .. hlist:: :columns: 3 + * :c:data:`mpi_initialized` * :c:data:`n_det` + * :c:data:`nproc` + * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`ref_bitmask_energy` Called by: @@ -999,31 +2276,37 @@ Subroutines / functions :columns: 3 * :c:func:`davidson_diag_hjj_sjj` - * :c:func:`u_0_h_u_0` + * :c:func:`u_0_hs2_u_0` Calls: .. hlist:: :columns: 3 + * :c:func:`davidson_collector` + * :c:func:`davidson_slave_inproc` * :c:func:`dset_order` * :c:func:`dtranspose` - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`end_parallel_job` + * :c:func:`new_parallel_job` + * :c:func:`set_multiple_levels_omp` -.. c:function:: h_s2_u_0_nstates_openmp_work: +.. c:function:: h_s2_u_0_two_e_nstates_openmp: - File : :file:`davidson/u0_h_u0.irp.f` + File : :file:`davidson/u0_wee_u0.irp.f` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_S2_u_0_two_e_nstates_openmp(v_0,s_0,u_0,N_st,sze) - Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ - Default should be 1,N_det,0,1 + Assumes that the determinants are in psi_det + + istart, iend, ishift, istep are used in ZMQ parallelization. Needs: @@ -1031,40 +2314,37 @@ Subroutines / functions :columns: 3 * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`ref_bitmask_energy` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_bilinear_matrix_values` Called by: .. hlist:: :columns: 3 - * :c:func:`davidson_slave_work` - * :c:func:`h_s2_u_0_nstates_openmp` + * :c:func:`u_0_h_u_0_two_e` Calls: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp_work_1` - * :c:func:`h_s2_u_0_nstates_openmp_work_2` - * :c:func:`h_s2_u_0_nstates_openmp_work_3` - * :c:func:`h_s2_u_0_nstates_openmp_work_4` - * :c:func:`h_s2_u_0_nstates_openmp_work_n_int` + * :c:func:`dset_order` + * :c:func:`dtranspose` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` -.. c:function:: h_s2_u_0_nstates_openmp_work_1: +.. c:function:: h_s2_u_0_two_e_nstates_openmp_work: - File : :file:`davidson/u0_h_u0.irp.f_template_708` + File : :file:`davidson/u0_wee_u0.irp.f` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp_work_1(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_S2_u_0_two_e_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1075,48 +2355,38 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_int` - * :c:data:`nthreads_davidson` - * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_order_transp_reverse` - * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`singles_beta_csc` - * :c:data:`singles_beta_csc_idx` + * :c:data:`ref_bitmask_energy` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`h_s2_u_0_two_e_nstates_openmp` Calls: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_singles_1` - * :c:func:`get_all_spin_singles_and_doubles_1` - * :c:func:`get_s2` - * :c:func:`i_h_j_double_alpha_beta` - * :c:func:`i_h_j_double_spin` - * :c:func:`i_h_j_single_spin` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_1` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_2` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` -.. c:function:: h_s2_u_0_nstates_openmp_work_2: +.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_1: - File : :file:`davidson/u0_h_u0.irp.f_template_708` + File : :file:`davidson/u0_wee_u0.irp.f_template_457` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp_work_2(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_S2_u_0_two_e_nstates_openmp_work_1(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1135,40 +2405,38 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` - * :c:data:`singles_beta_csc` - * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_singles_2` - * :c:func:`get_all_spin_singles_and_doubles_2` + * :c:func:`get_all_spin_singles_1` + * :c:func:`get_all_spin_singles_and_doubles_1` * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_h_j_single_spin` + * :c:func:`i_wee_j_single` -.. c:function:: h_s2_u_0_nstates_openmp_work_3: +.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_2: - File : :file:`davidson/u0_h_u0.irp.f_template_708` + File : :file:`davidson/u0_wee_u0.irp.f_template_457` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp_work_3(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_S2_u_0_two_e_nstates_openmp_work_2(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1187,40 +2455,38 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` - * :c:data:`singles_beta_csc` - * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_singles_3` - * :c:func:`get_all_spin_singles_and_doubles_3` + * :c:func:`get_all_spin_singles_2` + * :c:func:`get_all_spin_singles_and_doubles_2` * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_h_j_single_spin` + * :c:func:`i_wee_j_single` -.. c:function:: h_s2_u_0_nstates_openmp_work_4: +.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_3: - File : :file:`davidson/u0_h_u0.irp.f_template_708` + File : :file:`davidson/u0_wee_u0.irp.f_template_457` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp_work_4(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_S2_u_0_two_e_nstates_openmp_work_3(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1239,40 +2505,38 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` - * :c:data:`singles_beta_csc` - * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_singles_4` - * :c:func:`get_all_spin_singles_and_doubles_4` + * :c:func:`get_all_spin_singles_3` + * :c:func:`get_all_spin_singles_and_doubles_3` * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_h_j_single_spin` + * :c:func:`i_wee_j_single` -.. c:function:: h_s2_u_0_nstates_openmp_work_n_int: +.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_4: - File : :file:`davidson/u0_h_u0.irp.f_template_708` + File : :file:`davidson/u0_wee_u0.irp.f_template_457` .. code:: fortran - subroutine H_S2_u_0_nstates_openmp_work_N_int(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_S2_u_0_two_e_nstates_openmp_work_4(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1291,98 +2555,88 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` - * :c:data:`singles_beta_csc` - * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp_work` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_singles_and_doubles_n_int` - * :c:func:`get_all_spin_singles_n_int` + * :c:func:`get_all_spin_singles_4` + * :c:func:`get_all_spin_singles_and_doubles_4` * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_h_j_single_spin` + * :c:func:`i_wee_j_single` -.. c:function:: h_s2_u_0_nstates_zmq: +.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_n_int: - File : :file:`davidson/davidson_parallel.irp.f` + File : :file:`davidson/u0_wee_u0.irp.f_template_457` .. code:: fortran - subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze) + subroutine H_S2_u_0_two_e_nstates_openmp_work_N_int(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ - - n : number of determinants - - H_jj : array of $\langle j | H | j \rangle$ + Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ - S2_jj : array of $\langle j | S^2 | j \rangle$ + Default should be 1,N_det,0,1 Needs: .. hlist:: :columns: 3 - * :c:data:`mpi_initialized` * :c:data:`n_det` - * :c:data:`n_states_diag` - * :c:data:`nproc` + * :c:data:`n_int` + * :c:data:`nthreads_davidson` * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_order_reverse` * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_rows_loc` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` - * :c:data:`ref_bitmask_energy` Called by: .. hlist:: :columns: 3 - * :c:func:`davidson_diag_hjj_sjj` - * :c:func:`u_0_h_u_0` + * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` Calls: .. hlist:: :columns: 3 - * :c:func:`davidson_collector` - * :c:func:`davidson_slave_inproc` - * :c:func:`dset_order` - * :c:func:`dtranspose` - * :c:func:`end_parallel_job` - * :c:func:`new_parallel_job` - * :c:func:`omp_set_nested` + * :c:func:`get_all_spin_singles_and_doubles_n_int` + * :c:func:`get_all_spin_singles_n_int` + * :c:func:`get_s2` + * :c:func:`i_h_j_double_alpha_beta` + * :c:func:`i_h_j_double_spin` + * :c:func:`i_wee_j_single` -.. c:function:: h_s2_u_0_two_e_nstates_openmp: +.. c:function:: h_u_0_nstates_openmp: - File : :file:`davidson/u0_wee_u0.irp.f` + File : :file:`davidson/u0_h_u0.irp.f` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp(v_0,s_0,u_0,N_st,sze) + subroutine H_u_0_nstates_openmp(v_0,u_0,N_st,sze) - Computes $v_0 = H | u_0\rangle$ and $s_0 = S^2 | u_0\rangle$ + Computes $v_0 = H | u_0\rangle$. Assumes that the determinants are in psi_det @@ -1402,7 +2656,10 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`u_0_h_u_0_two_e` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`u_0_h_u_0` Calls: @@ -1411,20 +2668,20 @@ Subroutines / functions * :c:func:`dset_order` * :c:func:`dtranspose` - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work` -.. c:function:: h_s2_u_0_two_e_nstates_openmp_work: +.. c:function:: h_u_0_nstates_openmp_work: - File : :file:`davidson/u0_wee_u0.irp.f` + File : :file:`davidson/u0_h_u0.irp.f` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_u_0_nstates_openmp_work(v_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t\rangle$ and $s_t = S^2 | u_t\rangle$ + Computes $v_t = H | u_t\rangle$ Default should be 1,N_det,0,1 @@ -1442,31 +2699,33 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp` + * :c:func:`davidson_csf_slave_work` + * :c:func:`davidson_nos2_slave_work` + * :c:func:`h_u_0_nstates_openmp` Calls: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_1` - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_2` - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_n_int` -.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_1: +.. c:function:: h_u_0_nstates_openmp_work_1: - File : :file:`davidson/u0_wee_u0.irp.f_template_457` + File : :file:`davidson/u0_h_u0.irp.f_template_757` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp_work_1(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_u_0_nstates_openmp_work_1(v_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ + Computes $v_t = H | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1485,13 +2744,17 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work` Calls: @@ -1500,23 +2763,22 @@ Subroutines / functions * :c:func:`get_all_spin_singles_1` * :c:func:`get_all_spin_singles_and_doubles_1` - * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_wee_j_single` + * :c:func:`i_h_j_single_spin` -.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_2: +.. c:function:: h_u_0_nstates_openmp_work_2: - File : :file:`davidson/u0_wee_u0.irp.f_template_457` + File : :file:`davidson/u0_h_u0.irp.f_template_757` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp_work_2(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_u_0_nstates_openmp_work_2(v_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ + Computes $v_t = H | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1535,13 +2797,17 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work` Calls: @@ -1550,23 +2816,22 @@ Subroutines / functions * :c:func:`get_all_spin_singles_2` * :c:func:`get_all_spin_singles_and_doubles_2` - * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_wee_j_single` + * :c:func:`i_h_j_single_spin` -.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_3: +.. c:function:: h_u_0_nstates_openmp_work_3: - File : :file:`davidson/u0_wee_u0.irp.f_template_457` + File : :file:`davidson/u0_h_u0.irp.f_template_757` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp_work_3(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_u_0_nstates_openmp_work_3(v_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ + Computes $v_t = H | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1585,13 +2850,17 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work` Calls: @@ -1600,23 +2869,22 @@ Subroutines / functions * :c:func:`get_all_spin_singles_3` * :c:func:`get_all_spin_singles_and_doubles_3` - * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_wee_j_single` + * :c:func:`i_h_j_single_spin` -.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_4: +.. c:function:: h_u_0_nstates_openmp_work_4: - File : :file:`davidson/u0_wee_u0.irp.f_template_457` + File : :file:`davidson/u0_h_u0.irp.f_template_757` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp_work_4(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_u_0_nstates_openmp_work_4(v_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ + Computes $v_t = H | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1635,13 +2903,17 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work` Calls: @@ -1650,23 +2922,22 @@ Subroutines / functions * :c:func:`get_all_spin_singles_4` * :c:func:`get_all_spin_singles_and_doubles_4` - * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_wee_j_single` + * :c:func:`i_h_j_single_spin` -.. c:function:: h_s2_u_0_two_e_nstates_openmp_work_n_int: +.. c:function:: h_u_0_nstates_openmp_work_n_int: - File : :file:`davidson/u0_wee_u0.irp.f_template_457` + File : :file:`davidson/u0_h_u0.irp.f_template_757` .. code:: fortran - subroutine H_S2_u_0_two_e_nstates_openmp_work_N_int(v_t,s_t,u_t,N_st,sze,istart,iend,ishift,istep) + subroutine H_u_0_nstates_openmp_work_N_int(v_t,u_t,N_st,sze,istart,iend,ishift,istep) - Computes $v_t = H | u_t \rangle$ and $s_t = S^2 | u_t \rangle$ + Computes $v_t = H | u_t \rangle$ Default should be 1,N_det,0,1 @@ -1685,13 +2956,17 @@ Subroutines / functions * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` + * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_idx` Called by: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_two_e_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work` Calls: @@ -1700,37 +2975,66 @@ Subroutines / functions * :c:func:`get_all_spin_singles_and_doubles_n_int` * :c:func:`get_all_spin_singles_n_int` - * :c:func:`get_s2` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` - * :c:func:`i_wee_j_single` + * :c:func:`i_h_j_single_spin` -.. c:function:: print_energy_components: +.. c:function:: h_u_0_nstates_zmq: - File : :file:`davidson/print_e_components.irp.f` + File : :file:`davidson/davidson_parallel_nos2.irp.f` .. code:: fortran - subroutine print_energy_components() + subroutine H_u_0_nstates_zmq(v_0,u_0,N_st,sze) - Prints the different components of the energy. + Computes $v_0 = H | u_0\rangle$ + + n : number of determinants + + H_jj : array of $\langle j | H | j \rangle$ Needs: .. hlist:: :columns: 3 - * :c:data:`mo_integrals_n_e` - * :c:data:`mo_kinetic_integrals` - * :c:data:`mo_num` - * :c:data:`mo_pseudo_integrals` - * :c:data:`n_states` - * :c:data:`nuclear_repulsion` - * :c:data:`one_e_dm_mo_alpha` - * :c:data:`psi_energy` + * :c:data:`mpi_initialized` + * :c:data:`n_det` + * :c:data:`nproc` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`psi_bilinear_matrix_order_transp_reverse` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`ref_bitmask_energy` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`u_0_h_u_0` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_nos2_collector` + * :c:func:`davidson_nos2_slave_inproc` + * :c:func:`dset_order` + * :c:func:`dtranspose` + * :c:func:`end_parallel_job` + * :c:func:`new_parallel_job` + * :c:func:`set_multiple_levels_omp` .. c:function:: u_0_h_u_0: @@ -1740,13 +3044,11 @@ Subroutines / functions .. code:: fortran - subroutine u_0_H_u_0(e_0,s_0,u_0,n,keys_tmp,Nint,N_st,sze) + subroutine u_0_H_u_0(e_0,u_0,n,keys_tmp,Nint,N_st,sze) Computes $E_0 = \frac{\langle u_0 | H | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ - and $S_0 = \frac{\langle u_0 | S^2 | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ - n : number of determinants @@ -1759,22 +3061,14 @@ Subroutines / functions * :c:data:`h_matrix_all_dets` * :c:data:`n_det_max_full` * :c:data:`n_states_diag` - * :c:data:`s2_matrix_all_dets` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:data:`psi_energy` Calls: .. hlist:: :columns: 3 - * :c:func:`h_s2_u_0_nstates_openmp` - * :c:func:`h_s2_u_0_nstates_zmq` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_zmq` .. c:function:: u_0_h_u_0_two_e: @@ -1807,6 +3101,50 @@ Subroutines / functions * :c:func:`h_s2_u_0_two_e_nstates_openmp` +.. c:function:: u_0_hs2_u_0: + + + File : :file:`davidson/u0_hs2_u0.irp.f` + + .. code:: fortran + + subroutine u_0_HS2_u_0(e_0,s_0,u_0,n,keys_tmp,Nint,N_st,sze) + + + Computes $E_0 = \frac{\langle u_0 | H | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ + + and $S_0 = \frac{\langle u_0 | S^2 | u_0 \rangle}{\langle u_0 | u_0 \rangle}$ + + n : number of determinants + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`distributed_davidson` + * :c:data:`h_matrix_all_dets` + * :c:data:`n_det_max_full` + * :c:data:`n_states_diag` + * :c:data:`s2_matrix_all_dets` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`psi_energy` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`h_s2_u_0_nstates_openmp` + * :c:func:`h_s2_u_0_nstates_zmq` + + .. c:function:: zmq_get_n_states_diag: diff --git a/docs/source/modules/davidson_undressed.rst b/docs/source/modules/davidson_undressed.rst index 326f48d9..db8bdac3 100644 --- a/docs/source/modules/davidson_undressed.rst +++ b/docs/source/modules/davidson_undressed.rst @@ -25,6 +25,7 @@ Providers double precision, allocatable :: dressing_column_h (N_det,N_states) double precision, allocatable :: dressing_column_s (N_det,N_states) + double precision, allocatable :: dressing_delta (N_det,N_states) Null dressing vectors @@ -54,6 +55,37 @@ Providers double precision, allocatable :: dressing_column_h (N_det,N_states) double precision, allocatable :: dressing_column_s (N_det,N_states) + double precision, allocatable :: dressing_delta (N_det,N_states) + + + Null dressing vectors + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ci_electronic_energy` + + +.. c:var:: dressing_delta + + + File : :file:`davidson_undressed/null_dressing_vector.irp.f` + + .. code:: fortran + + double precision, allocatable :: dressing_column_h (N_det,N_states) + double precision, allocatable :: dressing_column_s (N_det,N_states) + double precision, allocatable :: dressing_delta (N_det,N_states) Null dressing vectors diff --git a/docs/source/modules/density_for_dft.rst b/docs/source/modules/density_for_dft.rst index 3520c86a..33ae10fb 100644 --- a/docs/source/modules/density_for_dft.rst +++ b/docs/source/modules/density_for_dft.rst @@ -40,13 +40,13 @@ EZFIO parameters .. option:: no_core_density - if [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero + If [no_core_density] then all elements of the density matrix involving at least one orbital set as core are set to zero. The default is False in order to take all the density. - Default: full_density + Default: False .. option:: normalize_dm - if .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb + Type of density. If .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb Default: True diff --git a/docs/source/modules/determinants.rst b/docs/source/modules/determinants.rst index cd548bd8..fa305964 100644 --- a/docs/source/modules/determinants.rst +++ b/docs/source/modules/determinants.rst @@ -19,7 +19,7 @@ The main providers for this module are: The main routines for this module are: * :c:func:`i_H_j`: computes the Hamiltonian matrix element between two arbitrary Slater determinants. -* :c:func:`i_H_j_s2`: computes the Hamiltonian and (|S^2|) matrix element between two arbitrary Slater determinants. +* :c:function:`i_h_j_s2`: computes the Hamiltonian and (|S^2|) matrix element between two arbitrary Slater determinants. * :c:func:`i_H_j_verbose`: returns the decomposition in terms of one- and two-body components of the Hamiltonian matrix elements between two arbitrary Slater determinants. Also return the fermionic phase factor. * :c:func:`i_H_psi`: computes the Hamiltonian matrix element between an arbitrary Slater determinant and a wave function composed of a sum of arbitrary Slater determinants. @@ -75,9 +75,9 @@ EZFIO parameters .. option:: weight_selection - Weight used in the selection. 0: input state-average weight, 1: 1./(c_0^2), 2: rPT2 matching, 3: variance matching, 4: variance and rPT2 matching, 5: variance minimization and matching, 6: CI coefficients + Weight used in the selection. 0: input state-average weight, 1: 1./(c_0^2), 2: PT2 matching, 3: variance matching, 4: variance and PT2 matching, 5: variance minimization and matching, 6: CI coefficients 7: input state-average multiplied by variance and PT2 matching 8: input state-average multiplied by PT2 matching 9: input state-average multiplied by variance matching - Default: 2 + Default: 1 .. option:: threshold_generators @@ -164,6 +164,12 @@ EZFIO parameters Default: False +.. option:: save_threshold + + Cut-off to apply to the CI coefficients when the wave function is stored + + Default: 1.e-14 + Providers --------- @@ -220,6 +226,56 @@ Providers +.. c:var:: attachment_numbers_sorted + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: attachment_numbers_sorted (mo_num,N_states) + double precision, allocatable :: dettachment_numbers_sorted (mo_num,N_states) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_num` + * :c:data:`n_attachment` + * :c:data:`n_states` + + + +.. c:var:: attachment_orbitals + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: attachment_orbitals (ao_num,mo_num,N_states) + double precision, allocatable :: dettachment_orbitals (ao_num,mo_num,N_states) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_coef` + * :c:data:`mo_num` + * :c:data:`n_attachment` + * :c:data:`n_states` + + + .. c:var:: barycentric_electronic_energy @@ -242,6 +298,12 @@ Providers * :c:data:`n_states` * :c:data:`psi_coef` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_e0_denominator` .. c:var:: c0_weight @@ -269,6 +331,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`selection_weight` * :c:data:`state_average_weight` @@ -330,38 +393,54 @@ Providers -.. c:var:: det_to_occ_pattern +.. c:var:: dettachment_numbers_sorted - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/density_matrix.irp.f` .. code:: fortran - integer, allocatable :: det_to_occ_pattern (N_det) + double precision, allocatable :: attachment_numbers_sorted (mo_num,N_states) + double precision, allocatable :: dettachment_numbers_sorted (mo_num,N_states) - Returns the index of the occupation pattern for each determinant Needs: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`psi_det` - * :c:data:`psi_occ_pattern` + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_num` + * :c:data:`n_attachment` + * :c:data:`n_states` + + + +.. c:var:: dettachment_orbitals + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: attachment_orbitals (ao_num,mo_num,N_states) + double precision, allocatable :: dettachment_orbitals (ao_num,mo_num,N_states) + - Needed by: + + Needs: .. hlist:: :columns: 3 - * :c:data:`pruned` - * :c:data:`psi_occ_pattern_hii` - * :c:data:`weight_occ_pattern` - * :c:data:`weight_occ_pattern_average` + * :c:data:`ao_num` + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_coef` + * :c:data:`mo_num` + * :c:data:`n_attachment` + * :c:data:`n_states` + .. c:var:: diagonal_h_matrix_on_psi_det @@ -381,8 +460,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`elec_num` * :c:data:`n_det` * :c:data:`n_int` @@ -398,6 +475,128 @@ Providers * :c:data:`barycentric_electronic_energy` +.. c:var:: difference_dm + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: difference_dm (mo_num,mo_num,N_states) + + + difference_dm(i,j,istate) = dm(i,j,1) - dm(i,j,istate) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_mo_alpha` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`difference_dm_eigvect` + + +.. c:var:: difference_dm_eigval + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: difference_dm_eigvect (mo_num,mo_num,N_states) + double precision, allocatable :: difference_dm_eigval (mo_num,N_states) + + + eigenvalues and eigevenctors of the difference_dm + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`difference_dm` + * :c:data:`mo_num` + * :c:data:`n_states` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` + * :c:data:`n_attachment` + + +.. c:var:: difference_dm_eigvect + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: difference_dm_eigvect (mo_num,mo_num,N_states) + double precision, allocatable :: difference_dm_eigval (mo_num,N_states) + + + eigenvalues and eigevenctors of the difference_dm + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`difference_dm` + * :c:data:`mo_num` + * :c:data:`n_states` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` + * :c:data:`n_attachment` + + +.. c:var:: dominant_det + + + File : :file:`determinants/determinants.irp.f` + + .. code:: fortran + + integer, allocatable :: dominant_det (N_states) + + + Determinant with the largest weight, for each state + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states` + * :c:data:`psi_coef` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`dominant_cfg` + + .. c:var:: double_exc_bitmask @@ -473,7 +672,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` * :c:data:`full_ijkl_bitmask` + * :c:data:`mo_integrals_cache_min` * :c:data:`mo_integrals_map` * :c:data:`mo_num` * :c:data:`mo_one_e_integrals` @@ -499,7 +702,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` * :c:data:`full_ijkl_bitmask` + * :c:data:`mo_integrals_cache_min` * :c:data:`mo_integrals_map` * :c:data:`mo_num` * :c:data:`mo_two_e_integrals_in_map` @@ -579,8 +786,6 @@ Providers * :c:data:`big_array_coulomb_integrals` * :c:data:`big_array_coulomb_integrals` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_integrals_map` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`n_det` @@ -614,8 +819,6 @@ Providers * :c:data:`big_array_coulomb_integrals` * :c:data:`big_array_coulomb_integrals` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_integrals_map` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`n_int` @@ -630,6 +833,33 @@ Providers * :c:data:`psi_coef_cas_diagonalized` +.. c:var:: h_matrix_diag_all_dets + + + File : :file:`determinants/utils.irp.f` + + .. code:: fortran + + double precision, allocatable :: h_matrix_diag_all_dets (N_det) + + + |H| matrix on the basis of the Slater determinants defined by psi_det + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`big_array_coulomb_integrals` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`mo_integrals_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`psi_det` + + + .. c:var:: idx_cas @@ -712,109 +942,221 @@ Providers * :c:data:`psi_non_cas_sorted_bit` -.. c:var:: max_degree_exc +.. c:var:: list_attachment - File : :file:`determinants/determinants.irp.f` + File : :file:`determinants/density_matrix.irp.f` .. code:: fortran - integer :: max_degree_exc + integer, allocatable :: n_attachment (N_states) + integer, allocatable :: n_dettachment (N_states) + integer, allocatable :: list_attachment (mo_num,N_states) + integer, allocatable :: list_dettachment (mo_num,N_states) - Maximum degree of excitation in the wave function with respect to the Hartree-Fock - determinant. Needs: .. hlist:: :columns: 3 - * :c:data:`hf_bitmask` - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`psi_det` + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_num` + * :c:data:`n_states` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` -.. c:var:: n_det +.. c:var:: list_dettachment - File : :file:`determinants/determinants.irp.f` + File : :file:`determinants/density_matrix.irp.f` .. code:: fortran - integer :: n_det + integer, allocatable :: n_attachment (N_states) + integer, allocatable :: n_dettachment (N_states) + integer, allocatable :: list_attachment (mo_num,N_states) + integer, allocatable :: list_dettachment (mo_num,N_states) - Number of determinants in the wave function Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` - * :c:data:`mo_label` - * :c:data:`mpi_master` - * :c:data:`nproc` - * :c:data:`read_wf` + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_num` + * :c:data:`n_states` Needed by: .. hlist:: :columns: 3 - * :c:data:`act_2_rdm_aa_mo` - * :c:data:`act_2_rdm_ab_mo` - * :c:data:`act_2_rdm_bb_mo` - * :c:data:`act_2_rdm_spin_trace_mo` - * :c:data:`barycentric_electronic_energy` - * :c:data:`ci_electronic_energy` - * :c:data:`ci_energy` - * :c:data:`det_alpha_norm` - * :c:data:`det_to_occ_pattern` - * :c:data:`diag_algorithm` - * :c:data:`diagonal_h_matrix_on_psi_det` - * :c:data:`dressed_column_idx` - * :c:data:`dressing_column_h` - * :c:data:`h_apply_buffer_allocated` - * :c:data:`h_matrix_all_dets` - * :c:data:`max_degree_exc` - * :c:data:`n_det_qp_edit` - * :c:data:`one_e_dm_mo_alpha` - * :c:data:`pruned` - * :c:data:`psi_average_norm_contrib` - * :c:data:`psi_bilinear_matrix` - * :c:data:`psi_bilinear_matrix_columns_loc` - * :c:data:`psi_bilinear_matrix_order_reverse` + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` + + +.. c:var:: max_degree_exc + + + File : :file:`determinants/determinants.irp.f` + + .. code:: fortran + + integer :: max_degree_exc + + + Maximum degree of excitation in the wave function with respect to the Hartree-Fock + determinant. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`hf_bitmask` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`psi_det` + + + +.. c:var:: n_attachment + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + integer, allocatable :: n_attachment (N_states) + integer, allocatable :: n_dettachment (N_states) + integer, allocatable :: list_attachment (mo_num,N_states) + integer, allocatable :: list_dettachment (mo_num,N_states) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_num` + * :c:data:`n_states` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` + + +.. c:var:: n_det + + + File : :file:`determinants/determinants.irp.f` + + .. code:: fortran + + integer :: n_det + + + Number of determinants in the wave function + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mo_label` + * :c:data:`mpi_master` + * :c:data:`nproc` + * :c:data:`read_wf` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` + * :c:data:`barycentric_electronic_energy` + * :c:data:`ci_electronic_energy` + * :c:data:`ci_energy` + * :c:data:`det_alpha_norm` + * :c:data:`det_to_configuration` + * :c:data:`diag_algorithm` + * :c:data:`diagonal_h_matrix_on_psi_det` + * :c:data:`dominant_cfg` + * :c:data:`dominant_det` + * :c:data:`dressed_column_idx` + * :c:data:`dressing_column_h` + * :c:data:`gradvec_old` + * :c:data:`h_apply_buffer_allocated` + * :c:data:`h_matrix_all_dets` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`hessmat_old` + * :c:data:`max_degree_exc` + * :c:data:`multi_s_dipole_moment` + * :c:data:`n_det_generators` + * :c:data:`n_det_qp_edit` + * :c:data:`n_det_selectors` + * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` + * :c:data:`overlap_states` + * :c:data:`p0tuvx_peter` + * :c:data:`pruned` + * :c:data:`psi_average_norm_contrib` + * :c:data:`psi_bilinear_matrix` + * :c:data:`psi_bilinear_matrix_columns_loc` + * :c:data:`psi_bilinear_matrix_order_reverse` * :c:data:`psi_bilinear_matrix_order_transp_reverse` * :c:data:`psi_bilinear_matrix_transp_rows_loc` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_cas` * :c:data:`psi_coef` + * :c:data:`psi_configuration` + * :c:data:`psi_configuration_hii` + * :c:data:`psi_configuration_to_psi_det` + * :c:data:`psi_csf_coef` * :c:data:`psi_det` * :c:data:`psi_det_alpha` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta` * :c:data:`psi_det_beta_unique` + * :c:data:`psi_det_generators` * :c:data:`psi_det_hii` * :c:data:`psi_det_sorted` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_energy` * :c:data:`psi_energy_two_e` + * :c:data:`psi_energy_two_e_trans` * :c:data:`psi_non_cas` - * :c:data:`psi_occ_pattern` - * :c:data:`psi_occ_pattern_hii` * :c:data:`s2_matrix_all_dets` * :c:data:`s2_values` * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` - * :c:data:`weight_occ_pattern` - * :c:data:`weight_occ_pattern_average` + * :c:data:`weight_configuration` + * :c:data:`weight_configuration_average` .. c:var:: n_det_alpha_unique @@ -847,13 +1189,16 @@ Providers :columns: 3 * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`singles_alpha_csc` * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_alpha_csc_map` .. c:var:: n_det_beta_unique @@ -886,13 +1231,17 @@ Providers :columns: 3 * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`singles_beta_csc` * :c:data:`singles_beta_csc_idx` + * :c:data:`singles_beta_csc_map` .. c:var:: n_det_cas @@ -998,67 +1347,56 @@ Providers -.. c:var:: n_double_exc_bitmasks +.. c:var:: n_dettachment - File : :file:`determinants/determinants_bitmasks.irp.f` + File : :file:`determinants/density_matrix.irp.f` .. code:: fortran - integer :: n_double_exc_bitmasks + integer, allocatable :: n_attachment (N_states) + integer, allocatable :: n_dettachment (N_states) + integer, allocatable :: list_attachment (mo_num,N_states) + integer, allocatable :: list_dettachment (mo_num,N_states) - Number of double excitation bitmasks - Needed by: + Needs: .. hlist:: :columns: 3 - * :c:data:`double_exc_bitmask` + * :c:data:`difference_dm_eigvect` + * :c:data:`mo_num` + * :c:data:`n_states` - -.. c:var:: n_occ_pattern + Needed by: + .. hlist:: + :columns: 3 - File : :file:`determinants/occ_pattern.irp.f` + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` - .. code:: fortran + +.. c:var:: n_double_exc_bitmasks - integer(bit_kind), allocatable :: psi_occ_pattern (N_int,2,psi_det_size) - integer :: n_occ_pattern + File : :file:`determinants/determinants_bitmasks.irp.f` - Array of the occ_patterns present in the wave function. - - psi_occ_pattern(:,1,j) = j-th occ_pattern of the wave function : represents all the single occupations - - psi_occ_pattern(:,2,j) = j-th occ_pattern of the wave function : represents all the double occupations - - The occ patterns are sorted by :c:func:`occ_pattern_search_key` + .. code:: fortran - Needs: + integer :: n_double_exc_bitmasks - .. hlist:: - :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`psi_det` - * :c:data:`psi_det_size` + Number of double excitation bitmasks Needed by: .. hlist:: :columns: 3 - * :c:data:`det_to_occ_pattern` - * :c:data:`pruned` - * :c:data:`psi_occ_pattern_hii` - * :c:data:`psi_occ_pattern_sorted` - * :c:data:`weight_occ_pattern` - * :c:data:`weight_occ_pattern_average` + * :c:data:`double_exc_bitmask` .. c:var:: n_single_exc_bitmasks @@ -1081,6 +1419,28 @@ Providers * :c:data:`single_exc_bitmask` +.. c:var:: one_e_dm_ao + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: one_e_dm_ao (ao_num,ao_num) + + + one_e_dm_ao = one_e_dm_ao_alpha + one_e_dm_ao_beta + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`one_e_dm_ao_alpha` + + + .. c:var:: one_e_dm_ao_alpha @@ -1104,6 +1464,38 @@ Providers * :c:data:`mo_num` * :c:data:`one_e_dm_mo_alpha_average` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`one_e_dm_ao` + + +.. c:var:: one_e_dm_ao_alpha_nstates + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: one_e_dm_ao_alpha_nstates (ao_num,ao_num,N_states) + double precision, allocatable :: one_e_dm_ao_beta_nstates (ao_num,ao_num,N_states) + + + One body density matrix on the |AO| basis : :math:`\rho_{AO}(\alpha), \rho_{AO}(\beta)` . + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_coef` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_mo_alpha` + .. c:var:: one_e_dm_ao_beta @@ -1129,6 +1521,38 @@ Providers * :c:data:`mo_num` * :c:data:`one_e_dm_mo_alpha_average` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`one_e_dm_ao` + + +.. c:var:: one_e_dm_ao_beta_nstates + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: one_e_dm_ao_alpha_nstates (ao_num,ao_num,N_states) + double precision, allocatable :: one_e_dm_ao_beta_nstates (ao_num,ao_num,N_states) + + + One body density matrix on the |AO| basis : :math:`\rho_{AO}(\alpha), \rho_{AO}(\beta)` . + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_coef` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_mo_alpha` + .. c:var:: one_e_dm_dagger_mo_spin_index @@ -1210,10 +1634,12 @@ Providers .. hlist:: :columns: 3 + * :c:data:`difference_dm` * :c:data:`full_occ_2_rdm_aa_mo` * :c:data:`full_occ_2_rdm_ab_mo` * :c:data:`full_occ_2_rdm_bb_mo` * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`one_e_dm_ao_alpha_nstates` * :c:data:`one_e_dm_dagger_mo_spin_index` * :c:data:`one_e_dm_mo_alpha_average` * :c:data:`one_e_dm_mo_alpha_for_dft` @@ -1221,6 +1647,8 @@ Providers * :c:data:`one_e_dm_mo_diff` * :c:data:`one_e_dm_mo_spin_index` * :c:data:`psi_energy_h_core` + * :c:data:`v_ne_psi_energy` + * :c:data:`z_dipole_moment` .. c:var:: one_e_dm_mo_alpha_average @@ -1251,6 +1679,8 @@ Providers .. hlist:: :columns: 3 + * :c:data:`d0tu` + * :c:data:`d0tu_alpha_ao` * :c:data:`one_e_dm_ao_alpha` * :c:data:`one_e_dm_mo` * :c:data:`one_e_dm_mo_alpha_for_dft` @@ -1297,10 +1727,12 @@ Providers .. hlist:: :columns: 3 + * :c:data:`difference_dm` * :c:data:`full_occ_2_rdm_aa_mo` * :c:data:`full_occ_2_rdm_ab_mo` * :c:data:`full_occ_2_rdm_bb_mo` * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`one_e_dm_ao_alpha_nstates` * :c:data:`one_e_dm_dagger_mo_spin_index` * :c:data:`one_e_dm_mo_alpha_average` * :c:data:`one_e_dm_mo_alpha_for_dft` @@ -1308,6 +1740,8 @@ Providers * :c:data:`one_e_dm_mo_diff` * :c:data:`one_e_dm_mo_spin_index` * :c:data:`psi_energy_h_core` + * :c:data:`v_ne_psi_energy` + * :c:data:`z_dipole_moment` .. c:var:: one_e_dm_mo_beta_average @@ -1338,6 +1772,8 @@ Providers .. hlist:: :columns: 3 + * :c:data:`d0tu` + * :c:data:`d0tu_alpha_ao` * :c:data:`one_e_dm_ao_alpha` * :c:data:`one_e_dm_mo` * :c:data:`one_e_dm_mo_alpha_for_dft` @@ -1446,67 +1882,162 @@ Providers * :c:data:`one_e_spin_density_ao` -.. c:var:: pruned +.. c:var:: one_e_tr_dm_mo - File : :file:`determinants/prune_wf.irp.f` + File : :file:`determinants/tr_density_matrix.irp.f` .. code:: fortran - logical, allocatable :: pruned (N_det) + double precision, allocatable :: one_e_tr_dm_mo (mo_num,mo_num,N_states,N_states) - True if determinant is removed by pruning + One body transition density matrix for all pairs of states n and m, < Psi^n | a_i^\dagger a_a | Psi^m > Needs: .. hlist:: :columns: 3 - * :c:data:`det_to_occ_pattern` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_num` * :c:data:`n_det` - * :c:data:`pruning` - * :c:data:`psi_average_norm_contrib` - * :c:data:`psi_det_sorted` - * :c:data:`psi_occ_pattern` - * :c:data:`psi_occ_pattern_sorted` - * :c:data:`s2_eig` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + + Needed by: + + .. hlist:: + :columns: 3 + * :c:data:`multi_s_deriv_1` + * :c:data:`multi_s_dipole_moment` -.. c:var:: psi_average_norm_contrib +.. c:var:: one_e_tr_dm_mo_alpha - File : :file:`determinants/determinants.irp.f` + File : :file:`determinants/tr_density_matrix.irp.f` .. code:: fortran - double precision, allocatable :: psi_average_norm_contrib (psi_det_size) + double precision, allocatable :: one_e_tr_dm_mo_alpha (mo_num,mo_num,N_states,N_states) + double precision, allocatable :: one_e_tr_dm_mo_beta (mo_num,mo_num,N_states,N_states) - Contribution of determinants to the state-averaged density. + :math:`\alpha` and :math:`\beta` one-body transition density matrices for all pairs of states Needs: .. hlist:: :columns: 3 + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_num` * :c:data:`n_det` + * :c:data:`n_int` * :c:data:`n_states` - * :c:data:`psi_coef` - * :c:data:`psi_det_size` - * :c:data:`state_average_weight` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` - * :c:data:`pruned` - * :c:data:`psi_det_sorted` -.. c:var:: psi_average_norm_contrib_sorted +.. c:var:: one_e_tr_dm_mo_beta + + + File : :file:`determinants/tr_density_matrix.irp.f` + + .. code:: fortran + + double precision, allocatable :: one_e_tr_dm_mo_alpha (mo_num,mo_num,N_states,N_states) + double precision, allocatable :: one_e_tr_dm_mo_beta (mo_num,mo_num,N_states,N_states) + + + :math:`\alpha` and :math:`\beta` one-body transition density matrices for all pairs of states + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_num` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + + + +.. c:var:: pruned + + + File : :file:`determinants/prune_wf.irp.f` + + .. code:: fortran + + logical, allocatable :: pruned (N_det) + + + True if determinant is removed by pruning + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`pruning` + * :c:data:`psi_average_norm_contrib` + * :c:data:`psi_det_sorted` + + + +.. c:var:: psi_average_norm_contrib + + + File : :file:`determinants/determinants.irp.f` + + .. code:: fortran + + double precision, allocatable :: psi_average_norm_contrib (psi_det_size) + + + Contribution of determinants to the state-averaged density. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`psi_det_size` + * :c:data:`state_average_weight` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pruned` + * :c:data:`psi_det_sorted` + + +.. c:var:: psi_average_norm_contrib_sorted File : :file:`determinants/determinants.irp.f` @@ -1541,7 +2072,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`n_det_generators` + * :c:data:`n_det_selectors` * :c:data:`pruned` + * :c:data:`psi_det_generators` + * :c:data:`psi_selectors` .. c:var:: psi_bilinear_matrix @@ -1614,8 +2149,12 @@ Providers * :c:data:`act_2_rdm_ab_mo` * :c:data:`act_2_rdm_bb_mo` * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_order_reverse` @@ -1623,7 +2162,6 @@ Providers * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` .. c:var:: psi_bilinear_matrix_columns_loc @@ -1698,8 +2236,12 @@ Providers * :c:data:`act_2_rdm_ab_mo` * :c:data:`act_2_rdm_bb_mo` * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_order_reverse` @@ -1707,7 +2249,6 @@ Providers * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` .. c:var:: psi_bilinear_matrix_order_reverse @@ -1739,10 +2280,10 @@ Providers * :c:data:`act_2_rdm_ab_mo` * :c:data:`act_2_rdm_bb_mo` * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` .. c:var:: psi_bilinear_matrix_order_transp_reverse @@ -1811,8 +2352,12 @@ Providers * :c:data:`act_2_rdm_ab_mo` * :c:data:`act_2_rdm_bb_mo` * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_order_reverse` @@ -1820,7 +2365,6 @@ Providers * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` .. c:var:: psi_bilinear_matrix_transp_columns @@ -1852,7 +2396,6 @@ Providers * :c:data:`n_states` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` Needed by: @@ -1860,7 +2403,10 @@ Providers .. hlist:: :columns: 3 + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix_order_transp_reverse` * :c:data:`psi_bilinear_matrix_transp_rows_loc` @@ -1894,7 +2440,6 @@ Providers * :c:data:`n_states` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` Needed by: @@ -1902,7 +2447,10 @@ Providers .. hlist:: :columns: 3 + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix_order_transp_reverse` * :c:data:`psi_bilinear_matrix_transp_rows_loc` @@ -1936,7 +2484,6 @@ Providers * :c:data:`n_states` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` Needed by: @@ -1944,7 +2491,10 @@ Providers .. hlist:: :columns: 3 + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix_order_transp_reverse` * :c:data:`psi_bilinear_matrix_transp_rows_loc` @@ -2001,7 +2551,6 @@ Providers * :c:data:`n_states` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta_unique` Needed by: @@ -2009,7 +2558,10 @@ Providers .. hlist:: :columns: 3 + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix_order_transp_reverse` * :c:data:`psi_bilinear_matrix_transp_rows_loc` @@ -2057,8 +2609,12 @@ Providers * :c:data:`act_2_rdm_ab_mo` * :c:data:`act_2_rdm_bb_mo` * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_order_reverse` @@ -2066,7 +2622,6 @@ Providers * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` .. c:var:: psi_cas @@ -2278,6 +2833,7 @@ Providers * :c:data:`mpi_master` * :c:data:`n_det` * :c:data:`n_states` + * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`read_wf` @@ -2290,26 +2846,35 @@ Providers * :c:data:`act_2_rdm_ab_mo` * :c:data:`act_2_rdm_bb_mo` * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`barycentric_electronic_energy` * :c:data:`c0_weight` * :c:data:`ci_electronic_energy` + * :c:data:`dettocsftransformationmatrix` + * :c:data:`dominant_det` * :c:data:`dressed_column_idx` + * :c:data:`gradvec_old` + * :c:data:`hessmat_old` + * :c:data:`overlap_states` + * :c:data:`p0tuvx_peter` * :c:data:`psi_average_norm_contrib` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_cas` * :c:data:`psi_coef_max` + * :c:data:`psi_csf_coef` * :c:data:`psi_det_sorted` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_energy` * :c:data:`psi_energy_two_e` + * :c:data:`psi_energy_two_e_trans` * :c:data:`psi_non_cas` + * :c:data:`pt2_e0_denominator` * :c:data:`s2_values` * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` - * :c:data:`state_av_act_2_rdm_spin_trace_mo` - * :c:data:`weight_occ_pattern` - * :c:data:`weight_occ_pattern_average` + * :c:data:`weight_configuration` + * :c:data:`weight_configuration_average` .. c:var:: psi_coef_cas_diagonalized @@ -2422,7 +2987,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`n_det_generators` + * :c:data:`n_det_selectors` * :c:data:`pruned` + * :c:data:`psi_det_generators` + * :c:data:`psi_selectors` .. c:var:: psi_coef_sorted_bit @@ -2496,13 +3065,23 @@ Providers :columns: 3 * :c:data:`ci_electronic_energy` - * :c:data:`det_to_occ_pattern` + * :c:data:`det_to_configuration` + * :c:data:`dettocsftransformationmatrix` * :c:data:`diagonal_h_matrix_on_psi_det` + * :c:data:`gradvec_old` * :c:data:`h_matrix_all_dets` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`hessmat_old` * :c:data:`max_degree_exc` + * :c:data:`n_elec_alpha_for_psi_configuration` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`p0tuvx_peter` * :c:data:`psi_bilinear_matrix_values` * :c:data:`psi_cas` + * :c:data:`psi_coef` + * :c:data:`psi_configuration` + * :c:data:`psi_configuration_to_psi_det` + * :c:data:`psi_csf_coef` * :c:data:`psi_det_alpha` * :c:data:`psi_det_beta` * :c:data:`psi_det_hii` @@ -2510,8 +3089,8 @@ Providers * :c:data:`psi_det_sorted_bit` * :c:data:`psi_energy` * :c:data:`psi_energy_two_e` + * :c:data:`psi_energy_two_e_trans` * :c:data:`psi_non_cas` - * :c:data:`psi_occ_pattern` * :c:data:`s2_matrix_all_dets` * :c:data:`s2_values` @@ -2576,13 +3155,16 @@ Providers :columns: 3 * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_transp_rows_loc` - * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`singles_alpha_csc` * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_alpha_csc_map` .. c:var:: psi_det_beta @@ -2645,13 +3227,17 @@ Providers :columns: 3 * :c:data:`det_alpha_norm` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:data:`psi_bilinear_matrix` * :c:data:`psi_bilinear_matrix_columns_loc` * :c:data:`psi_bilinear_matrix_transp_values` * :c:data:`psi_bilinear_matrix_values` * :c:data:`singles_beta_csc` * :c:data:`singles_beta_csc_idx` + * :c:data:`singles_beta_csc_map` .. c:var:: psi_det_hii @@ -2671,8 +3257,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`elec_num` * :c:data:`n_det` * :c:data:`n_int` @@ -2685,7 +3269,8 @@ Providers .. hlist:: :columns: 3 - * :c:data:`psi_occ_pattern_hii` + * :c:data:`psi_configuration_hii` + * :c:data:`pt2_e0_denominator` .. c:var:: psi_det_size @@ -2707,6 +3292,7 @@ Providers * :c:data:`ezfio_filename` * :c:data:`mpi_master` + * :c:data:`read_wf` Needed by: @@ -2717,18 +3303,20 @@ Providers * :c:data:`psi_cas` * :c:data:`psi_cas_sorted_bit` * :c:data:`psi_coef` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_alpha` * :c:data:`psi_det_alpha_unique` * :c:data:`psi_det_beta` * :c:data:`psi_det_beta_unique` + * :c:data:`psi_det_generators` * :c:data:`psi_det_sorted` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_energy` * :c:data:`psi_energy_two_e` * :c:data:`psi_non_cas` * :c:data:`psi_non_cas_sorted_bit` - * :c:data:`psi_occ_pattern` + * :c:data:`psi_selectors_size` * :c:data:`s2_values` @@ -2767,7 +3355,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`n_det_generators` + * :c:data:`n_det_selectors` * :c:data:`pruned` + * :c:data:`psi_det_generators` + * :c:data:`psi_selectors` .. c:var:: psi_det_sorted_bit @@ -2842,7 +3434,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`n_det_generators` + * :c:data:`n_det_selectors` * :c:data:`pruned` + * :c:data:`psi_det_generators` + * :c:data:`psi_selectors` .. c:var:: psi_energy_h_core @@ -3004,171 +3600,6 @@ Providers -.. c:var:: psi_occ_pattern - - - File : :file:`determinants/occ_pattern.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_occ_pattern (N_int,2,psi_det_size) - integer :: n_occ_pattern - - - Array of the occ_patterns present in the wave function. - - psi_occ_pattern(:,1,j) = j-th occ_pattern of the wave function : represents all the single occupations - - psi_occ_pattern(:,2,j) = j-th occ_pattern of the wave function : represents all the double occupations - - The occ patterns are sorted by :c:func:`occ_pattern_search_key` - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`elec_alpha_num` - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`psi_det` - * :c:data:`psi_det_size` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`det_to_occ_pattern` - * :c:data:`pruned` - * :c:data:`psi_occ_pattern_hii` - * :c:data:`psi_occ_pattern_sorted` - * :c:data:`weight_occ_pattern` - * :c:data:`weight_occ_pattern_average` - - -.. c:var:: psi_occ_pattern_hii - - - File : :file:`determinants/occ_pattern.irp.f` - - .. code:: fortran - - double precision, allocatable :: psi_occ_pattern_hii (N_occ_pattern) - - - :math:`\langle I|H|I \rangle` where :math:`|I\rangle` is an occupation pattern. - This is the minimum :math:`H_{ii}` , where the :math:`|i\rangle` are the - determinants of :math:`|I\rangle` . - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`det_to_occ_pattern` - * :c:data:`n_det` - * :c:data:`psi_det_hii` - * :c:data:`psi_occ_pattern` - - - -.. c:var:: psi_occ_pattern_sorted - - - File : :file:`determinants/occ_pattern.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_occ_pattern_sorted (N_int,2,N_occ_pattern) - double precision, allocatable :: weight_occ_pattern_average_sorted (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order_reverse (N_occ_pattern) - - - Occupation patterns sorted by weight - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`psi_occ_pattern` - * :c:data:`weight_occ_pattern_average` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pruned` - - -.. c:var:: psi_occ_pattern_sorted_order - - - File : :file:`determinants/occ_pattern.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_occ_pattern_sorted (N_int,2,N_occ_pattern) - double precision, allocatable :: weight_occ_pattern_average_sorted (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order_reverse (N_occ_pattern) - - - Occupation patterns sorted by weight - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`psi_occ_pattern` - * :c:data:`weight_occ_pattern_average` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pruned` - - -.. c:var:: psi_occ_pattern_sorted_order_reverse - - - File : :file:`determinants/occ_pattern.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_occ_pattern_sorted (N_int,2,N_occ_pattern) - double precision, allocatable :: weight_occ_pattern_average_sorted (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order_reverse (N_occ_pattern) - - - Occupation patterns sorted by weight - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`psi_occ_pattern` - * :c:data:`weight_occ_pattern_average` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pruned` - - .. c:var:: ref_bitmask_energy @@ -3207,8 +3638,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_energy_aa @@ -3249,8 +3683,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_energy_ab @@ -3291,8 +3728,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_energy_bb @@ -3333,8 +3773,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_kinetic_energy @@ -3375,8 +3818,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_n_e_energy @@ -3417,8 +3863,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_one_e_energy @@ -3459,8 +3908,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_bitmask_two_e_energy @@ -3501,8 +3953,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` * :c:data:`diagonal_h_matrix_on_psi_det` * :c:data:`psi_det_hii` + * :c:data:`psi_energy_two_e_trans` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: ref_closed_shell_bitmask @@ -3573,6 +4028,34 @@ Providers .. code:: fortran double precision, allocatable :: s2_values (N_states) + double precision, allocatable :: s_values (N_states) + + + array of the averaged values of the S^2 operator on the various states + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`psi_det` + * :c:data:`psi_det_size` + + + +.. c:var:: s_values + + + File : :file:`determinants/s2.irp.f` + + .. code:: fortran + + double precision, allocatable :: s2_values (N_states) + double precision, allocatable :: s_values (N_states) array of the averaged values of the S^2 operator on the various states @@ -3707,8 +4190,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`mo_num` * :c:data:`n_int` * :c:data:`psi_det_alpha_unique` @@ -3718,39 +4199,62 @@ Providers :columns: 3 * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_map` -.. c:var:: singles_alpha_csc_size +.. c:var:: singles_alpha_csc_map File : :file:`determinants/spindeterminants.irp.f` .. code:: fortran - integer*8, allocatable :: singles_alpha_csc_idx (N_det_alpha_unique+1) - integer*8 :: singles_alpha_csc_size + type(mmap_type) :: singles_alpha_csc_map - singles_alpha_csc_size : Dimension of the :c:data:`singles_alpha_csc` array - - singles_alpha_csc_idx : Index where the single excitations of determinant i start + Indices of all single excitations Needs: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`mo_num` * :c:data:`n_int` * :c:data:`psi_det_alpha_unique` + * :c:data:`singles_alpha_csc_idx` - Needed by: - .. hlist:: - :columns: 3 + +.. c:var:: singles_alpha_csc_size + + + File : :file:`determinants/spindeterminants.irp.f` + + .. code:: fortran + + integer*8, allocatable :: singles_alpha_csc_idx (N_det_alpha_unique+1) + integer*8 :: singles_alpha_csc_size + + + singles_alpha_csc_size : Dimension of the :c:data:`singles_alpha_csc` array + + singles_alpha_csc_idx : Index where the single excitations of determinant i start + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + * :c:data:`psi_det_alpha_unique` + + Needed by: + + .. hlist:: + :columns: 3 * :c:data:`singles_alpha_csc` + * :c:data:`singles_alpha_csc_map` .. c:var:: singles_beta_csc @@ -3796,8 +4300,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`elec_beta_num` - * :c:data:`mo_num` * :c:data:`n_int` * :c:data:`psi_det_beta_unique` @@ -3807,6 +4309,30 @@ Providers :columns: 3 * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_map` + + +.. c:var:: singles_beta_csc_map + + + File : :file:`determinants/spindeterminants.irp.f` + + .. code:: fortran + + type(mmap_type) :: singles_beta_csc_map + + + Indices of all single excitations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + * :c:data:`psi_det_beta_unique` + * :c:data:`singles_beta_csc_idx` + .. c:var:: singles_beta_csc_size @@ -3829,8 +4355,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`elec_beta_num` - * :c:data:`mo_num` * :c:data:`n_int` * :c:data:`psi_det_beta_unique` @@ -3840,6 +4364,7 @@ Providers :columns: 3 * :c:data:`singles_beta_csc` + * :c:data:`singles_beta_csc_map` .. c:var:: state_average_weight @@ -3873,100 +4398,128 @@ Providers * :c:data:`one_e_dm_average_beta_mo_for_dft` * :c:data:`one_e_dm_mo_alpha_average` * :c:data:`psi_average_norm_contrib` + * :c:data:`selection_weight` * :c:data:`state_av_act_2_rdm_aa_mo` * :c:data:`state_av_act_2_rdm_ab_mo` * :c:data:`state_av_act_2_rdm_bb_mo` * :c:data:`state_av_act_2_rdm_spin_trace_mo` - * :c:data:`weight_occ_pattern_average` + * :c:data:`weight_configuration_average` -.. c:var:: weight_occ_pattern +.. c:var:: v_ne_psi_energy - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/psi_energy_mono_elec.irp.f` .. code:: fortran - double precision, allocatable :: weight_occ_pattern (N_occ_pattern,N_states) + double precision, allocatable :: v_ne_psi_energy (N_states) - Weight of the occupation patterns in the wave function + v_ne_psi_energy = :math:`\langle \Psi | v_ne |\Psi \rangle` + + computed using the :c:data:`one_e_dm_mo_alpha` + + :c:data:`one_e_dm_mo_beta` and :c:data:`mo_one_e_integrals` Needs: .. hlist:: :columns: 3 - * :c:data:`det_to_occ_pattern` - * :c:data:`n_det` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_integrals_n_e` + * :c:data:`mo_num` * :c:data:`n_states` - * :c:data:`psi_coef` - * :c:data:`psi_occ_pattern` + * :c:data:`one_e_dm_mo_alpha` -.. c:var:: weight_occ_pattern_average +.. c:var:: x_dipole_moment - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/dipole_moments.irp.f` .. code:: fortran - double precision, allocatable :: weight_occ_pattern_average (N_occ_pattern) + double precision, allocatable :: z_dipole_moment (N_states) + double precision, allocatable :: y_dipole_moment (N_states) + double precision, allocatable :: x_dipole_moment (N_states) - State-average weight of the occupation patterns in the wave function + blablabla Needs: .. hlist:: :columns: 3 - * :c:data:`det_to_occ_pattern` - * :c:data:`n_det` + * :c:data:`mo_dipole_x` + * :c:data:`mo_num` * :c:data:`n_states` - * :c:data:`psi_coef` - * :c:data:`psi_occ_pattern` - * :c:data:`state_average_weight` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + * :c:data:`one_e_dm_mo_alpha` - * :c:data:`psi_occ_pattern_sorted` -.. c:var:: weight_occ_pattern_average_sorted +.. c:var:: y_dipole_moment - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/dipole_moments.irp.f` .. code:: fortran - integer(bit_kind), allocatable :: psi_occ_pattern_sorted (N_int,2,N_occ_pattern) - double precision, allocatable :: weight_occ_pattern_average_sorted (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order (N_occ_pattern) - integer, allocatable :: psi_occ_pattern_sorted_order_reverse (N_occ_pattern) + double precision, allocatable :: z_dipole_moment (N_states) + double precision, allocatable :: y_dipole_moment (N_states) + double precision, allocatable :: x_dipole_moment (N_states) - Occupation patterns sorted by weight + blablabla Needs: .. hlist:: :columns: 3 - * :c:data:`n_int` - * :c:data:`psi_occ_pattern` - * :c:data:`weight_occ_pattern_average` + * :c:data:`mo_dipole_x` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + * :c:data:`one_e_dm_mo_alpha` - Needed by: + + +.. c:var:: z_dipole_moment + + + File : :file:`determinants/dipole_moments.irp.f` + + .. code:: fortran + + double precision, allocatable :: z_dipole_moment (N_states) + double precision, allocatable :: y_dipole_moment (N_states) + double precision, allocatable :: x_dipole_moment (N_states) + + + blablabla + + Needs: .. hlist:: :columns: 3 - * :c:data:`pruned` + * :c:data:`mo_dipole_x` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + * :c:data:`one_e_dm_mo_alpha` + @@ -4059,8 +4612,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_num` * :c:data:`mo_one_e_integrals` * :c:data:`mo_two_e_integrals_jj` @@ -4097,8 +4648,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_two_e_integrals_jj` Called by: @@ -4139,6 +4688,16 @@ Subroutines / functions + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` + * :c:func:`select_singles` + * :c:func:`select_singles_and_doubles` + .. c:function:: apply_holes: @@ -4151,6 +4710,14 @@ Subroutines / functions + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` + .. c:function:: apply_particle: @@ -4163,6 +4730,16 @@ Subroutines / functions + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` + * :c:func:`get_m0` + * :c:func:`get_m1` + .. c:function:: apply_particles: @@ -4175,6 +4752,18 @@ Subroutines / functions + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` + * :c:func:`get_d0` + * :c:func:`get_d0_reference` + * :c:func:`get_d1` + * :c:func:`get_d1_reference` + .. c:function:: bitstring_to_list_ab: @@ -4186,7 +4775,7 @@ Subroutines / functions subroutine bitstring_to_list_ab( string, list, n_elements, Nint) - Gives the inidices(+1) of the bits set to 1 in the bit string + Gives the indices(+1) of the bits set to 1 in the bit string For alpha/beta determinants. Called by: @@ -4211,16 +4800,25 @@ Subroutines / functions * :c:func:`i_h_j_s2` * :c:func:`i_h_j_two_e` * :c:func:`i_h_j_verbose` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` * :c:func:`orb_range_diag_to_all_2_rdm_dm_buffer` * :c:func:`orb_range_diag_to_all_states_2_rdm_dm_buffer` + * :c:func:`orb_range_diag_to_all_states_2_rdm_trans_buffer` * :c:func:`orb_range_off_diag_single_to_2_rdm_aa_dm_buffer` * :c:func:`orb_range_off_diag_single_to_2_rdm_ab_dm_buffer` * :c:func:`orb_range_off_diag_single_to_2_rdm_bb_dm_buffer` * :c:func:`orb_range_off_diag_single_to_all_states_aa_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_aa_trans_rdm_buffer` * :c:func:`orb_range_off_diag_single_to_all_states_ab_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_ab_trans_rdm_buffer` * :c:func:`orb_range_off_diag_single_to_all_states_bb_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_bb_trans_rdm_buffer` * :c:data:`ref_closed_shell_bitmask` + * :c:func:`select_singles` + * :c:func:`select_singles_and_doubles` * :c:func:`single_excitation_wee` @@ -4249,6 +4847,13 @@ Subroutines / functions * :c:data:`mo_two_e_integrals_jj` * :c:data:`n_int` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`select_connected` + Calls: .. hlist:: @@ -4346,13 +4951,6 @@ Subroutines / functions -i : key is the ith determinant of the reference wf keys - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - .. c:function:: connected_to_ref_by_single: @@ -4379,13 +4977,6 @@ Subroutines / functions -i : key is the ith determinant of the reference wf keys - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - .. c:function:: copy_h_apply_buffer_to_wf: @@ -4405,8 +4996,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` * :c:data:`n_int` @@ -4424,6 +5013,9 @@ Subroutines / functions * :c:func:`generate_all_alpha_beta_det_products` * :c:func:`make_s2_eigenfunction` + * :c:func:`replace_wf` + * :c:func:`run_cipsi` + * :c:func:`run_stochastic_cipsi` Calls: @@ -4489,6 +5081,18 @@ Subroutines / functions * :c:data:`mo_num` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`perturb_buffer_dummy` + * :c:func:`perturb_buffer_epstein_nesbet` + * :c:func:`perturb_buffer_epstein_nesbet_2x2` + * :c:func:`perturb_buffer_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`perturb_buffer_moller_plesset` + * :c:func:`perturb_buffer_qdpt` + Calls: .. hlist:: @@ -4508,6 +5112,24 @@ Subroutines / functions + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`perturb_buffer_by_mono_dummy` + * :c:func:`perturb_buffer_by_mono_epstein_nesbet` + * :c:func:`perturb_buffer_by_mono_epstein_nesbet_2x2` + * :c:func:`perturb_buffer_by_mono_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`perturb_buffer_by_mono_moller_plesset` + * :c:func:`perturb_buffer_by_mono_qdpt` + * :c:func:`perturb_buffer_dummy` + * :c:func:`perturb_buffer_epstein_nesbet` + * :c:func:`perturb_buffer_epstein_nesbet_2x2` + * :c:func:`perturb_buffer_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`perturb_buffer_moller_plesset` + * :c:func:`perturb_buffer_qdpt` + .. c:function:: create_minilist_find_previous: @@ -4520,6 +5142,24 @@ Subroutines / functions + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`perturb_buffer_by_mono_dummy` + * :c:func:`perturb_buffer_by_mono_epstein_nesbet` + * :c:func:`perturb_buffer_by_mono_epstein_nesbet_2x2` + * :c:func:`perturb_buffer_by_mono_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`perturb_buffer_by_mono_moller_plesset` + * :c:func:`perturb_buffer_by_mono_qdpt` + * :c:func:`perturb_buffer_dummy` + * :c:func:`perturb_buffer_epstein_nesbet` + * :c:func:`perturb_buffer_epstein_nesbet_2x2` + * :c:func:`perturb_buffer_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`perturb_buffer_moller_plesset` + * :c:func:`perturb_buffer_qdpt` + .. c:function:: create_wf_of_psi_bilinear_matrix: @@ -4534,28 +5174,13 @@ Subroutines / functions Generates a wave function containing all possible products of $\alpha$ and $\beta$ determinants - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_bilinear_matrix` - * :c:data:`psi_coef` - * :c:data:`psi_det` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`psi_det_sorted` - * :c:data:`psi_det_sorted_bit` - Calls: .. hlist:: :columns: 3 * :c:func:`generate_all_alpha_beta_det_products` + * :c:func:`update_wf_of_psi_bilinear_matrix` Touches: @@ -4563,10 +5188,14 @@ Subroutines / functions :columns: 3 * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` @@ -4594,6 +5223,7 @@ Subroutines / functions * :c:func:`diag_h_mat_elem_fock` * :c:func:`example_determinants` + * :c:func:`pt2_moller_plesset` .. c:function:: decode_exc_spin: @@ -4617,7 +5247,10 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` .. c:function:: det_inf: @@ -4694,8 +5327,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`elec_num` * :c:data:`ref_bitmask` * :c:data:`ref_bitmask_energy` @@ -4759,8 +5390,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_one_e_integrals` Calls: @@ -4801,8 +5430,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`elec_num` * :c:data:`ref_bitmask` * :c:data:`ref_bitmask_energy` @@ -4839,7 +5466,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`mo_num` * :c:data:`n_int` Called by: @@ -4848,7 +5474,10 @@ Subroutines / functions :columns: 3 * :c:func:`build_singly_excited_wavefunction` + * :c:func:`do_signed_mono_excitation` * :c:func:`example_determinants` + * :c:func:`get_excitation_general` + * :c:func:`get_phase_general` .. c:function:: example_determinants: @@ -4938,11 +5567,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` - * :c:data:`n_int` * :c:data:`n_states` Called by: @@ -4952,6 +5578,9 @@ Subroutines / functions * :c:func:`generate_all_alpha_beta_det_products` * :c:func:`make_s2_eigenfunction` + * :c:func:`replace_wf` + * :c:func:`zmq_pt2` + * :c:func:`zmq_selection` Calls: @@ -5009,13 +5638,6 @@ Subroutines / functions idx(0) is the number of determinants that interact with key1 - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - Called by: .. hlist:: @@ -5064,6 +5686,8 @@ Subroutines / functions * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` * :c:data:`n_int` * :c:data:`psi_coef` * :c:data:`psi_det` @@ -5076,6 +5700,7 @@ Subroutines / functions :columns: 3 * :c:func:`create_wf_of_psi_bilinear_matrix` + * :c:func:`generate_cas_space` Calls: @@ -5091,56 +5716,86 @@ Subroutines / functions :columns: 3 * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` * :c:data:`c0_weight` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` -.. c:function:: get_all_spin_doubles: +.. c:function:: generate_cas_space: - File : :file:`determinants/spindeterminants.irp.f` + File : :file:`determinants/generate_cas_space.irp.f` .. code:: fortran - subroutine get_all_spin_doubles(buffer, idx, spindet, Nint, size_buffer, doubles, n_doubles) + subroutine generate_cas_space - - Returns the indices of all the double excitations in the list of - unique $\alpha$ determinants. - + Generates the CAS space Needs: .. hlist:: :columns: 3 + * :c:data:`binom_int` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`list_act` + * :c:data:`list_core_inact` + * :c:data:`n_act_orb` + * :c:data:`n_core_inact_orb` + * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` * :c:data:`n_int` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` Calls: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_doubles_1` - * :c:func:`get_all_spin_doubles_2` - * :c:func:`get_all_spin_doubles_3` - * :c:func:`get_all_spin_doubles_4` - * :c:func:`get_all_spin_doubles_n_int` + * :c:func:`bitstring_to_list` + * :c:func:`generate_all_alpha_beta_det_products` + * :c:func:`list_to_bitstring` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`c0_weight` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`psi_coef` + * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted_bit` -.. c:function:: get_all_spin_doubles_1: +.. c:function:: get_all_spin_doubles: File : :file:`determinants/spindeterminants.irp.f` .. code:: fortran - subroutine get_all_spin_doubles_1(buffer, idx, spindet, size_buffer, doubles, n_doubles) + subroutine get_all_spin_doubles(buffer, idx, spindet, Nint, size_buffer, doubles, n_doubles) @@ -5148,18 +5803,52 @@ Subroutines / functions unique $\alpha$ determinants. - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`get_all_spin_doubles` + * :c:data:`n_int` - + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`get_all_spin_doubles_1` + * :c:func:`get_all_spin_doubles_2` + * :c:func:`get_all_spin_doubles_3` + * :c:func:`get_all_spin_doubles_4` + * :c:func:`get_all_spin_doubles_n_int` + + +.. c:function:: get_all_spin_doubles_1: + + + File : :file:`determinants/spindeterminants.irp.f` + + .. code:: fortran + + subroutine get_all_spin_doubles_1(buffer, idx, spindet, size_buffer, doubles, n_doubles) + + + + Returns the indices of all the double excitations in the list of + unique $\alpha$ determinants. + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`get_all_spin_doubles` + + .. c:function:: get_all_spin_doubles_2: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5182,7 +5871,7 @@ Subroutines / functions .. c:function:: get_all_spin_doubles_3: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5205,7 +5894,7 @@ Subroutines / functions .. c:function:: get_all_spin_doubles_4: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5228,7 +5917,7 @@ Subroutines / functions .. c:function:: get_all_spin_doubles_n_int: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5284,8 +5973,10 @@ Subroutines / functions * :c:data:`singles_alpha_csc` * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_alpha_csc_map` * :c:data:`singles_beta_csc` * :c:data:`singles_beta_csc_idx` + * :c:data:`singles_beta_csc_map` Calls: @@ -5322,14 +6013,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles` * :c:func:`h_s2_u_0_nstates_openmp_work_1` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_1` * :c:func:`orb_range_2_rdm_openmp_work_1` * :c:func:`orb_range_2_rdm_state_av_openmp_work_1` + * :c:func:`orb_range_2_trans_rdm_openmp_work_1` .. c:function:: get_all_spin_singles_2: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5349,14 +6042,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles` * :c:func:`h_s2_u_0_nstates_openmp_work_2` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_2` * :c:func:`orb_range_2_rdm_openmp_work_2` * :c:func:`orb_range_2_rdm_state_av_openmp_work_2` + * :c:func:`orb_range_2_trans_rdm_openmp_work_2` .. c:function:: get_all_spin_singles_3: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5376,14 +6071,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles` * :c:func:`h_s2_u_0_nstates_openmp_work_3` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_3` * :c:func:`orb_range_2_rdm_openmp_work_3` * :c:func:`orb_range_2_rdm_state_av_openmp_work_3` + * :c:func:`orb_range_2_trans_rdm_openmp_work_3` .. c:function:: get_all_spin_singles_4: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5403,8 +6100,10 @@ Subroutines / functions * :c:func:`get_all_spin_singles` * :c:func:`h_s2_u_0_nstates_openmp_work_4` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_4` * :c:func:`orb_range_2_rdm_openmp_work_4` * :c:func:`orb_range_2_rdm_state_av_openmp_work_4` + * :c:func:`orb_range_2_trans_rdm_openmp_work_4` .. c:function:: get_all_spin_singles_and_doubles: @@ -5461,14 +6160,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles_and_doubles` * :c:func:`h_s2_u_0_nstates_openmp_work_1` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_1` * :c:func:`orb_range_2_rdm_openmp_work_1` * :c:func:`orb_range_2_rdm_state_av_openmp_work_1` + * :c:func:`orb_range_2_trans_rdm_openmp_work_1` .. c:function:: get_all_spin_singles_and_doubles_2: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5490,14 +6191,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles_and_doubles` * :c:func:`h_s2_u_0_nstates_openmp_work_2` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_2` * :c:func:`orb_range_2_rdm_openmp_work_2` * :c:func:`orb_range_2_rdm_state_av_openmp_work_2` + * :c:func:`orb_range_2_trans_rdm_openmp_work_2` .. c:function:: get_all_spin_singles_and_doubles_3: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5519,14 +6222,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles_and_doubles` * :c:func:`h_s2_u_0_nstates_openmp_work_3` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_3` * :c:func:`orb_range_2_rdm_openmp_work_3` * :c:func:`orb_range_2_rdm_state_av_openmp_work_3` + * :c:func:`orb_range_2_trans_rdm_openmp_work_3` .. c:function:: get_all_spin_singles_and_doubles_4: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5548,14 +6253,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles_and_doubles` * :c:func:`h_s2_u_0_nstates_openmp_work_4` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_4` * :c:func:`orb_range_2_rdm_openmp_work_4` * :c:func:`orb_range_2_rdm_state_av_openmp_work_4` + * :c:func:`orb_range_2_trans_rdm_openmp_work_4` .. c:function:: get_all_spin_singles_and_doubles_n_int: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5584,14 +6291,16 @@ Subroutines / functions * :c:func:`get_all_spin_singles_and_doubles` * :c:func:`h_s2_u_0_nstates_openmp_work_n_int` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp_work_n_int` * :c:func:`orb_range_2_rdm_openmp_work_n_int` * :c:func:`orb_range_2_rdm_state_av_openmp_work_n_int` + * :c:func:`orb_range_2_trans_rdm_openmp_work_n_int` .. c:function:: get_all_spin_singles_n_int: - File : :file:`determinants/spindeterminants.irp.f_template_1316` + File : :file:`determinants/spindeterminants.irp.f_template_1365` .. code:: fortran @@ -5618,8 +6327,10 @@ Subroutines / functions * :c:func:`get_all_spin_singles` * :c:func:`h_s2_u_0_nstates_openmp_work_n_int` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp_work_n_int` * :c:func:`orb_range_2_rdm_openmp_work_n_int` * :c:func:`orb_range_2_rdm_state_av_openmp_work_n_int` + * :c:func:`orb_range_2_trans_rdm_openmp_work_n_int` .. c:function:: get_double_excitation: @@ -5648,6 +6359,7 @@ Subroutines / functions * :c:func:`i_h_j_verbose` * :c:func:`orb_range_off_diag_double_to_2_rdm_ab_dm_buffer` * :c:func:`orb_range_off_diag_double_to_all_states_ab_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_ab_trans_rdm_buffer` .. c:function:: get_double_excitation_spin: @@ -5673,7 +6385,9 @@ Subroutines / functions * :c:func:`orb_range_off_diag_double_to_2_rdm_aa_dm_buffer` * :c:func:`orb_range_off_diag_double_to_2_rdm_bb_dm_buffer` * :c:func:`orb_range_off_diag_double_to_all_states_aa_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_aa_trans_rdm_buffer` * :c:func:`orb_range_off_diag_double_to_all_states_bb_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_trans_rdm_bb_buffer` .. c:function:: get_excitation: @@ -5695,6 +6409,7 @@ Subroutines / functions * :c:func:`example_determinants` * :c:func:`get_phase` + * :c:func:`pt2_moller_plesset` Calls: @@ -5726,6 +6441,9 @@ Subroutines / functions * :c:func:`connected_to_hf` * :c:func:`diag_h_mat_elem_fock` * :c:func:`example_determinants` + * :c:data:`exc_degree_per_selectors` + * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` * :c:func:`get_excitation` * :c:func:`get_s2` * :c:func:`i_h_j` @@ -5734,7 +6452,9 @@ Subroutines / functions * :c:func:`i_h_j_two_e` * :c:func:`i_h_j_verbose` * :c:data:`max_degree_exc` + * :c:data:`psi_configuration_to_psi_det` * :c:data:`psi_non_cas` + * :c:func:`pt2_qdpt` .. c:function:: get_excitation_degree_spin: @@ -5754,8 +6474,14 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` * :c:func:`get_excitation_spin` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` + * :c:func:`select_singles_and_doubles` .. c:function:: get_excitation_degree_vector: @@ -5848,6 +6574,36 @@ Subroutines / functions * :c:func:`debug_det` +.. c:function:: get_excitation_general: + + + File : :file:`determinants/slater_rules_general.irp.f` + + .. code:: fortran + + subroutine get_excitation_general(key_i,key_j, Nint,degree_array,holes_array, particles_array,phase) + + + returns the array, for each spin, of holes/particles between key_i and key_j + + with the following convention: a^+_{particle} a_{hole}|key_i> = |key_j> + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`do_single_excitation` + * :c:func:`get_single_excitation` + + .. c:function:: get_excitation_spin: @@ -5870,6 +6626,28 @@ Subroutines / functions * :c:func:`get_single_excitation_spin` +.. c:function:: get_holes_general: + + + File : :file:`determinants/slater_rules_general.irp.f` + + .. code:: fortran + + subroutine get_holes_general(key_i, key_j,Nint, holes_array) + + + returns the array, per spin, of holes between key_i and key_j + + with the following convention: a_{hole}|key_i> --> |key_j> + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + + .. c:function:: get_index_in_psi_det_alpha_unique: @@ -5921,6 +6699,7 @@ Subroutines / functions Returns the index of the determinant in the ``psi_det_sorted_bit`` array + using a binary search Needs: @@ -5951,7 +6730,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det` * :c:data:`n_int` - * :c:data:`n_states` * :c:data:`psi_coef` * :c:data:`psi_det` @@ -5963,6 +6741,35 @@ Subroutines / functions * :c:func:`bitstring_to_list_ab` +.. c:function:: get_particles_general: + + + File : :file:`determinants/slater_rules_general.irp.f` + + .. code:: fortran + + subroutine get_particles_general(key_i, key_j,Nint,particles_array) + + + returns the array, per spin, of particles between key_i and key_j + + with the following convention: a^dagger_{particle}|key_i> --> |key_j> + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`debug_det` + + .. c:function:: get_phase: @@ -5990,6 +6797,33 @@ Subroutines / functions * :c:func:`get_excitation` +.. c:function:: get_phase_general: + + + File : :file:`determinants/slater_rules_general.irp.f` + + .. code:: fortran + + subroutine get_phase_general(key_i,Nint,degree, holes_array, particles_array,phase) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_int` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`do_single_excitation` + * :c:func:`get_single_excitation` + + .. c:function:: get_phasemask_bit: @@ -6062,7 +6896,10 @@ Subroutines / functions * :c:func:`connected_to_hf` * :c:func:`diag_h_mat_elem_fock` + * :c:func:`do_signed_mono_excitation` * :c:func:`get_excitation` + * :c:func:`get_excitation_general` + * :c:func:`get_phase_general` * :c:func:`i_h_j` * :c:func:`i_h_j_one_e` * :c:func:`i_h_j_s2` @@ -6072,8 +6909,11 @@ Subroutines / functions * :c:func:`orb_range_off_diag_single_to_2_rdm_ab_dm_buffer` * :c:func:`orb_range_off_diag_single_to_2_rdm_bb_dm_buffer` * :c:func:`orb_range_off_diag_single_to_all_states_aa_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_aa_trans_rdm_buffer` * :c:func:`orb_range_off_diag_single_to_all_states_ab_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_ab_trans_rdm_buffer` * :c:func:`orb_range_off_diag_single_to_all_states_bb_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_bb_trans_rdm_buffer` .. c:function:: get_single_excitation_from_fock: @@ -6137,7 +6977,10 @@ Subroutines / functions * :c:func:`i_h_j_mono_spin_one_e` * :c:func:`i_h_j_single_spin` * :c:func:`i_wee_j_single` + * :c:data:`multi_s_dipole_moment` * :c:data:`one_e_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` .. c:function:: get_uj_s2_ui: @@ -6187,6 +7030,18 @@ Subroutines / functions * :c:data:`mo_num` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`perturb_buffer_dummy` + * :c:func:`perturb_buffer_epstein_nesbet` + * :c:func:`perturb_buffer_epstein_nesbet_2x2` + * :c:func:`perturb_buffer_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`perturb_buffer_moller_plesset` + * :c:func:`perturb_buffer_qdpt` + Calls: .. hlist:: @@ -6214,23 +7069,30 @@ Subroutines / functions * :c:data:`big_array_coulomb_integrals` * :c:data:`big_array_coulomb_integrals` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_integrals_map` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_int` Called by: .. hlist:: :columns: 3 + * :c:func:`calc_hess_elem` + * :c:data:`coef_hf_selector` * :c:func:`connected_to_hf` * :c:func:`example_determinants` + * :c:func:`get_d0` + * :c:func:`get_d0_reference` + * :c:func:`get_d1` + * :c:func:`get_d1_reference` + * :c:func:`get_m0` + * :c:func:`get_m1` * :c:data:`h_matrix_all_dets` * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` * :c:func:`i_h_psi` * :c:func:`i_h_psi_minilist` + * :c:func:`pt2_qdpt` * :c:func:`routine_example_psi_det` Calls: @@ -6283,6 +7145,11 @@ Subroutines / functions * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_n_int` Calls: @@ -6329,6 +7196,11 @@ Subroutines / functions * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_n_int` Calls: @@ -6415,11 +7287,8 @@ Subroutines / functions * :c:data:`big_array_coulomb_integrals` * :c:data:`big_array_coulomb_integrals` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_integrals_map` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_int` Calls: @@ -6464,6 +7333,11 @@ Subroutines / functions * :c:func:`h_s2_u_0_nstates_openmp_work_3` * :c:func:`h_s2_u_0_nstates_openmp_work_4` * :c:func:`h_s2_u_0_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_n_int` Calls: @@ -6493,13 +7367,17 @@ Subroutines / functions * :c:data:`big_array_coulomb_integrals` * :c:data:`big_array_coulomb_integrals` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`mo_integrals_map` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_int` * :c:data:`ref_bitmask_energy` + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`psi_energy_two_e_trans` + Calls: .. hlist:: @@ -6534,7 +7412,6 @@ Subroutines / functions * :c:data:`mo_integrals_map` * :c:data:`mo_one_e_integrals` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`n_int` Calls: @@ -6564,12 +7441,16 @@ Subroutines / functions The i_H_psi_minilist is much faster but requires to build the minilists. - Needs: + Called by: .. hlist:: :columns: 3 - * :c:data:`n_int` + * :c:func:`calc_grad_elem` + * :c:func:`calc_hess_elem` + * :c:func:`pt2_epstein_nesbet_2x2` + * :c:func:`pt2_epstein_nesbet_2x2_no_ci_diag` + * :c:func:`remove_small_contributions` Calls: @@ -6595,12 +7476,15 @@ Subroutines / functions Uses filter_connected_i_H_psi0 to get all the $|J \rangle$ to which $|i \rangle$ is connected. The $|J\rangle$ are searched in short pre-computed lists. - Needs: + Called by: .. hlist:: :columns: 3 - * :c:data:`n_int` + * :c:func:`pt2_dummy` + * :c:func:`pt2_epstein_nesbet` + * :c:func:`pt2_moller_plesset` + * :c:func:`pt2_qdpt` Calls: @@ -6626,13 +7510,6 @@ Subroutines / functions Uses filter_connected_i_H_psi0 to get all the $|J\rangle$ to which $|i\rangle$ is connected. The $|J\rangle$ are searched in short pre-computed lists. - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - Calls: .. hlist:: @@ -6695,13 +7572,6 @@ Subroutines / functions Returns |true| if determinant ``key`` is connected to ``keys`` - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - .. c:function:: is_connected_to_by_single: @@ -6715,13 +7585,6 @@ Subroutines / functions Returns |true| is ``key`` is connected to ``keys`` by a single excitation. - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - .. c:function:: is_in_wavefunction: @@ -6757,14 +7620,14 @@ Subroutines / functions * :c:data:`n_int` -.. c:function:: make_s2_eigenfunction: +.. c:function:: print_dipole_moments: - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/dipole_moments.irp.f` .. code:: fortran - subroutine make_s2_eigenfunction + subroutine print_dipole_moments @@ -6773,201 +7636,67 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`psi_occ_pattern` - * :c:data:`psi_coef` - * :c:data:`psi_det` - * :c:data:`psi_occ_pattern` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`copy_h_apply_buffer_to_wf` - * :c:func:`fill_h_apply_buffer_no_selection` - * :c:func:`occ_pattern_to_dets` - * :c:func:`occ_pattern_to_dets_size` - * :c:func:`write_int` - * :c:func:`write_time` - - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det` - * :c:data:`psi_occ_pattern` - * :c:data:`c0_weight` - * :c:data:`psi_coef` - * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_det` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted_bit` - * :c:data:`psi_occ_pattern` + * :c:data:`n_states` + * :c:data:`z_dipole_moment` -.. c:function:: occ_pattern_of_det: +.. c:function:: read_dets: - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/determinants.irp.f` .. code:: fortran - subroutine occ_pattern_of_det(d,o,Nint) - - - Transforms a determinant to an occupation pattern - - occ(:,1) : Single occupations - - occ(:,2) : Double occupations - - - -.. c:function:: occ_pattern_search_key: - + subroutine read_dets(det,Nint,Ndet) - File : :file:`determinants/connected_to_ref.irp.f` - .. code:: fortran + Reads the determinants from the |EZFIO| file - integer*8 function occ_pattern_search_key(det,Nint) + Called by: + .. hlist:: + :columns: 3 - Return an integer*8 corresponding to a determinant index for searching + * :c:data:`psi_det` - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` + * :c:func:`ezfio_get_determinants_bit_kind` + * :c:func:`ezfio_get_determinants_n_int` + * :c:func:`ezfio_get_determinants_psi_det` -.. c:function:: occ_pattern_to_dets: +.. c:function:: read_spindeterminants: - File : :file:`determinants/occ_pattern.irp.f` + File : :file:`determinants/spindeterminants.irp.f` .. code:: fortran - subroutine occ_pattern_to_dets(o,d,sze,n_alpha,Nint) + subroutine read_spindeterminants - Generate all possible determinants for a given occ_pattern - - Input : - o : occupation pattern : (doubly occupied, singly occupied) - sze : Number of produced determinants, computed by `occ_pattern_to_dets_size` - n_alpha : Number of $\alpha$ electrons - Nint : N_int - - Output: - d : determinants - Needs: .. hlist:: :columns: 3 - * :c:data:`binom_int` + * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`n_states` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`make_s2_eigenfunction` - - -.. c:function:: occ_pattern_to_dets_size: - - - File : :file:`determinants/occ_pattern.irp.f` - - .. code:: fortran - - subroutine occ_pattern_to_dets_size(o,sze,n_alpha,Nint) - - - Number of possible determinants for a given occ_pattern - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`binom_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`make_s2_eigenfunction` - - -.. c:function:: read_dets: - - - File : :file:`determinants/determinants.irp.f` - - .. code:: fortran - - subroutine read_dets(det,Nint,Ndet) - - - Reads the determinants from the |EZFIO| file - - Called by: - - .. hlist:: - :columns: 3 - - * :c:data:`psi_det` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`ezfio_get_determinants_bit_kind` - * :c:func:`ezfio_get_determinants_n_int` - * :c:func:`ezfio_get_determinants_psi_det` - - -.. c:function:: read_spindeterminants: - - - File : :file:`determinants/spindeterminants.irp.f` - - .. code:: fortran - - subroutine read_spindeterminants - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`n_states` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - - Calls: + Calls: .. hlist:: :columns: 3 @@ -7048,6 +7777,54 @@ Subroutines / functions * :c:data:`psi_det_sorted_bit` +.. c:function:: replace_wf: + + + File : :file:`determinants/h_apply.irp.f` + + .. code:: fortran + + subroutine replace_wf(N_det_new, LDA, psi_coef_new, psi_det_new) + + + Replaces the wave function. + After calling this subroutine, N_det, psi_det and psi_coef need to be touched + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`h_apply_buffer_allocated` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`nproc` + * :c:data:`psi_coef` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`abort` + * :c:func:`copy_h_apply_buffer_to_wf` + * :c:func:`fill_h_apply_buffer_no_selection` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`c0_weight` + * :c:data:`psi_coef` + * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_det` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted_bit` + + .. c:function:: resize_h_apply_buffer: @@ -7066,8 +7843,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` * :c:data:`n_int` @@ -7080,6 +7855,14 @@ Subroutines / functions :columns: 3 * :c:func:`fill_h_apply_buffer_no_selection` + * :c:func:`fill_h_apply_buffer_selection` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`abort` .. c:function:: routine_example_psi_det: @@ -7165,7 +7948,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`n_int` * :c:data:`ref_bitmask_energy` Called by: @@ -7227,6 +8009,88 @@ Subroutines / functions * :c:data:`mo_occ` +.. c:function:: save_natural_mos_canon_label: + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + subroutine save_natural_mos_canon_label + + + Save natural orbitals, obtained by diagonalization of the one-body density matrix in + the |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_coef` + * :c:data:`mo_num` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`nullify_small_elements` + * :c:func:`orthonormalize_mos` + * :c:func:`save_mos` + * :c:func:`set_natural_mos_canon_label` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_coef` + * :c:data:`mo_occ` + + +.. c:function:: save_natural_mos_no_ov_rot: + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + subroutine save_natural_mos_no_ov_rot + + + Save natural orbitals, obtained by diagonalization of the one-body density matrix in + the |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_coef` + * :c:data:`mo_num` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`nullify_small_elements` + * :c:func:`orthonormalize_mos` + * :c:func:`save_mos` + * :c:func:`set_natorb_no_ov_rot` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_coef` + * :c:data:`mo_occ` + + .. c:function:: save_ref_determinant: @@ -7277,6 +8141,14 @@ Subroutines / functions * :c:data:`psi_det_sorted` * :c:data:`read_wf` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`run_cipsi` + * :c:func:`run_stochastic_cipsi` + Calls: .. hlist:: @@ -7336,6 +8208,46 @@ Subroutines / functions * :c:func:`write_int` +.. c:function:: save_wavefunction_general_unormalized: + + + File : :file:`determinants/determinants.irp.f` + + .. code:: fortran + + subroutine save_wavefunction_general_unormalized(ndet,nstates,psidet,dim_psicoef,psicoef) + + + Save the wave function into the |EZFIO| file + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_label` + * :c:data:`mpi_master` + * :c:data:`n_det_qp_edit` + * :c:data:`n_int` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ezfio_set_determinants_bit_kind` + * :c:func:`ezfio_set_determinants_mo_label` + * :c:func:`ezfio_set_determinants_n_det` + * :c:func:`ezfio_set_determinants_n_det_qp_edit` + * :c:func:`ezfio_set_determinants_n_int` + * :c:func:`ezfio_set_determinants_n_states` + * :c:func:`ezfio_set_determinants_psi_coef` + * :c:func:`ezfio_set_determinants_psi_coef_qp_edit` + * :c:func:`ezfio_set_determinants_psi_det` + * :c:func:`ezfio_set_determinants_psi_det_qp_edit` + * :c:func:`write_int` + + .. c:function:: save_wavefunction_specified: @@ -7437,6 +8349,14 @@ Subroutines / functions * :c:data:`psi_coef` * :c:data:`psi_det` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`run_orb_opt_trust_v2` + * :c:func:`update_parameters` + Calls: .. hlist:: @@ -7445,6 +8365,54 @@ Subroutines / functions * :c:func:`save_wavefunction_general` +.. c:function:: set_natorb_no_ov_rot: + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + subroutine set_natorb_no_ov_rot + + + Set natural orbitals, obtained by diagonalization of the one-body density matrix + in the |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`list_core_inact_act` + * :c:data:`list_virt` + * :c:data:`mo_num` + * :c:data:`mo_occ` + * :c:data:`n_core_inact_act_orb` + * :c:data:`n_virt_orb` + * :c:data:`one_e_dm_mo` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`save_natural_mos_no_ov_rot` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`mo_as_svd_vectors_of_mo_matrix_eig` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_occ` + + .. c:function:: set_natural_mos: @@ -7493,6 +8461,54 @@ Subroutines / functions * :c:data:`mo_occ` +.. c:function:: set_natural_mos_canon_label: + + + File : :file:`determinants/density_matrix.irp.f` + + .. code:: fortran + + subroutine set_natural_mos_canon_label + + + Set natural orbitals, obtained by diagonalization of the one-body density matrix + in the |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`list_core_inact_act` + * :c:data:`list_virt` + * :c:data:`mo_num` + * :c:data:`mo_occ` + * :c:data:`n_core_inact_act_orb` + * :c:data:`n_virt_orb` + * :c:data:`one_e_dm_mo` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`save_natural_mos_canon_label` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`mo_as_svd_vectors_of_mo_matrix_eig` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_occ` + + .. c:function:: single_excitation_wee: @@ -7710,6 +8726,57 @@ Subroutines / functions * :c:func:`s2_u_0_nstates` +.. c:function:: update_wf_of_psi_bilinear_matrix: + + + File : :file:`determinants/spindeterminants.irp.f` + + .. code:: fortran + + subroutine update_wf_of_psi_bilinear_matrix(truncate) + + + Updates a wave function when psi_bilinear_matrix was modified + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_bilinear_matrix` + * :c:data:`psi_coef` + * :c:data:`psi_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`psi_det_sorted` + * :c:data:`psi_det_sorted_bit` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`create_wf_of_psi_bilinear_matrix` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + * :c:data:`psi_coef` + * :c:data:`psi_det` + * :c:data:`psi_det_alpha_unique` + * :c:data:`psi_det_beta_unique` + + .. c:function:: wf_of_psi_bilinear_matrix: diff --git a/docs/source/modules/dft_keywords.rst b/docs/source/modules/dft_keywords.rst index 95e6b9cc..8a2ea0c1 100644 --- a/docs/source/modules/dft_keywords.rst +++ b/docs/source/modules/dft_keywords.rst @@ -47,13 +47,13 @@ EZFIO parameters name of the exchange functional - Default: short_range_LDA + Default: sr_pbe .. option:: correlation_functional name of the correlation functional - Default: short_range_LDA + Default: sr_pbe .. option:: HF_exchange @@ -61,6 +61,12 @@ EZFIO parameters Default: 0. +.. option:: mu_dft_type + + type of mu(r) for rsdft [ cst ] + + Default: cst + Providers --------- diff --git a/docs/source/modules/dft_one_e.rst b/docs/source/modules/dft_one_e.rst index a30bcd69..75b8da87 100644 --- a/docs/source/modules/dft_one_e.rst +++ b/docs/source/modules/dft_one_e.rst @@ -39,6 +39,272 @@ In the core modules of the |QP|, two functionals are implemented: Providers --------- +.. c:var:: ao_effective_one_e_potential + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_effective_one_e_potential (ao_num,ao_num,N_states) + double precision, allocatable :: ao_effective_one_e_potential_without_kin (ao_num,ao_num,N_states) + + + Effective_one_e_potential(i,j) = :math:`\rangle i_{AO}| v_{H}^{sr} |j_{AO}\rangle + \rangle i_{AO}| h_{core} |j_{AO}\rangle + \rangle i_{AO}|v_{xc} |j_{AO}\rangle` + + on the |MO| basis + + Taking the expectation value does not provide any energy, but + + ao_effective_one_e_potential(i,j) is the potential coupling DFT and WFT parts + + and it is used in any RS-DFT based calculations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`effective_one_e_potential` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`s_mo_coef` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_effective_one_e_potential_sa` + + +.. c:var:: ao_effective_one_e_potential_sa + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_effective_one_e_potential_sa (ao_num,ao_num) + double precision, allocatable :: ao_effective_one_e_potential_without_kin_sa (ao_num,ao_num) + + + State-averaged potential in AO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_effective_one_e_potential` + * :c:data:`ao_num` + * :c:data:`n_states` + * :c:data:`state_average_weight` + + + +.. c:var:: ao_effective_one_e_potential_without_kin + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_effective_one_e_potential (ao_num,ao_num,N_states) + double precision, allocatable :: ao_effective_one_e_potential_without_kin (ao_num,ao_num,N_states) + + + Effective_one_e_potential(i,j) = :math:`\rangle i_{AO}| v_{H}^{sr} |j_{AO}\rangle + \rangle i_{AO}| h_{core} |j_{AO}\rangle + \rangle i_{AO}|v_{xc} |j_{AO}\rangle` + + on the |MO| basis + + Taking the expectation value does not provide any energy, but + + ao_effective_one_e_potential(i,j) is the potential coupling DFT and WFT parts + + and it is used in any RS-DFT based calculations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`effective_one_e_potential` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`s_mo_coef` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_effective_one_e_potential_sa` + + +.. c:var:: ao_effective_one_e_potential_without_kin_sa + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_effective_one_e_potential_sa (ao_num,ao_num) + double precision, allocatable :: ao_effective_one_e_potential_without_kin_sa (ao_num,ao_num) + + + State-averaged potential in AO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_effective_one_e_potential` + * :c:data:`ao_num` + * :c:data:`n_states` + * :c:data:`state_average_weight` + + + +.. c:var:: effective_one_e_potential + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: effective_one_e_potential (mo_num,mo_num,N_states) + double precision, allocatable :: effective_one_e_potential_without_kin (mo_num,mo_num,N_states) + + + Effective_one_e_potential(i,j) = :math:`\rangle i_{MO}| v_{H}^{sr} |j_{MO}\rangle + \rangle i_{MO}| h_{core} |j_{MO}\rangle + \rangle i_{MO}|v_{xc} |j_{MO}\rangle` + + on the |MO| basis + + Taking the expectation value does not provide any energy, but + + effective_one_e_potential(i,j) is the potential coupling DFT and WFT parts + + and it is used in any RS-DFT based calculations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_n_e` + * :c:data:`mo_kinetic_integrals` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`potential_c_alpha_mo` + * :c:data:`potential_x_alpha_mo` + * :c:data:`short_range_hartree_operator` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_effective_one_e_potential` + * :c:data:`effective_one_e_potential_sa` + + +.. c:var:: effective_one_e_potential_sa + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: effective_one_e_potential_sa (mo_num,mo_num) + double precision, allocatable :: effective_one_e_potential_without_kin_sa (mo_num,mo_num) + + + State-averaged potential in MO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`effective_one_e_potential` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`state_average_weight` + + + +.. c:var:: effective_one_e_potential_without_kin + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: effective_one_e_potential (mo_num,mo_num,N_states) + double precision, allocatable :: effective_one_e_potential_without_kin (mo_num,mo_num,N_states) + + + Effective_one_e_potential(i,j) = :math:`\rangle i_{MO}| v_{H}^{sr} |j_{MO}\rangle + \rangle i_{MO}| h_{core} |j_{MO}\rangle + \rangle i_{MO}|v_{xc} |j_{MO}\rangle` + + on the |MO| basis + + Taking the expectation value does not provide any energy, but + + effective_one_e_potential(i,j) is the potential coupling DFT and WFT parts + + and it is used in any RS-DFT based calculations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_n_e` + * :c:data:`mo_kinetic_integrals` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`potential_c_alpha_mo` + * :c:data:`potential_x_alpha_mo` + * :c:data:`short_range_hartree_operator` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_effective_one_e_potential` + * :c:data:`effective_one_e_potential_sa` + + +.. c:var:: effective_one_e_potential_without_kin_sa + + + File : :file:`dft_one_e/effective_pot.irp.f` + + .. code:: fortran + + double precision, allocatable :: effective_one_e_potential_sa (mo_num,mo_num) + double precision, allocatable :: effective_one_e_potential_without_kin_sa (mo_num,mo_num) + + + State-averaged potential in MO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`effective_one_e_potential` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`state_average_weight` + + + .. c:var:: energy_c @@ -59,8 +325,8 @@ Providers * :c:data:`correlation_functional` * :c:data:`energy_c_lda` * :c:data:`energy_c_none` - * :c:data:`energy_c_pbe` * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_pbe` * :c:data:`energy_x_sr_pbe` * :c:data:`n_states` @@ -95,6 +361,7 @@ Providers * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` * :c:data:`exchange_functional` + * :c:data:`hf_exchange` * :c:data:`n_states` Needed by: @@ -105,6 +372,158 @@ Providers * :c:data:`e_exchange_dft` +.. c:var:: mu_erf_dft + + + File : :file:`dft_one_e/mu_erf_dft.irp.f` + + .. code:: fortran + + double precision :: mu_erf_dft + + + range separation parameter used in RS-DFT. + + It is set to mu_erf in order to be consistent with the module "hamiltonian" + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_erf` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_of_r_dft` + + +.. c:var:: mu_grad_rho + + + File : :file:`dft_one_e/mu_erf_dft.irp.f` + + .. code:: fortran + + double precision, allocatable :: mu_grad_rho (n_points_final_grid) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_grid_points` + * :c:data:`mu_erf` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_of_r_dft` + + +.. c:var:: mu_of_r_dft + + + File : :file:`dft_one_e/mu_erf_dft.irp.f` + + .. code:: fortran + + double precision, allocatable :: mu_of_r_dft (n_points_final_grid) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_dft_type` + * :c:data:`mu_erf_dft` + * :c:data:`mu_grad_rho` + * :c:data:`mu_of_r_hf` + * :c:data:`mu_rsc_of_r` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_sr_lda` + * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_of_r_dft_average` + + +.. c:var:: mu_of_r_dft_average + + + File : :file:`dft_one_e/mu_erf_dft.irp.f` + + .. code:: fortran + + double precision :: mu_of_r_dft_average + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`final_grid_points` + * :c:data:`mu_of_r_dft` + * :c:data:`n_points_final_grid` + * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` + + + +.. c:var:: mu_rsc_of_r + + + File : :file:`dft_one_e/mu_erf_dft.irp.f` + + .. code:: fortran + + double precision, allocatable :: mu_rsc_of_r (n_points_final_grid) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` + * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_of_r_dft` + + .. c:var:: potential_c_alpha_ao @@ -265,6 +684,7 @@ Providers * :c:data:`ao_num` * :c:data:`exchange_functional` + * :c:data:`hf_exchange` * :c:data:`n_states` * :c:data:`potential_x_alpha_ao_lda` * :c:data:`potential_x_alpha_ao_none` @@ -335,6 +755,7 @@ Providers * :c:data:`ao_num` * :c:data:`exchange_functional` + * :c:data:`hf_exchange` * :c:data:`n_states` * :c:data:`potential_x_alpha_ao_lda` * :c:data:`potential_x_alpha_ao_none` @@ -521,6 +942,254 @@ Providers * :c:data:`trace_v_xc_new` +.. c:var:: psi_dft_energy_h_core + + + File : :file:`dft_one_e/one_e_energy_dft.irp.f` + + .. code:: fortran + + double precision, allocatable :: psi_dft_energy_kinetic (N_states) + double precision, allocatable :: psi_dft_energy_nuclear_elec (N_states) + double precision, allocatable :: psi_dft_energy_h_core (N_states) + + + kinetic, electron-nuclear and total h_core energy computed with the density matrix one_e_dm_mo_beta_for_dft+one_e_dm_mo_alpha_for_dft + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_integrals_n_e` + * :c:data:`mo_kinetic_integrals` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_mo_alpha_for_dft` + * :c:data:`one_e_dm_mo_beta_for_dft` + + + +.. c:var:: psi_dft_energy_kinetic + + + File : :file:`dft_one_e/one_e_energy_dft.irp.f` + + .. code:: fortran + + double precision, allocatable :: psi_dft_energy_kinetic (N_states) + double precision, allocatable :: psi_dft_energy_nuclear_elec (N_states) + double precision, allocatable :: psi_dft_energy_h_core (N_states) + + + kinetic, electron-nuclear and total h_core energy computed with the density matrix one_e_dm_mo_beta_for_dft+one_e_dm_mo_alpha_for_dft + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_integrals_n_e` + * :c:data:`mo_kinetic_integrals` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_mo_alpha_for_dft` + * :c:data:`one_e_dm_mo_beta_for_dft` + + + +.. c:var:: psi_dft_energy_nuclear_elec + + + File : :file:`dft_one_e/one_e_energy_dft.irp.f` + + .. code:: fortran + + double precision, allocatable :: psi_dft_energy_kinetic (N_states) + double precision, allocatable :: psi_dft_energy_nuclear_elec (N_states) + double precision, allocatable :: psi_dft_energy_h_core (N_states) + + + kinetic, electron-nuclear and total h_core energy computed with the density matrix one_e_dm_mo_beta_for_dft+one_e_dm_mo_alpha_for_dft + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_integrals_n_e` + * :c:data:`mo_kinetic_integrals` + * :c:data:`mo_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_mo_alpha_for_dft` + * :c:data:`one_e_dm_mo_beta_for_dft` + + + +.. c:var:: regular_range_hartree + + + File : :file:`dft_one_e/sr_coulomb.irp.f` + + .. code:: fortran + + double precision, allocatable :: regular_range_hartree_operator (mo_num,mo_num,N_states) + double precision, allocatable :: regular_range_hartree (N_states) + + + regular_range_Hartree_operator(i,j) = :math:`\int dr i(r)j(r) \int r' \rho(r') W_{ee}^{sr}` + + regular_range_Hartree = :math:`1/2 \sum_{i,j} \rho_{ij} \mathtt{regular_range_Hartree_operator}(i,j)` + + = :math:`1/2 \int dr \int r' \rho(r) \rho(r') W_{ee}^{sr}` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_states` + * :c:data:`one_e_dm_average_mo_for_dft` + * :c:data:`one_e_dm_mo_for_dft` + + + +.. c:var:: regular_range_hartree_operator + + + File : :file:`dft_one_e/sr_coulomb.irp.f` + + .. code:: fortran + + double precision, allocatable :: regular_range_hartree_operator (mo_num,mo_num,N_states) + double precision, allocatable :: regular_range_hartree (N_states) + + + regular_range_Hartree_operator(i,j) = :math:`\int dr i(r)j(r) \int r' \rho(r') W_{ee}^{sr}` + + regular_range_Hartree = :math:`1/2 \sum_{i,j} \rho_{ij} \mathtt{regular_range_Hartree_operator}(i,j)` + + = :math:`1/2 \int dr \int r' \rho(r) \rho(r') W_{ee}^{sr}` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_states` + * :c:data:`one_e_dm_average_mo_for_dft` + * :c:data:`one_e_dm_mo_for_dft` + + + +.. c:var:: short_range_hartree + + + File : :file:`dft_one_e/sr_coulomb.irp.f` + + .. code:: fortran + + double precision, allocatable :: short_range_hartree_operator (mo_num,mo_num,N_states) + double precision, allocatable :: short_range_hartree (N_states) + + + short_range_Hartree_operator(i,j) = :math:`\int dr i(r)j(r) \int r' \rho(r') W_{ee}^{sr}` + + short_range_Hartree = :math:`1/2 \sum_{i,j} \rho_{ij} \mathtt{short_range_Hartree_operator}(i,j)` + + = :math:`1/2 \int dr \int r' \rho(r) \rho(r') W_{ee}^{sr}` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_states` + * :c:data:`one_e_dm_average_mo_for_dft` + * :c:data:`one_e_dm_mo_for_dft` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`effective_one_e_potential` + * :c:data:`trace_v_xc` + + +.. c:var:: short_range_hartree_operator + + + File : :file:`dft_one_e/sr_coulomb.irp.f` + + .. code:: fortran + + double precision, allocatable :: short_range_hartree_operator (mo_num,mo_num,N_states) + double precision, allocatable :: short_range_hartree (N_states) + + + short_range_Hartree_operator(i,j) = :math:`\int dr i(r)j(r) \int r' \rho(r') W_{ee}^{sr}` + + short_range_Hartree = :math:`1/2 \sum_{i,j} \rho_{ij} \mathtt{short_range_Hartree_operator}(i,j)` + + = :math:`1/2 \int dr \int r' \rho(r) \rho(r') W_{ee}^{sr}` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_states` + * :c:data:`one_e_dm_average_mo_for_dft` + * :c:data:`one_e_dm_mo_for_dft` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`effective_one_e_potential` + * :c:data:`trace_v_xc` + + .. c:var:: trace_v_h diff --git a/docs/source/modules/dft_utils_in_r.rst b/docs/source/modules/dft_utils_in_r.rst index a6630626..153353bd 100644 --- a/docs/source/modules/dft_utils_in_r.rst +++ b/docs/source/modules/dft_utils_in_r.rst @@ -24,322 +24,215 @@ The main providers for this module are: Providers --------- -.. c:var:: aos_grad_in_r_array +.. c:var:: alpha_dens_kin_in_r - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/mo_in_r.irp.f` .. code:: fortran - double precision, allocatable :: aos_grad_in_r_array (ao_num,n_points_final_grid,3) + double precision, allocatable :: alpha_dens_kin_in_r (n_points_final_grid) + double precision, allocatable :: beta_dens_kin_in_r (n_points_final_grid) - aos_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith ao on the jth grid point - - k = 1 : x, k= 2, y, k 3, z Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` - * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` - * :c:data:`final_grid_points` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mos_grad_in_r_array_tranp` * :c:data:`n_points_final_grid` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`mos_grad_in_r_array` -.. c:var:: aos_grad_in_r_array_transp +.. c:var:: ao_abs_int_grid - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_prod_mlti_pl.irp.f` .. code:: fortran - double precision, allocatable :: aos_grad_in_r_array_transp (n_points_final_grid,ao_num,3) + double precision, allocatable :: ao_abs_int_grid (ao_num) - aos_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth ao on the ith grid point - - k = 1 : x, k= 2, y, k 3, z + ao_abs_int_grid(i) = \int dr |phi_i(r) | Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` + * :c:data:`aos_in_r_array` * :c:data:`final_grid_points` * :c:data:`n_points_final_grid` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` -.. c:var:: aos_grad_in_r_array_transp_xyz +.. c:var:: ao_overlap_abs_grid - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_prod_mlti_pl.irp.f` .. code:: fortran - double precision, allocatable :: aos_grad_in_r_array_transp_xyz (3,ao_num,n_points_final_grid) + double precision, allocatable :: ao_overlap_abs_grid (ao_num,ao_num) - aos_grad_in_r_array_transp_xyz(k,i,j) = value of the kth component of the gradient of jth ao on the ith grid point - - k = 1 : x, k= 2, y, k 3, z + ao_overlap_abs_grid(j,i) = \int dr |phi_i(r) phi_j(r)| Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` + * :c:data:`aos_in_r_array` * :c:data:`final_grid_points` * :c:data:`n_points_final_grid` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` Needed by: .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` - * :c:data:`aos_vc_alpha_pbe_w` - * :c:data:`aos_vxc_alpha_pbe_w` + * :c:data:`ao_prod_center` + * :c:data:`ao_prod_sigma` -.. c:var:: aos_in_r_array +.. c:var:: ao_prod_abs_r - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_prod_mlti_pl.irp.f` .. code:: fortran - double precision, allocatable :: aos_in_r_array (ao_num,n_points_final_grid) - double precision, allocatable :: aos_in_r_array_transp (n_points_final_grid,ao_num) + double precision, allocatable :: ao_prod_abs_r (ao_num,ao_num) - aos_in_r_array(i,j) = value of the ith ao on the jth grid point + ao_prod_abs_r(i,j) = \int |phi_i(r) phi_j(r)| dsqrt((x - <|i|x|j|>)^2 + (y - <|i|y|j|>)^2 +(z - <|i|z|j|>)^2) / \int |phi_i(r) phi_j(r)| - aos_in_r_array_transp(i,j) = value of the jth ao on the ith grid point Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` + * :c:data:`ao_prod_center` + * :c:data:`aos_in_r_array` * :c:data:`final_grid_points` * :c:data:`n_points_final_grid` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` Needed by: .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_lda_w` - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_lda_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` - * :c:data:`aos_vc_alpha_lda_w` - * :c:data:`aos_vc_alpha_pbe_w` - * :c:data:`aos_vxc_alpha_lda_w` - * :c:data:`aos_vxc_alpha_pbe_w` - * :c:data:`pot_grad_x_alpha_ao_pbe` - * :c:data:`pot_grad_xc_alpha_ao_pbe` - * :c:data:`pot_scal_x_alpha_ao_pbe` - * :c:data:`pot_scal_xc_alpha_ao_pbe` - * :c:data:`pot_sr_grad_x_alpha_ao_pbe` - * :c:data:`pot_sr_grad_xc_alpha_ao_pbe` - * :c:data:`pot_sr_scal_x_alpha_ao_pbe` - * :c:data:`pot_sr_scal_xc_alpha_ao_pbe` - * :c:data:`potential_c_alpha_ao_lda` - * :c:data:`potential_c_alpha_ao_sr_lda` - * :c:data:`potential_x_alpha_ao_lda` - * :c:data:`potential_x_alpha_ao_sr_lda` - * :c:data:`potential_xc_alpha_ao_lda` - * :c:data:`potential_xc_alpha_ao_sr_lda` + * :c:data:`ao_prod_sigma` -.. c:var:: aos_in_r_array_per_atom +.. c:var:: ao_prod_center - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_prod_mlti_pl.irp.f` .. code:: fortran - double precision, allocatable :: aos_in_r_array_per_atom (ao_num,n_pts_max_per_atom,nucl_num) - double precision, allocatable :: aos_in_r_array_per_atom_transp (n_pts_max_per_atom,ao_num,nucl_num) + double precision, allocatable :: ao_prod_center (3,ao_num,ao_num) - aos_in_r_array_per_atom(i,j,k) = value of the ith ao on the jth grid point attached on the kth atom + ao_prod_center(1:3,j,i) = \int dr |phi_i(r) phi_j(r)| x/y/z / \int |phi_i(r) phi_j(r)| + + if \int |phi_i(r) phi_j(r)| < 1.d-10 then ao_prod_center = 10000. Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` - * :c:data:`final_grid_points_per_atom` - * :c:data:`n_pts_per_atom` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` + * :c:data:`ao_overlap_abs_grid` + * :c:data:`aos_in_r_array` + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_prod_abs_r` + * :c:data:`ao_prod_dist_grid` -.. c:var:: aos_in_r_array_per_atom_transp +.. c:var:: ao_prod_dist_grid - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_prod_mlti_pl.irp.f` .. code:: fortran - double precision, allocatable :: aos_in_r_array_per_atom (ao_num,n_pts_max_per_atom,nucl_num) - double precision, allocatable :: aos_in_r_array_per_atom_transp (n_pts_max_per_atom,ao_num,nucl_num) + double precision, allocatable :: ao_prod_dist_grid (ao_num,ao_num,n_points_final_grid) - aos_in_r_array_per_atom(i,j,k) = value of the ith ao on the jth grid point attached on the kth atom + ao_prod_dist_grid(j,i,ipoint) = distance between the center of |phi_i(r) phi_j(r)| and the grid point r(ipoint) Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` - * :c:data:`final_grid_points_per_atom` - * :c:data:`n_pts_per_atom` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` + * :c:data:`ao_prod_center` + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` -.. c:var:: aos_in_r_array_transp +.. c:var:: ao_prod_sigma - File : :file:`dft_utils_in_r/ao_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_prod_mlti_pl.irp.f` .. code:: fortran - double precision, allocatable :: aos_in_r_array (ao_num,n_points_final_grid) - double precision, allocatable :: aos_in_r_array_transp (n_points_final_grid,ao_num) + double precision, allocatable :: ao_prod_sigma (ao_num,ao_num) - aos_in_r_array(i,j) = value of the ith ao on the jth grid point + Gaussian exponent reproducing the product |chi_i(r) chi_j(r)| - aos_in_r_array_transp(i,j) = value of the jth ao on the ith grid point + Therefore |chi_i(r) chi_j(r)| \approx e^{-ao_prod_sigma(j,i) (r - ao_prod_center(1:3,j,i))**2} Needs: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` - * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` - * :c:data:`ao_power_ordered_transp_per_nucl` - * :c:data:`ao_prim_num` - * :c:data:`final_grid_points` - * :c:data:`n_points_final_grid` - * :c:data:`nucl_aos_transposed` - * :c:data:`nucl_coord` - * :c:data:`nucl_n_aos` - * :c:data:`nucl_num` - - Needed by: - - .. hlist:: - :columns: 3 + * :c:data:`ao_overlap_abs_grid` + * :c:data:`ao_prod_abs_r` - * :c:data:`aos_sr_vc_alpha_lda_w` - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_lda_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` - * :c:data:`aos_vc_alpha_lda_w` - * :c:data:`aos_vc_alpha_pbe_w` - * :c:data:`aos_vxc_alpha_lda_w` - * :c:data:`aos_vxc_alpha_pbe_w` - * :c:data:`pot_grad_x_alpha_ao_pbe` - * :c:data:`pot_grad_xc_alpha_ao_pbe` - * :c:data:`pot_scal_x_alpha_ao_pbe` - * :c:data:`pot_scal_xc_alpha_ao_pbe` - * :c:data:`pot_sr_grad_x_alpha_ao_pbe` - * :c:data:`pot_sr_grad_xc_alpha_ao_pbe` - * :c:data:`pot_sr_scal_x_alpha_ao_pbe` - * :c:data:`pot_sr_scal_xc_alpha_ao_pbe` - * :c:data:`potential_c_alpha_ao_lda` - * :c:data:`potential_c_alpha_ao_sr_lda` - * :c:data:`potential_x_alpha_ao_lda` - * :c:data:`potential_x_alpha_ao_sr_lda` - * :c:data:`potential_xc_alpha_ao_lda` - * :c:data:`potential_xc_alpha_ao_sr_lda` -.. c:var:: aos_lapl_in_r_array +.. c:var:: aos_grad_in_r_array File : :file:`dft_utils_in_r/ao_in_r.irp.f` .. code:: fortran - double precision, allocatable :: aos_lapl_in_r_array (ao_num,n_points_final_grid,3) - double precision, allocatable :: aos_lapl_in_r_array_transp (n_points_final_grid,ao_num,3) + double precision, allocatable :: aos_grad_in_r_array (ao_num,n_points_final_grid,3) - aos_lapl_in_r_array(i,j,k) = value of the kth component of the laplacian of ith ao on the jth grid point - aos_lapl_in_r_array_transp(i,j,k) = value of the kth component of the laplacian of jth ao on the ith grid point + aos_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith ao on the jth grid point k = 1 : x, k= 2, y, k 3, z + Needs: @@ -363,25 +256,22 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mos_lapl_in_r_array` + * :c:data:`aos_grad_in_r_array_transp` + * :c:data:`aos_grad_in_r_array_transp_3` + * :c:data:`aos_grad_in_r_array_transp_bis` + * :c:data:`mos_grad_in_r_array` -.. c:var:: aos_lapl_in_r_array_transp +.. c:var:: aos_grad_in_r_array_extra File : :file:`dft_utils_in_r/ao_in_r.irp.f` .. code:: fortran - double precision, allocatable :: aos_lapl_in_r_array (ao_num,n_points_final_grid,3) - double precision, allocatable :: aos_lapl_in_r_array_transp (n_points_final_grid,ao_num,3) + double precision, allocatable :: aos_grad_in_r_array_extra (ao_num,n_points_extra_final_grid,3) - aos_lapl_in_r_array(i,j,k) = value of the kth component of the laplacian of ith ao on the jth grid point - - aos_lapl_in_r_array_transp(i,j,k) = value of the kth component of the laplacian of jth ao on the ith grid point - - k = 1 : x, k= 2, y, k 3, z Needs: @@ -393,37 +283,28 @@ Providers * :c:data:`ao_num` * :c:data:`ao_power_ordered_transp_per_nucl` * :c:data:`ao_prim_num` - * :c:data:`final_grid_points` - * :c:data:`n_points_final_grid` + * :c:data:`final_grid_points_extra` + * :c:data:`n_points_extra_final_grid` * :c:data:`nucl_aos_transposed` * :c:data:`nucl_coord` * :c:data:`nucl_n_aos` * :c:data:`nucl_num` - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`mos_lapl_in_r_array` -.. c:var:: elec_alpha_num_grid_becke +.. c:var:: aos_grad_in_r_array_transp - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_in_r.irp.f` .. code:: fortran - double precision, allocatable :: one_e_dm_alpha_at_r (n_points_final_grid,N_states) - double precision, allocatable :: one_e_dm_beta_at_r (n_points_final_grid,N_states) - double precision, allocatable :: elec_beta_num_grid_becke (N_states) - double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: aos_grad_in_r_array_transp (3,ao_num,n_points_final_grid) - one_e_dm_alpha_at_r(i,istate) = n_alpha(r_i,istate) - one_e_dm_beta_at_r(i,istate) = n_beta(r_i,istate) - where r_i is the ith point of the grid and istate is the state number + aos_grad_in_r_array_transp(k,i,j) = value of the kth component of the gradient of jth ao on the ith grid point + + k = 1 : x, k= 2, y, k 3, z Needs: @@ -431,43 +312,32 @@ Providers :columns: 3 * :c:data:`ao_num` - * :c:data:`final_grid_points` + * :c:data:`aos_grad_in_r_array` * :c:data:`n_points_final_grid` - * :c:data:`n_states` - * :c:data:`one_e_dm_alpha_ao_for_dft` Needed by: .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_lda_w` - * :c:data:`aos_sr_vxc_alpha_lda_w` - * :c:data:`aos_vc_alpha_lda_w` - * :c:data:`aos_vxc_alpha_lda_w` - * :c:data:`energy_c_lda` - * :c:data:`energy_c_sr_lda` - * :c:data:`energy_sr_x_lda` - * :c:data:`energy_x_lda` - * :c:data:`energy_x_sr_lda` + * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_pbe_w` + * :c:data:`aos_vxc_alpha_sr_pbe_w` -.. c:var:: elec_beta_num_grid_becke +.. c:var:: aos_grad_in_r_array_transp_3 - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_in_r.irp.f` .. code:: fortran - double precision, allocatable :: one_e_dm_alpha_at_r (n_points_final_grid,N_states) - double precision, allocatable :: one_e_dm_beta_at_r (n_points_final_grid,N_states) - double precision, allocatable :: elec_beta_num_grid_becke (N_states) - double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: aos_grad_in_r_array_transp_3 (3,n_points_final_grid,ao_num) - one_e_dm_alpha_at_r(i,istate) = n_alpha(r_i,istate) - one_e_dm_beta_at_r(i,istate) = n_beta(r_i,istate) - where r_i is the ith point of the grid and istate is the state number + Transposed gradients + Needs: @@ -475,42 +345,23 @@ Providers :columns: 3 * :c:data:`ao_num` - * :c:data:`final_grid_points` + * :c:data:`aos_grad_in_r_array` * :c:data:`n_points_final_grid` - * :c:data:`n_states` - * :c:data:`one_e_dm_alpha_ao_for_dft` - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`aos_sr_vc_alpha_lda_w` - * :c:data:`aos_sr_vxc_alpha_lda_w` - * :c:data:`aos_vc_alpha_lda_w` - * :c:data:`aos_vxc_alpha_lda_w` - * :c:data:`energy_c_lda` - * :c:data:`energy_c_sr_lda` - * :c:data:`energy_sr_x_lda` - * :c:data:`energy_x_lda` - * :c:data:`energy_x_sr_lda` -.. c:var:: mos_grad_in_r_array +.. c:var:: aos_grad_in_r_array_transp_bis - File : :file:`dft_utils_in_r/mo_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_in_r.irp.f` .. code:: fortran - double precision, allocatable :: mos_grad_in_r_array (mo_num,n_points_final_grid,3) + double precision, allocatable :: aos_grad_in_r_array_transp_bis (n_points_final_grid,ao_num,3) - mos_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith mo on the jth grid point - - mos_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth mo on the ith grid point + Transposed gradients - k = 1 : x, k= 2, y, k 3, z Needs: @@ -519,81 +370,444 @@ Providers * :c:data:`ao_num` * :c:data:`aos_grad_in_r_array` - * :c:data:`mo_coef_transp` - * :c:data:`mo_num` * :c:data:`n_points_final_grid` -.. c:var:: mos_in_r_array +.. c:var:: aos_in_r_array - File : :file:`dft_utils_in_r/mo_in_r.irp.f` + File : :file:`dft_utils_in_r/ao_in_r.irp.f` .. code:: fortran - double precision, allocatable :: mos_in_r_array (mo_num,n_points_final_grid) - double precision, allocatable :: mos_in_r_array_transp (n_points_final_grid,mo_num) + double precision, allocatable :: aos_in_r_array (ao_num,n_points_final_grid) - mos_in_r_array(i,j) = value of the ith mo on the jth grid point - - mos_in_r_array_transp(i,j) = value of the jth mo on the ith grid point + aos_in_r_array(i,j) = value of the ith ao on the jth grid point Needs: .. hlist:: :columns: 3 + * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` + * :c:data:`ao_expo_ordered_transp_per_nucl` * :c:data:`ao_num` + * :c:data:`ao_power_ordered_transp_per_nucl` + * :c:data:`ao_prim_num` * :c:data:`final_grid_points` - * :c:data:`mo_coef_transp` - * :c:data:`mo_num` * :c:data:`n_points_final_grid` + * :c:data:`nucl_aos_transposed` + * :c:data:`nucl_coord` + * :c:data:`nucl_n_aos` + * :c:data:`nucl_num` - - -.. c:var:: mos_in_r_array_transp - - - File : :file:`dft_utils_in_r/mo_in_r.irp.f` - - .. code:: fortran - - double precision, allocatable :: mos_in_r_array (mo_num,n_points_final_grid) - double precision, allocatable :: mos_in_r_array_transp (n_points_final_grid,mo_num) - - - mos_in_r_array(i,j) = value of the ith mo on the jth grid point - - mos_in_r_array_transp(i,j) = value of the jth mo on the ith grid point - - Needs: + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_abs_int_grid` + * :c:data:`ao_overlap_abs_grid` + * :c:data:`ao_prod_abs_r` + * :c:data:`ao_prod_center` + * :c:data:`aos_in_r_array_transp` + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_lda_w` + * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_lda_w` + * :c:data:`aos_vxc_alpha_pbe_w` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`f_hf_cholesky_sparse_bis` + * :c:data:`pot_scal_x_alpha_ao_pbe` + * :c:data:`pot_scal_x_alpha_ao_sr_pbe` + * :c:data:`pot_scal_xc_alpha_ao_pbe` + * :c:data:`pot_scal_xc_alpha_ao_sr_pbe` + * :c:data:`potential_c_alpha_ao_lda` + * :c:data:`potential_c_alpha_ao_sr_lda` + * :c:data:`potential_x_alpha_ao_lda` + * :c:data:`potential_x_alpha_ao_sr_lda` + * :c:data:`potential_xc_alpha_ao_lda` + * :c:data:`potential_xc_alpha_ao_sr_lda` + + +.. c:var:: aos_in_r_array_extra + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_in_r_array_extra (ao_num,n_points_extra_final_grid) + + + aos_in_r_array_extra(i,j) = value of the ith ao on the jth grid point + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` + * :c:data:`ao_expo_ordered_transp_per_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power_ordered_transp_per_nucl` + * :c:data:`ao_prim_num` + * :c:data:`final_grid_points_extra` + * :c:data:`n_points_extra_final_grid` + * :c:data:`nucl_aos_transposed` + * :c:data:`nucl_coord` + * :c:data:`nucl_n_aos` + * :c:data:`nucl_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_in_r_array_extra_transp` + + +.. c:var:: aos_in_r_array_extra_transp + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_in_r_array_extra_transp (n_points_extra_final_grid,ao_num) + + + aos_in_r_array_extra_transp(i,j) = value of the jth ao on the ith grid point + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`aos_in_r_array_extra` + * :c:data:`n_points_extra_final_grid` + + + +.. c:var:: aos_in_r_array_transp + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_in_r_array_transp (n_points_final_grid,ao_num) + + + aos_in_r_array_transp(i,j) = value of the jth ao on the ith grid point + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`aos_in_r_array` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pot_grad_x_alpha_ao_pbe` + * :c:data:`pot_grad_x_alpha_ao_sr_pbe` + * :c:data:`pot_grad_xc_alpha_ao_pbe` + * :c:data:`pot_grad_xc_alpha_ao_sr_pbe` + + +.. c:var:: aos_lapl_in_r_array + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_lapl_in_r_array (3,ao_num,n_points_final_grid) + + + aos_lapl_in_r_array(i,j,k) = value of the kth component of the laplacian of jth ao on the ith grid point + + k = 1 : x, k= 2, y, k 3, z + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` + * :c:data:`ao_expo_ordered_transp_per_nucl` + * :c:data:`ao_num` + * :c:data:`ao_power_ordered_transp_per_nucl` + * :c:data:`ao_prim_num` + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` + * :c:data:`nucl_aos_transposed` + * :c:data:`nucl_coord` + * :c:data:`nucl_n_aos` + * :c:data:`nucl_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`aos_lapl_in_r_array_transp` + + +.. c:var:: aos_lapl_in_r_array_transp + + + File : :file:`dft_utils_in_r/ao_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: aos_lapl_in_r_array_transp (ao_num,n_points_final_grid,3) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`aos_lapl_in_r_array` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mos_lapl_in_r_array` + + +.. c:var:: beta_dens_kin_in_r + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: alpha_dens_kin_in_r (n_points_final_grid) + double precision, allocatable :: beta_dens_kin_in_r (n_points_final_grid) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mos_grad_in_r_array_tranp` + * :c:data:`n_points_final_grid` + + + +.. c:var:: elec_alpha_num_grid_becke + + + File : :file:`dft_utils_in_r/dm_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: elec_beta_num_grid_becke (N_states) + double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: elec_num_grid_becke (N_states) + + + number of electrons when the one-e alpha/beta densities are numerically integrated on the DFT grid + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` + * :c:data:`n_states` + * :c:data:`one_e_dm_and_grad_alpha_in_r` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_average_prov` + + +.. c:var:: elec_beta_num_grid_becke + + + File : :file:`dft_utils_in_r/dm_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: elec_beta_num_grid_becke (N_states) + double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: elec_num_grid_becke (N_states) + + + number of electrons when the one-e alpha/beta densities are numerically integrated on the DFT grid + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` + * :c:data:`n_states` + * :c:data:`one_e_dm_and_grad_alpha_in_r` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_average_prov` + + +.. c:var:: elec_num_grid_becke + + + File : :file:`dft_utils_in_r/dm_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: elec_beta_num_grid_becke (N_states) + double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: elec_num_grid_becke (N_states) + + + number of electrons when the one-e alpha/beta densities are numerically integrated on the DFT grid + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_grid_points` + * :c:data:`n_points_final_grid` + * :c:data:`n_states` + * :c:data:`one_e_dm_and_grad_alpha_in_r` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mu_average_prov` + + +.. c:var:: kinetic_density_generalized + + + File : :file:`dft_utils_in_r/kin_dens.irp.f` + + .. code:: fortran + + double precision, allocatable :: kinetic_density_generalized (n_points_final_grid) + + + + Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` - * :c:data:`final_grid_points` - * :c:data:`mo_coef_transp` * :c:data:`mo_num` + * :c:data:`mos_grad_in_r_array_tranp` * :c:data:`n_points_final_grid` + * :c:data:`one_e_dm_mo_for_dft` -.. c:var:: mos_lapl_in_r_array +.. c:var:: mo_grad_ints + + + File : :file:`dft_utils_in_r/ints_grad.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_grad_ints (mo_num,mo_num,3) + + + mo_grad_ints(i,j,m) = + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`final_grid_points` + * :c:data:`mo_num` + * :c:data:`mos_grad_in_r_array` + * :c:data:`mos_in_r_array` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_grad_ints_transp` + + +.. c:var:: mo_grad_ints_transp + + + File : :file:`dft_utils_in_r/ints_grad.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_grad_ints_transp (3,mo_num,mo_num) + + + mo_grad_ints(i,j,m) = + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_grad_ints` + * :c:data:`mo_num` + + + +.. c:var:: mos_grad_in_r_array File : :file:`dft_utils_in_r/mo_in_r.irp.f` .. code:: fortran - double precision, allocatable :: mos_lapl_in_r_array (mo_num,n_points_final_grid,3) + double precision, allocatable :: mos_grad_in_r_array (mo_num,n_points_final_grid,3) - mos_lapl_in_r_array(i,j,k) = value of the kth component of the laplacian of ith mo on the jth grid point + mos_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith mo on the jth grid point - mos_lapl_in_r_array_transp(i,j,k) = value of the kth component of the laplacian of jth mo on the ith grid point + mos_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth mo on the ith grid point k = 1 : x, k= 2, y, k 3, z @@ -603,29 +817,114 @@ Providers :columns: 3 * :c:data:`ao_num` - * :c:data:`aos_lapl_in_r_array` + * :c:data:`aos_grad_in_r_array` * :c:data:`mo_coef_transp` * :c:data:`mo_num` * :c:data:`n_points_final_grid` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`core_inact_act_mos_grad_in_r_array` + * :c:data:`mo_grad_ints` + * :c:data:`mos_grad_in_r_array_tranp` + * :c:data:`mos_grad_in_r_array_transp_3` + * :c:data:`mos_grad_in_r_array_transp_bis` -.. c:var:: one_e_dm_alpha_at_r +.. c:var:: mos_grad_in_r_array_tranp - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/mo_in_r.irp.f` .. code:: fortran - double precision, allocatable :: one_e_dm_alpha_at_r (n_points_final_grid,N_states) - double precision, allocatable :: one_e_dm_beta_at_r (n_points_final_grid,N_states) - double precision, allocatable :: elec_beta_num_grid_becke (N_states) - double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: mos_grad_in_r_array_tranp (3,mo_num,n_points_final_grid) - one_e_dm_alpha_at_r(i,istate) = n_alpha(r_i,istate) - one_e_dm_beta_at_r(i,istate) = n_beta(r_i,istate) - where r_i is the ith point of the grid and istate is the state number + mos_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth mo on the ith grid point + + k = 1 : x, k= 2, y, k 3, z + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + * :c:data:`mos_grad_in_r_array` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`alpha_dens_kin_in_r` + * :c:data:`kinetic_density_generalized` + + +.. c:var:: mos_grad_in_r_array_transp_3 + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: mos_grad_in_r_array_transp_3 (3,n_points_final_grid,mo_num) + + + Transposed gradients + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + * :c:data:`mos_grad_in_r_array` + * :c:data:`n_points_final_grid` + + + +.. c:var:: mos_grad_in_r_array_transp_bis + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: mos_grad_in_r_array_transp_bis (n_points_final_grid,mo_num,3) + + + Transposed gradients + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + * :c:data:`mos_grad_in_r_array` + * :c:data:`n_points_final_grid` + + + +.. c:var:: mos_in_r_array + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: mos_in_r_array (mo_num,n_points_final_grid) + + + mos_in_r_array(i,j) = value of the ith mo on the jth grid point Needs: @@ -634,50 +933,143 @@ Providers * :c:data:`ao_num` * :c:data:`final_grid_points` + * :c:data:`mo_coef_transp` + * :c:data:`mo_num` * :c:data:`n_points_final_grid` - * :c:data:`n_states` - * :c:data:`one_e_dm_alpha_ao_for_dft` Needed by: .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_lda_w` - * :c:data:`aos_sr_vxc_alpha_lda_w` - * :c:data:`aos_vc_alpha_lda_w` - * :c:data:`aos_vxc_alpha_lda_w` - * :c:data:`energy_c_lda` - * :c:data:`energy_c_sr_lda` - * :c:data:`energy_sr_x_lda` - * :c:data:`energy_x_lda` - * :c:data:`energy_x_sr_lda` + * :c:data:`basis_mos_in_r_array` + * :c:data:`mo_grad_ints` + + +.. c:var:: mos_in_r_array_omp + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: mos_in_r_array_omp (mo_num,n_points_final_grid) + + + mos_in_r_array(i,j) = value of the ith mo on the jth grid point + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`final_grid_points` + * :c:data:`mo_coef_transp` + * :c:data:`mo_num` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`f_hf_cholesky_sparse` + * :c:data:`f_hf_cholesky_sparse_bis` + * :c:data:`mos_in_r_array_transp` + * :c:data:`mos_times_cholesky_r1` + * :c:data:`mos_times_cholesky_r2` + * :c:data:`on_top_hf_grid` + + +.. c:var:: mos_in_r_array_transp + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: mos_in_r_array_transp (n_points_final_grid,mo_num) + + + mos_in_r_array_transp(i,j) = value of the jth mo on the ith grid point + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + * :c:data:`mos_in_r_array_omp` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`act_mos_in_r_array` + * :c:data:`core_inact_act_mos_in_r_array` + * :c:data:`core_mos_in_r_array` + * :c:data:`inact_mos_in_r_array` + * :c:data:`virt_mos_in_r_array` + + +.. c:var:: mos_lapl_in_r_array + + + File : :file:`dft_utils_in_r/mo_in_r.irp.f` + + .. code:: fortran + + double precision, allocatable :: mos_lapl_in_r_array (mo_num,n_points_final_grid,3) + + + mos_lapl_in_r_array(i,j,k) = value of the kth component of the laplacian of ith mo on the jth grid point + + k = 1 : x, k= 2, y, k 3, z + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`aos_lapl_in_r_array_transp` + * :c:data:`mo_coef_transp` + * :c:data:`mo_num` + * :c:data:`n_points_final_grid` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mos_lapl_in_r_array_tranp` -.. c:var:: one_e_dm_alpha_in_r +.. c:var:: mos_lapl_in_r_array_tranp - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/mo_in_r.irp.f` .. code:: fortran - double precision, allocatable :: one_e_dm_alpha_in_r (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) - double precision, allocatable :: one_e_dm_beta_in_r (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) + double precision, allocatable :: mos_lapl_in_r_array_tranp (3,mo_num,n_points_final_grid) + mos_lapl_in_r_array_transp(i,j,k) = value of the kth component of the laplient of jth mo on the ith grid point + + k = 1 : x, k= 2, y, k 3, z Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` - * :c:data:`grid_points_per_atom` * :c:data:`mo_num` - * :c:data:`n_points_radial_grid` - * :c:data:`n_states` - * :c:data:`nucl_num` - * :c:data:`one_e_dm_alpha_ao_for_dft` + * :c:data:`mos_lapl_in_r_array` + * :c:data:`n_points_final_grid` @@ -692,14 +1084,25 @@ Providers double precision, allocatable :: one_e_dm_and_grad_beta_in_r (4,n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_alpha_at_r (n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_beta_at_r (n_points_final_grid,N_states) + double precision, allocatable :: scal_prod_grad_one_e_dm_ab (n_points_final_grid,N_states) + double precision, allocatable :: one_e_stuff_for_pbe (3,n_points_final_grid,N_states) one_e_dm_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) - one_e_grad_2_dm_alpha_at_r(i,istate) = d\dx n_alpha(r_i,istate)^2 + d\dy n_alpha(r_i,istate)^2 + d\dz n_alpha(r_i,istate)^2 + + one_e_grad_2_dm_alpha_at_r(i,istate) = (d\dx n_alpha(r_i,istate))^2 + (d\dy n_alpha(r_i,istate))^2 + (d\dz n_alpha(r_i,istate))^2 + + scal_prod_grad_one_e_dm_ab(i,istate) = grad n_alpha(r_i) . grad n_beta(r_i) + where r_i is the ith point of the grid and istate is the state number + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed Needs: @@ -717,14 +1120,24 @@ Providers .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_lda_w` * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` - * :c:data:`energy_c_pbe` - * :c:data:`energy_sr_x_pbe` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_spin_dm` + * :c:data:`elec_beta_num_grid_becke` + * :c:data:`energy_c_lda` + * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_lda` * :c:data:`energy_x_pbe` + * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_average_prov` .. c:var:: one_e_dm_and_grad_beta_in_r @@ -738,14 +1151,25 @@ Providers double precision, allocatable :: one_e_dm_and_grad_beta_in_r (4,n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_alpha_at_r (n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_beta_at_r (n_points_final_grid,N_states) + double precision, allocatable :: scal_prod_grad_one_e_dm_ab (n_points_final_grid,N_states) + double precision, allocatable :: one_e_stuff_for_pbe (3,n_points_final_grid,N_states) one_e_dm_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) - one_e_grad_2_dm_alpha_at_r(i,istate) = d\dx n_alpha(r_i,istate)^2 + d\dy n_alpha(r_i,istate)^2 + d\dz n_alpha(r_i,istate)^2 + + one_e_grad_2_dm_alpha_at_r(i,istate) = (d\dx n_alpha(r_i,istate))^2 + (d\dy n_alpha(r_i,istate))^2 + (d\dz n_alpha(r_i,istate))^2 + + scal_prod_grad_one_e_dm_ab(i,istate) = grad n_alpha(r_i) . grad n_beta(r_i) + where r_i is the ith point of the grid and istate is the state number + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed Needs: @@ -763,32 +1187,56 @@ Providers .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_lda_w` * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` - * :c:data:`energy_c_pbe` - * :c:data:`energy_sr_x_pbe` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_spin_dm` + * :c:data:`elec_beta_num_grid_becke` + * :c:data:`energy_c_lda` + * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_lda` * :c:data:`energy_x_pbe` + * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_average_prov` -.. c:var:: one_e_dm_beta_at_r +.. c:var:: one_e_grad_2_dm_alpha_at_r File : :file:`dft_utils_in_r/dm_in_r.irp.f` .. code:: fortran - double precision, allocatable :: one_e_dm_alpha_at_r (n_points_final_grid,N_states) - double precision, allocatable :: one_e_dm_beta_at_r (n_points_final_grid,N_states) - double precision, allocatable :: elec_beta_num_grid_becke (N_states) - double precision, allocatable :: elec_alpha_num_grid_becke (N_states) + double precision, allocatable :: one_e_dm_and_grad_alpha_in_r (4,n_points_final_grid,N_states) + double precision, allocatable :: one_e_dm_and_grad_beta_in_r (4,n_points_final_grid,N_states) + double precision, allocatable :: one_e_grad_2_dm_alpha_at_r (n_points_final_grid,N_states) + double precision, allocatable :: one_e_grad_2_dm_beta_at_r (n_points_final_grid,N_states) + double precision, allocatable :: scal_prod_grad_one_e_dm_ab (n_points_final_grid,N_states) + double precision, allocatable :: one_e_stuff_for_pbe (3,n_points_final_grid,N_states) - one_e_dm_alpha_at_r(i,istate) = n_alpha(r_i,istate) - one_e_dm_beta_at_r(i,istate) = n_beta(r_i,istate) + one_e_dm_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) + + one_e_dm_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) + + one_e_dm_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) + + one_e_dm_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) + + one_e_grad_2_dm_alpha_at_r(i,istate) = (d\dx n_alpha(r_i,istate))^2 + (d\dy n_alpha(r_i,istate))^2 + (d\dz n_alpha(r_i,istate))^2 + + scal_prod_grad_one_e_dm_ab(i,istate) = grad n_alpha(r_i) . grad n_beta(r_i) + where r_i is the ith point of the grid and istate is the state number + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed Needs: @@ -809,57 +1257,53 @@ Providers * :c:data:`aos_sr_vc_alpha_lda_w` * :c:data:`aos_sr_vxc_alpha_lda_w` * :c:data:`aos_vc_alpha_lda_w` + * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` * :c:data:`aos_vxc_alpha_lda_w` + * :c:data:`aos_vxc_alpha_pbe_w` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_spin_dm` + * :c:data:`elec_beta_num_grid_becke` * :c:data:`energy_c_lda` * :c:data:`energy_c_sr_lda` - * :c:data:`energy_sr_x_lda` * :c:data:`energy_x_lda` + * :c:data:`energy_x_pbe` * :c:data:`energy_x_sr_lda` + * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_average_prov` -.. c:var:: one_e_dm_beta_in_r - - - File : :file:`dft_utils_in_r/dm_in_r.irp.f` - - .. code:: fortran - - double precision, allocatable :: one_e_dm_alpha_in_r (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) - double precision, allocatable :: one_e_dm_beta_in_r (n_points_integration_angular,n_points_radial_grid,nucl_num,N_states) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`grid_points_per_atom` - * :c:data:`mo_num` - * :c:data:`n_points_radial_grid` - * :c:data:`n_states` - * :c:data:`nucl_num` - * :c:data:`one_e_dm_alpha_ao_for_dft` - - - -.. c:var:: one_e_dm_no_core_and_grad_alpha_in_r +.. c:var:: one_e_grad_2_dm_beta_at_r File : :file:`dft_utils_in_r/dm_in_r.irp.f` .. code:: fortran - double precision, allocatable :: one_e_dm_no_core_and_grad_alpha_in_r (4,n_points_final_grid,N_states) - double precision, allocatable :: one_e_dm_no_core_and_grad_beta_in_r (4,n_points_final_grid,N_states) + double precision, allocatable :: one_e_dm_and_grad_alpha_in_r (4,n_points_final_grid,N_states) + double precision, allocatable :: one_e_dm_and_grad_beta_in_r (4,n_points_final_grid,N_states) + double precision, allocatable :: one_e_grad_2_dm_alpha_at_r (n_points_final_grid,N_states) + double precision, allocatable :: one_e_grad_2_dm_beta_at_r (n_points_final_grid,N_states) + double precision, allocatable :: scal_prod_grad_one_e_dm_ab (n_points_final_grid,N_states) + double precision, allocatable :: one_e_stuff_for_pbe (3,n_points_final_grid,N_states) - 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 + one_e_dm_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) + + one_e_dm_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) + + one_e_dm_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) + + one_e_dm_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) + + one_e_grad_2_dm_alpha_at_r(i,istate) = (d\dx n_alpha(r_i,istate))^2 + (d\dy n_alpha(r_i,istate))^2 + (d\dz n_alpha(r_i,istate))^2 + + scal_prod_grad_one_e_dm_ab(i,istate) = grad n_alpha(r_i) . grad n_beta(r_i) + where r_i is the ith point of the grid and istate is the state number + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed Needs: @@ -870,41 +1314,34 @@ Providers * :c:data:`final_grid_points` * :c:data:`n_points_final_grid` * :c:data:`n_states` - * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` - - - -.. c:var:: one_e_dm_no_core_and_grad_beta_in_r - - - File : :file:`dft_utils_in_r/dm_in_r.irp.f` - - .. code:: fortran - - double precision, allocatable :: one_e_dm_no_core_and_grad_alpha_in_r (4,n_points_final_grid,N_states) - double precision, allocatable :: one_e_dm_no_core_and_grad_beta_in_r (4,n_points_final_grid,N_states) - - - 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 + * :c:data:`one_e_dm_alpha_ao_for_dft` - Needs: + Needed by: .. hlist:: :columns: 3 - * :c:data:`ao_num` - * :c:data:`final_grid_points` - * :c:data:`n_points_final_grid` - * :c:data:`n_states` - * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` - + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_lda_w` + * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_lda_w` + * :c:data:`aos_vxc_alpha_pbe_w` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_spin_dm` + * :c:data:`elec_beta_num_grid_becke` + * :c:data:`energy_c_lda` + * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_lda` + * :c:data:`energy_x_pbe` + * :c:data:`energy_x_sr_lda` + * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_average_prov` -.. c:var:: one_e_grad_2_dm_alpha_at_r +.. c:var:: one_e_stuff_for_pbe File : :file:`dft_utils_in_r/dm_in_r.irp.f` @@ -915,14 +1352,25 @@ Providers double precision, allocatable :: one_e_dm_and_grad_beta_in_r (4,n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_alpha_at_r (n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_beta_at_r (n_points_final_grid,N_states) + double precision, allocatable :: scal_prod_grad_one_e_dm_ab (n_points_final_grid,N_states) + double precision, allocatable :: one_e_stuff_for_pbe (3,n_points_final_grid,N_states) one_e_dm_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) - one_e_grad_2_dm_alpha_at_r(i,istate) = d\dx n_alpha(r_i,istate)^2 + d\dy n_alpha(r_i,istate)^2 + d\dz n_alpha(r_i,istate)^2 + + one_e_grad_2_dm_alpha_at_r(i,istate) = (d\dx n_alpha(r_i,istate))^2 + (d\dy n_alpha(r_i,istate))^2 + (d\dz n_alpha(r_i,istate))^2 + + scal_prod_grad_one_e_dm_ab(i,istate) = grad n_alpha(r_i) . grad n_beta(r_i) + where r_i is the ith point of the grid and istate is the state number + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed Needs: @@ -940,17 +1388,27 @@ Providers .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_lda_w` * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` - * :c:data:`energy_c_pbe` - * :c:data:`energy_sr_x_pbe` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_spin_dm` + * :c:data:`elec_beta_num_grid_becke` + * :c:data:`energy_c_lda` + * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_lda` * :c:data:`energy_x_pbe` + * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_average_prov` -.. c:var:: one_e_grad_2_dm_beta_at_r +.. c:var:: scal_prod_grad_one_e_dm_ab File : :file:`dft_utils_in_r/dm_in_r.irp.f` @@ -961,14 +1419,25 @@ Providers double precision, allocatable :: one_e_dm_and_grad_beta_in_r (4,n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_alpha_at_r (n_points_final_grid,N_states) double precision, allocatable :: one_e_grad_2_dm_beta_at_r (n_points_final_grid,N_states) + double precision, allocatable :: scal_prod_grad_one_e_dm_ab (n_points_final_grid,N_states) + double precision, allocatable :: one_e_stuff_for_pbe (3,n_points_final_grid,N_states) one_e_dm_and_grad_alpha_in_r(1,i,i_state) = d\dx n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(2,i,i_state) = d\dy n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(3,i,i_state) = d\dz n_alpha(r_i,istate) + one_e_dm_and_grad_alpha_in_r(4,i,i_state) = n_alpha(r_i,istate) - one_e_grad_2_dm_alpha_at_r(i,istate) = d\dx n_alpha(r_i,istate)^2 + d\dy n_alpha(r_i,istate)^2 + d\dz n_alpha(r_i,istate)^2 + + one_e_grad_2_dm_alpha_at_r(i,istate) = (d\dx n_alpha(r_i,istate))^2 + (d\dy n_alpha(r_i,istate))^2 + (d\dz n_alpha(r_i,istate))^2 + + scal_prod_grad_one_e_dm_ab(i,istate) = grad n_alpha(r_i) . grad n_beta(r_i) + where r_i is the ith point of the grid and istate is the state number + + !!!!! WARNING !!!! if no_core_density = .True. then all core electrons are removed Needs: @@ -986,14 +1455,24 @@ Providers .. hlist:: :columns: 3 - * :c:data:`aos_sr_vc_alpha_pbe_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` + * :c:data:`aos_sr_vc_alpha_lda_w` + * :c:data:`aos_sr_vxc_alpha_lda_w` + * :c:data:`aos_vc_alpha_lda_w` * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` + * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` - * :c:data:`energy_c_pbe` - * :c:data:`energy_sr_x_pbe` + * :c:data:`aos_vxc_alpha_sr_pbe_w` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_spin_dm` + * :c:data:`elec_beta_num_grid_becke` + * :c:data:`energy_c_lda` + * :c:data:`energy_c_sr_lda` + * :c:data:`energy_x_lda` * :c:data:`energy_x_pbe` + * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` + * :c:data:`mu_average_prov` @@ -1003,7 +1482,7 @@ Subroutines / functions .. c:function:: dens_grad_a_b_no_core_and_aos_grad_aos_at_r: - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` .. code:: fortran @@ -1030,15 +1509,55 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` + * :c:data:`n_states` * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dsymv` + * :c:func:`give_all_aos_and_grad_at_r` + + +.. c:function:: density_and_grad_alpha_beta: + + + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` + + .. code:: fortran + + subroutine density_and_grad_alpha_beta(r,dm_a,dm_b, grad_dm_a, grad_dm_b) + + + input: + + * r(1) ==> r(1) = x, r(2) = y, r(3) = z + + output: + + * dm_a = alpha density evaluated at r + * dm_b = beta density evaluated at r + * grad_dm_a(1) = X gradient of the alpha density evaluated in r + * grad_dm_a(1) = X gradient of the beta density evaluated in r + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` Called by: .. hlist:: :columns: 3 - * :c:data:`one_e_dm_no_core_and_grad_alpha_in_r` + * :c:func:`mu_grad_rho_func` Calls: @@ -1052,7 +1571,7 @@ Subroutines / functions .. c:function:: density_and_grad_alpha_beta_and_all_aos_and_grad_aos_at_r: - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` .. code:: fortran @@ -1079,14 +1598,17 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` - * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` Called by: .. hlist:: :columns: 3 + * :c:func:`ec_md_on_top_pbe_mu_corrected` + * :c:func:`ecmd_pbe_ueg_at_r` + * :c:func:`give_all_stuffs_in_r_for_lyp_88` * :c:data:`one_e_dm_and_grad_alpha_in_r` Calls: @@ -1098,10 +1620,52 @@ Subroutines / functions * :c:func:`give_all_aos_and_grad_at_r` +.. c:function:: density_and_grad_lapl_alpha_beta_and_all_aos_and_grad_aos_at_r: + + + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` + + .. code:: fortran + + subroutine density_and_grad_lapl_alpha_beta_and_all_aos_and_grad_aos_at_r(r,dm_a,dm_b, grad_dm_a, grad_dm_b, lapl_dm_a, lapl_dm_b, aos_array, grad_aos_array, lapl_aos_array) + + + input: + + * r(1) ==> r(1) = x, r(2) = y, r(3) = z + + output: + + * dm_a = alpha density evaluated at r + * dm_b = beta density evaluated at r + * aos_array(i) = ao(i) evaluated at r + * grad_dm_a(1) = X gradient of the alpha density evaluated in r + * grad_dm_a(1) = X gradient of the beta density evaluated in r + * grad_aos_array(1) = X gradient of the aos(i) evaluated at r + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dsymv` + * :c:func:`give_all_aos_and_grad_and_lapl_at_r` + + .. c:function:: dm_dft_alpha_beta_and_all_aos_at_r: - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` .. code:: fortran @@ -1119,8 +1683,8 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` - * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` Calls: @@ -1134,7 +1698,7 @@ Subroutines / functions .. c:function:: dm_dft_alpha_beta_at_r: - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` .. code:: fortran @@ -1151,16 +1715,18 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` - * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft` Called by: .. hlist:: :columns: 3 - * :c:data:`one_e_dm_alpha_at_r` - * :c:data:`one_e_dm_alpha_in_r` + * :c:func:`correction_to_on_top_from_ueg` + * :c:data:`mu_of_r_dft_average` + * :c:data:`mu_rsc_of_r` + * :c:func:`print_mos` Calls: @@ -1174,7 +1740,7 @@ Subroutines / functions .. c:function:: dm_dft_alpha_beta_no_core_at_r: - File : :file:`dft_utils_in_r/dm_in_r.irp.f` + File : :file:`dft_utils_in_r/dm_in_r_routines.irp.f` .. code:: fortran @@ -1191,8 +1757,8 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` - * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` * :c:data:`n_states` + * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` Calls: diff --git a/docs/source/modules/electrons.rst b/docs/source/modules/electrons.rst index 416761a9..d336098a 100644 --- a/docs/source/modules/electrons.rst +++ b/docs/source/modules/electrons.rst @@ -74,8 +74,13 @@ Providers .. hlist:: :columns: 3 + * :c:data:`cfg_seniority_index` + * :c:data:`cholesky_ao_num` * :c:data:`diagonal_h_matrix_on_psi_det` + * :c:data:`nsomomax` + * :c:data:`ormas_max_e` * :c:data:`psi_det_hii` + * :c:data:`psi_selectors_diag_h_mat` .. c:var:: elec_num_tab @@ -105,6 +110,11 @@ Providers .. hlist:: :columns: 3 + * :c:data:`cfg_seniority_index` + * :c:data:`cholesky_ao_num` * :c:data:`diagonal_h_matrix_on_psi_det` + * :c:data:`nsomomax` + * :c:data:`ormas_max_e` * :c:data:`psi_det_hii` + * :c:data:`psi_selectors_diag_h_mat` diff --git a/docs/source/modules/ezfio_files.rst b/docs/source/modules/ezfio_files.rst index d7079295..b67c204d 100644 --- a/docs/source/modules/ezfio_files.rst +++ b/docs/source/modules/ezfio_files.rst @@ -25,7 +25,7 @@ Providers .. code:: fortran - character*(128) :: ezfio_filename + character*(1024) :: ezfio_filename Name of EZFIO file. It is obtained from the QPACKAGE_INPUT environment @@ -36,26 +36,51 @@ Providers .. hlist:: :columns: 3 + * :c:data:`file_lock` * :c:data:`mpi_initialized` + * :c:data:`output_wall_time_0` Needed by: .. hlist:: :columns: 3 + * :c:data:`absolute_eig` + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_mos_opt` + * :c:data:`adaptive_pt2_max` * :c:data:`ao_cartesian` + * :c:data:`ao_cholesky_threshold` * :c:data:`ao_coef` * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` * :c:data:`ao_integrals_threshold` * :c:data:`ao_md5` + * :c:data:`ao_normalized` * :c:data:`ao_nucl` * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals_threshold` * :c:data:`ao_power` * :c:data:`ao_prim_num` * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`cas_bitmask` + * :c:data:`avoid_saddle` + * :c:data:`basis` + * :c:data:`basis_nucleus_index` + * :c:data:`calc_dipole_moment` + * :c:data:`calc_energy_components` + * :c:data:`calc_osc_str` + * :c:data:`calc_tr_dipole_moment` * :c:data:`correlation_energy_ratio_max` + * :c:data:`correlation_functional` + * :c:data:`criterion_casscf` + * :c:data:`csf_based` + * :c:data:`damping_for_rs_dft` * :c:data:`data_energy_proj` * :c:data:`data_energy_var` * :c:data:`data_one_e_dm_alpha_ao` @@ -63,67 +88,106 @@ Providers * :c:data:`data_one_e_dm_beta_ao` * :c:data:`data_one_e_dm_beta_mo` * :c:data:`davidson_sze_max` - * :c:data:`disk_access_nuclear_repulsion` + * :c:data:`density_for_dft` + * :c:data:`diag_hess_cas` * :c:data:`disk_based_davidson` * :c:data:`distributed_davidson` - * :c:data:`do_direct_integrals` + * :c:data:`do_ao_cholesky` + * :c:data:`do_mom` + * :c:data:`do_ormas` * :c:data:`do_pseudo` * :c:data:`do_pt2` * :c:data:`elec_alpha_num` * :c:data:`elec_beta_num` * :c:data:`elec_num` - * :c:data:`energy_iterations` + * :c:data:`exchange_functional` + * :c:data:`excitation_alpha_max` + * :c:data:`excitation_beta_max` + * :c:data:`excitation_max` + * :c:data:`excitation_ref` * :c:data:`ezfio_work_dir` + * :c:data:`fast_2rdm` * :c:data:`frozen_orb_scf` * :c:data:`generators_bitmask` - * :c:data:`generators_bitmask_restart` * :c:data:`h0_type` - * :c:data:`io_ao_integrals_e_n` + * :c:data:`hess_cv_cv` + * :c:data:`hf_exchange` + * :c:data:`io_ao_cholesky` * :c:data:`io_ao_integrals_kinetic` + * :c:data:`io_ao_integrals_n_e` * :c:data:`io_ao_integrals_overlap` * :c:data:`io_ao_integrals_pseudo` * :c:data:`io_ao_one_e_integrals` * :c:data:`io_ao_two_e_integrals` * :c:data:`io_ao_two_e_integrals_erf` - * :c:data:`io_mo_integrals_e_n` + * :c:data:`io_mo_cholesky` * :c:data:`io_mo_integrals_kinetic` + * :c:data:`io_mo_integrals_n_e` * :c:data:`io_mo_integrals_pseudo` * :c:data:`io_mo_one_e_integrals` * :c:data:`io_mo_two_e_integrals` * :c:data:`io_mo_two_e_integrals_erf` + * :c:data:`io_nuclear_repulsion` + * :c:data:`io_two_body_rdm_aa` + * :c:data:`io_two_body_rdm_ab` + * :c:data:`io_two_body_rdm_bb` + * :c:data:`io_two_body_rdm_spin_trace` + * :c:data:`is_periodic` + * :c:data:`json_filename` * :c:data:`level_shift` + * :c:data:`level_shift_casscf` + * :c:data:`lin_dep_cutoff` * :c:data:`max_dim_diis` * :c:data:`mo_class` * :c:data:`mo_coef` + * :c:data:`mo_coef_aux` + * :c:data:`mo_coef_imag` * :c:data:`mo_guess_type` + * :c:data:`mo_integrals_cache_shift` * :c:data:`mo_integrals_threshold` * :c:data:`mo_label` * :c:data:`mo_num` * :c:data:`mo_occ` * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mu_dft_type` * :c:data:`mu_erf` - * :c:data:`n_cas_bitmask` + * :c:data:`n_big_act_orb` * :c:data:`n_det` - * :c:data:`n_det_iterations` * :c:data:`n_det_max` * :c:data:`n_det_max_full` + * :c:data:`n_det_max_opt` * :c:data:`n_det_print_wf` - * :c:data:`n_generators_bitmask` - * :c:data:`n_generators_bitmask_restart` * :c:data:`n_it_scf_max` - * :c:data:`n_iter` + * :c:data:`n_pts_charge` * :c:data:`n_states` * :c:data:`n_states_diag` - * :c:data:`no_ivvv_integrals` - * :c:data:`no_vvv_integrals` - * :c:data:`no_vvvv_integrals` + * :c:data:`nb_it_max_lambda` + * :c:data:`nb_it_max_pre_search` + * :c:data:`no_core_density` + * :c:data:`no_oa_or_av_opt` + * :c:data:`normalize_dm` * :c:data:`nucl_charge` * :c:data:`nucl_charge_remove` * :c:data:`nucl_coord` * :c:data:`nucl_label` * :c:data:`nucl_num` + * :c:data:`nucleus_shell_num` * :c:data:`only_expected_s2` + * :c:data:`optimization_max_nb_iter` + * :c:data:`optimization_method` + * :c:data:`ormas_max_e` + * :c:data:`ormas_min_e` + * :c:data:`ormas_mstart` + * :c:data:`ormas_n_space` + * :c:data:`point_charges` + * :c:data:`prim_coef` + * :c:data:`prim_expo` + * :c:data:`prim_normalization_factor` + * :c:data:`prim_num` + * :c:data:`primitives_normalized` + * :c:data:`print_all_transitions` + * :c:data:`pruning` * :c:data:`pseudo_dz_k` * :c:data:`pseudo_dz_kl` * :c:data:`pseudo_grid_rmax` @@ -139,24 +203,58 @@ Providers * :c:data:`psi_coef` * :c:data:`psi_det` * :c:data:`psi_det_size` - * :c:data:`pt2_iterations` * :c:data:`pt2_max` + * :c:data:`pt2_min_casscf` + * :c:data:`pt2_min_parallel_tasks` * :c:data:`pt2_relative_error` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` * :c:data:`qp_stop_filename` * :c:data:`read_wf` + * :c:data:`restore_symm` * :c:data:`s2_eig` + * :c:data:`save_threshold` + * :c:data:`save_wf_after_selection` * :c:data:`scf_algorithm` * :c:data:`selection_factor` + * :c:data:`seniority_max` + * :c:data:`shell_ang_mom` + * :c:data:`shell_index` + * :c:data:`shell_normalization_factor` + * :c:data:`shell_num` + * :c:data:`shell_prim_num` + * :c:data:`small_active_space` * :c:data:`state_following` + * :c:data:`state_following_casscf` * :c:data:`target_energy` + * :c:data:`thresh_casscf` + * :c:data:`thresh_cc` + * :c:data:`thresh_delta` + * :c:data:`thresh_eig` + * :c:data:`thresh_model` + * :c:data:`thresh_model_2` + * :c:data:`thresh_opt_max_elem_grad` + * :c:data:`thresh_rho` + * :c:data:`thresh_rho_2` * :c:data:`thresh_scf` * :c:data:`thresh_sym` + * :c:data:`thresh_wtg` + * :c:data:`thresh_wtg2` * :c:data:`threshold_davidson` + * :c:data:`threshold_davidson_from_pt2` * :c:data:`threshold_diis` * :c:data:`threshold_generators` + * :c:data:`threshold_nonsym_davidson` + * :c:data:`twice_hierarchy_max` + * :c:data:`typ` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` * :c:data:`variance_max` + * :c:data:`version_avoid_saddle` + * :c:data:`version_lambda_search` * :c:data:`weight_one_e_dm` * :c:data:`weight_selection` + * :c:data:`without_diagonal` .. c:var:: ezfio_work_dir @@ -166,7 +264,7 @@ Providers .. code:: fortran - character*(128) :: ezfio_work_dir + character*(1024) :: ezfio_work_dir EZFIO/work/ @@ -178,6 +276,36 @@ Providers * :c:data:`ezfio_filename` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_ao_num` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`ezfio_work_dir_pid` + + +.. c:var:: ezfio_work_dir_pid + + + File : :file:`ezfio_files/ezfio.irp.f` + + .. code:: fortran + + character*(1024) :: ezfio_work_dir_pid + + + EZFIO/work/pid_ + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_work_dir` + .. c:var:: file_lock @@ -192,6 +320,40 @@ Providers OpenMP Lock for I/O + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`json_filename` + * :c:data:`json_unit` + * :c:data:`nthreads_davidson` + * :c:data:`nthreads_pt2` + * :c:data:`qp_max_mem` + + +.. c:var:: nthreads_pt2 + + + File : :file:`ezfio_files/environment.irp.f` + + .. code:: fortran + + integer :: nthreads_pt2 + + + Number of threads for Davidson + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`file_lock` + * :c:data:`mpi_master` + * :c:data:`nproc` + .. c:var:: output_cpu_time_0 @@ -212,103 +374,15 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_cartesian` - * :c:data:`ao_coef` - * :c:data:`ao_expo` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_md5` - * :c:data:`ao_nucl` - * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` * :c:data:`ci_energy` - * :c:data:`correlation_energy_ratio_max` - * :c:data:`data_energy_proj` - * :c:data:`data_energy_var` - * :c:data:`data_one_e_dm_alpha_ao` - * :c:data:`data_one_e_dm_alpha_mo` - * :c:data:`data_one_e_dm_beta_ao` - * :c:data:`data_one_e_dm_beta_mo` - * :c:data:`davidson_sze_max` - * :c:data:`disk_access_nuclear_repulsion` - * :c:data:`disk_based_davidson` - * :c:data:`distributed_davidson` - * :c:data:`do_direct_integrals` - * :c:data:`do_pseudo` - * :c:data:`do_pt2` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` - * :c:data:`energy_iterations` - * :c:data:`frozen_orb_scf` - * :c:data:`h0_type` - * :c:data:`io_ao_integrals_e_n` - * :c:data:`io_ao_integrals_kinetic` - * :c:data:`io_ao_integrals_overlap` - * :c:data:`io_ao_integrals_pseudo` - * :c:data:`io_ao_one_e_integrals` - * :c:data:`io_ao_two_e_integrals` - * :c:data:`io_ao_two_e_integrals_erf` - * :c:data:`io_mo_integrals_e_n` - * :c:data:`io_mo_integrals_kinetic` - * :c:data:`io_mo_integrals_pseudo` - * :c:data:`io_mo_one_e_integrals` - * :c:data:`io_mo_two_e_integrals` - * :c:data:`io_mo_two_e_integrals_erf` - * :c:data:`level_shift` - * :c:data:`max_dim_diis` - * :c:data:`mo_class` - * :c:data:`mo_guess_type` - * :c:data:`mo_integrals_threshold` - * :c:data:`mu_erf` + * :c:data:`ezfio_filename` * :c:data:`n_det_generators` - * :c:data:`n_det_iterations` - * :c:data:`n_det_max` - * :c:data:`n_det_max_full` - * :c:data:`n_det_print_wf` * :c:data:`n_det_selectors` - * :c:data:`n_it_scf_max` - * :c:data:`n_iter` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`no_ivvv_integrals` - * :c:data:`no_vvv_integrals` - * :c:data:`no_vvvv_integrals` - * :c:data:`nucl_charge` - * :c:data:`nucl_charge_remove` + * :c:data:`n_pts_charge` * :c:data:`nucl_coord` - * :c:data:`nucl_label` - * :c:data:`nucl_num` * :c:data:`nuclear_repulsion` - * :c:data:`only_expected_s2` - * :c:data:`pseudo_dz_k` - * :c:data:`pseudo_dz_kl` - * :c:data:`pseudo_grid_rmax` - * :c:data:`pseudo_grid_size` - * :c:data:`pseudo_klocmax` - * :c:data:`pseudo_kmax` - * :c:data:`pseudo_lmax` - * :c:data:`pseudo_n_k` - * :c:data:`pseudo_n_kl` - * :c:data:`pseudo_sym` - * :c:data:`pseudo_v_k` - * :c:data:`pseudo_v_kl` - * :c:data:`pt2_iterations` - * :c:data:`pt2_max` - * :c:data:`pt2_relative_error` - * :c:data:`read_wf` - * :c:data:`s2_eig` - * :c:data:`scf_algorithm` - * :c:data:`selection_factor` - * :c:data:`state_following` - * :c:data:`target_energy` - * :c:data:`thresh_scf` - * :c:data:`thresh_sym` - * :c:data:`threshold_davidson` - * :c:data:`threshold_diis` - * :c:data:`threshold_generators` - * :c:data:`variance_max` - * :c:data:`weight_one_e_dm` - * :c:data:`weight_selection` + * :c:data:`prim_normalization_factor` + * :c:data:`shell_normalization_factor` .. c:var:: output_wall_time_0 @@ -329,103 +403,15 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_cartesian` - * :c:data:`ao_coef` - * :c:data:`ao_expo` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_md5` - * :c:data:`ao_nucl` - * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` * :c:data:`ci_energy` - * :c:data:`correlation_energy_ratio_max` - * :c:data:`data_energy_proj` - * :c:data:`data_energy_var` - * :c:data:`data_one_e_dm_alpha_ao` - * :c:data:`data_one_e_dm_alpha_mo` - * :c:data:`data_one_e_dm_beta_ao` - * :c:data:`data_one_e_dm_beta_mo` - * :c:data:`davidson_sze_max` - * :c:data:`disk_access_nuclear_repulsion` - * :c:data:`disk_based_davidson` - * :c:data:`distributed_davidson` - * :c:data:`do_direct_integrals` - * :c:data:`do_pseudo` - * :c:data:`do_pt2` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` - * :c:data:`energy_iterations` - * :c:data:`frozen_orb_scf` - * :c:data:`h0_type` - * :c:data:`io_ao_integrals_e_n` - * :c:data:`io_ao_integrals_kinetic` - * :c:data:`io_ao_integrals_overlap` - * :c:data:`io_ao_integrals_pseudo` - * :c:data:`io_ao_one_e_integrals` - * :c:data:`io_ao_two_e_integrals` - * :c:data:`io_ao_two_e_integrals_erf` - * :c:data:`io_mo_integrals_e_n` - * :c:data:`io_mo_integrals_kinetic` - * :c:data:`io_mo_integrals_pseudo` - * :c:data:`io_mo_one_e_integrals` - * :c:data:`io_mo_two_e_integrals` - * :c:data:`io_mo_two_e_integrals_erf` - * :c:data:`level_shift` - * :c:data:`max_dim_diis` - * :c:data:`mo_class` - * :c:data:`mo_guess_type` - * :c:data:`mo_integrals_threshold` - * :c:data:`mu_erf` + * :c:data:`ezfio_filename` * :c:data:`n_det_generators` - * :c:data:`n_det_iterations` - * :c:data:`n_det_max` - * :c:data:`n_det_max_full` - * :c:data:`n_det_print_wf` * :c:data:`n_det_selectors` - * :c:data:`n_it_scf_max` - * :c:data:`n_iter` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`no_ivvv_integrals` - * :c:data:`no_vvv_integrals` - * :c:data:`no_vvvv_integrals` - * :c:data:`nucl_charge` - * :c:data:`nucl_charge_remove` + * :c:data:`n_pts_charge` * :c:data:`nucl_coord` - * :c:data:`nucl_label` - * :c:data:`nucl_num` * :c:data:`nuclear_repulsion` - * :c:data:`only_expected_s2` - * :c:data:`pseudo_dz_k` - * :c:data:`pseudo_dz_kl` - * :c:data:`pseudo_grid_rmax` - * :c:data:`pseudo_grid_size` - * :c:data:`pseudo_klocmax` - * :c:data:`pseudo_kmax` - * :c:data:`pseudo_lmax` - * :c:data:`pseudo_n_k` - * :c:data:`pseudo_n_kl` - * :c:data:`pseudo_sym` - * :c:data:`pseudo_v_k` - * :c:data:`pseudo_v_kl` - * :c:data:`pt2_iterations` - * :c:data:`pt2_max` - * :c:data:`pt2_relative_error` - * :c:data:`read_wf` - * :c:data:`s2_eig` - * :c:data:`scf_algorithm` - * :c:data:`selection_factor` - * :c:data:`state_following` - * :c:data:`target_energy` - * :c:data:`thresh_scf` - * :c:data:`thresh_sym` - * :c:data:`threshold_davidson` - * :c:data:`threshold_diis` - * :c:data:`threshold_generators` - * :c:data:`variance_max` - * :c:data:`weight_one_e_dm` - * :c:data:`weight_selection` + * :c:data:`prim_normalization_factor` + * :c:data:`shell_normalization_factor` .. c:var:: qp_kill_filename @@ -435,8 +421,8 @@ Providers .. code:: fortran - character*(128) :: qp_stop_filename - character*(128) :: qp_kill_filename + character*(256) :: qp_stop_filename + character*(256) :: qp_kill_filename integer :: qp_stop_variable @@ -458,8 +444,8 @@ Providers .. code:: fortran - character*(128) :: qp_stop_filename - character*(128) :: qp_kill_filename + character*(256) :: qp_stop_filename + character*(256) :: qp_kill_filename integer :: qp_stop_variable @@ -481,8 +467,8 @@ Providers .. code:: fortran - character*(128) :: qp_stop_filename - character*(128) :: qp_kill_filename + character*(256) :: qp_stop_filename + character*(256) :: qp_kill_filename integer :: qp_stop_variable @@ -524,6 +510,57 @@ Subroutines / functions +.. c:function:: lock_io: + + + File : :file:`ezfio_files/lock.irp.f` + + .. code:: fortran + + subroutine lock_io() + + + Needs to be called because before doing I/O because internal read and write + are not thread safe. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`file_lock` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_slave_work` + * :c:func:`format_w_error` + * :c:func:`json_close` + * :c:data:`json_filename` + * :c:data:`json_unit` + * :c:func:`load_mo_integrals` + * :c:data:`nthreads_davidson` + * :c:data:`nthreads_pt2` + * :c:data:`qp_max_mem` + * :c:func:`read_array_two_rdm` + * :c:func:`read_array_two_trans_rdm` + * :c:func:`resident_memory` + * :c:func:`roothaan_hall_scf` + * :c:func:`total_memory` + * :c:func:`write_array_two_rdm` + * :c:func:`write_array_two_trans_rdm` + * :c:func:`write_cipsi_json` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`omp_set_lock` + + .. c:function:: qp_stop: @@ -544,6 +581,57 @@ Subroutines / functions * :c:data:`qp_stop_filename` +.. c:function:: unlock_io: + + + File : :file:`ezfio_files/lock.irp.f` + + .. code:: fortran + + subroutine unlock_io() + + + Needs to be called because afterdoing I/O because internal read and write + are not thread safe. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`file_lock` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_slave_work` + * :c:func:`format_w_error` + * :c:func:`json_close` + * :c:data:`json_filename` + * :c:data:`json_unit` + * :c:func:`load_mo_integrals` + * :c:data:`nthreads_davidson` + * :c:data:`nthreads_pt2` + * :c:data:`qp_max_mem` + * :c:func:`read_array_two_rdm` + * :c:func:`read_array_two_trans_rdm` + * :c:func:`resident_memory` + * :c:func:`roothaan_hall_scf` + * :c:func:`total_memory` + * :c:func:`write_array_two_rdm` + * :c:func:`write_array_two_trans_rdm` + * :c:func:`write_cipsi_json` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`omp_unset_lock` + + .. c:function:: write_bool: @@ -588,9 +676,20 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`ao_ortho_canonical_coef` * :c:data:`ci_energy` * :c:func:`damping_scf` + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` * :c:data:`nuclear_repulsion` * :c:data:`psi_coef_max` * :c:data:`pt2_e0_denominator` @@ -626,17 +725,28 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` * :c:func:`make_s2_eigenfunction` * :c:data:`mo_num` - * :c:data:`n_cas_bitmask` + * :c:data:`n_act_orb` * :c:data:`n_core_orb` + * :c:data:`n_del_orb` * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_generators_bitmask` - * :c:data:`n_generators_bitmask_restart` + * :c:data:`n_inact_orb` * :c:data:`n_int` + * :c:data:`n_virt_orb` * :c:data:`nthreads_davidson` * :c:data:`nthreads_pt2` * :c:data:`psi_cas` @@ -648,6 +758,7 @@ Subroutines / functions * :c:data:`qp_max_mem` * :c:func:`remove_small_contributions` * :c:func:`save_wavefunction_general` + * :c:func:`save_wavefunction_general_unormalized` * :c:func:`save_wavefunction_specified` * :c:func:`zmq_pt2` @@ -669,118 +780,40 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`output_wall_time_0` * :c:data:`mpi_master` + * :c:data:`output_wall_time_0` Called by: .. hlist:: :columns: 3 - * :c:data:`ao_cartesian` - * :c:data:`ao_coef` - * :c:data:`ao_expo` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_md5` - * :c:data:`ao_nucl` - * :c:data:`ao_num` - * :c:data:`ao_power` - * :c:data:`ao_prim_num` * :c:data:`ci_energy` - * :c:data:`correlation_energy_ratio_max` * :c:func:`damping_scf` - * :c:data:`data_energy_proj` - * :c:data:`data_energy_var` - * :c:data:`data_one_e_dm_alpha_ao` - * :c:data:`data_one_e_dm_alpha_mo` - * :c:data:`data_one_e_dm_beta_ao` - * :c:data:`data_one_e_dm_beta_mo` + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` * :c:func:`davidson_diag_hjj_sjj` - * :c:data:`davidson_sze_max` - * :c:data:`disk_access_nuclear_repulsion` - * :c:data:`disk_based_davidson` - * :c:data:`distributed_davidson` - * :c:data:`do_direct_integrals` - * :c:data:`do_pseudo` - * :c:data:`do_pt2` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` - * :c:data:`energy_iterations` - * :c:data:`frozen_orb_scf` - * :c:data:`h0_type` - * :c:data:`io_ao_integrals_e_n` - * :c:data:`io_ao_integrals_kinetic` - * :c:data:`io_ao_integrals_overlap` - * :c:data:`io_ao_integrals_pseudo` - * :c:data:`io_ao_one_e_integrals` - * :c:data:`io_ao_two_e_integrals` - * :c:data:`io_ao_two_e_integrals_erf` - * :c:data:`io_mo_integrals_e_n` - * :c:data:`io_mo_integrals_kinetic` - * :c:data:`io_mo_integrals_pseudo` - * :c:data:`io_mo_one_e_integrals` - * :c:data:`io_mo_two_e_integrals` - * :c:data:`io_mo_two_e_integrals_erf` - * :c:data:`level_shift` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` * :c:func:`make_s2_eigenfunction` - * :c:data:`max_dim_diis` * :c:func:`mo_as_eigvectors_of_mo_matrix` * :c:func:`mo_as_svd_vectors_of_mo_matrix` * :c:func:`mo_as_svd_vectors_of_mo_matrix_eig` - * :c:data:`mo_class` - * :c:data:`mo_guess_type` - * :c:data:`mo_integrals_threshold` - * :c:data:`mu_erf` + * :c:func:`mo_coef_new_as_svd_vectors_of_mo_matrix_eig` * :c:data:`n_det_generators` - * :c:data:`n_det_iterations` - * :c:data:`n_det_max` - * :c:data:`n_det_max_full` - * :c:data:`n_det_print_wf` * :c:data:`n_det_selectors` - * :c:data:`n_it_scf_max` - * :c:data:`n_iter` - * :c:data:`n_states` - * :c:data:`n_states_diag` - * :c:data:`no_ivvv_integrals` - * :c:data:`no_vvv_integrals` - * :c:data:`no_vvvv_integrals` - * :c:data:`nucl_charge` - * :c:data:`nucl_charge_remove` + * :c:data:`n_pts_charge` * :c:data:`nucl_coord` - * :c:data:`nucl_label` - * :c:data:`nucl_num` * :c:data:`nuclear_repulsion` - * :c:data:`only_expected_s2` - * :c:data:`pseudo_dz_k` - * :c:data:`pseudo_dz_kl` - * :c:data:`pseudo_grid_rmax` - * :c:data:`pseudo_grid_size` - * :c:data:`pseudo_klocmax` - * :c:data:`pseudo_kmax` - * :c:data:`pseudo_lmax` - * :c:data:`pseudo_n_k` - * :c:data:`pseudo_n_kl` - * :c:data:`pseudo_sym` - * :c:data:`pseudo_v_k` - * :c:data:`pseudo_v_kl` - * :c:data:`pt2_iterations` - * :c:data:`pt2_max` - * :c:data:`pt2_relative_error` - * :c:data:`read_wf` + * :c:data:`prim_normalization_factor` * :c:func:`roothaan_hall_scf` - * :c:data:`s2_eig` - * :c:data:`scf_algorithm` - * :c:data:`selection_factor` - * :c:data:`state_following` - * :c:data:`target_energy` - * :c:data:`thresh_scf` - * :c:data:`thresh_sym` - * :c:data:`threshold_davidson` - * :c:data:`threshold_diis` - * :c:data:`threshold_generators` - * :c:data:`variance_max` - * :c:data:`weight_one_e_dm` - * :c:data:`weight_selection` + * :c:data:`shell_normalization_factor` Calls: diff --git a/docs/source/modules/fci.rst b/docs/source/modules/fci.rst index 76f70bc5..2e83bc32 100644 --- a/docs/source/modules/fci.rst +++ b/docs/source/modules/fci.rst @@ -86,93 +86,38 @@ Programs * :ref:`fci` * :ref:`pt2` -Providers ---------- - -.. c:var:: do_ddci - - - File : :file:`fci/class.irp.f` - - .. code:: fortran - - logical :: do_only_1h1p - logical :: do_only_cas - logical :: do_ddci - - - In the FCI case, all those are always false - - - -.. c:var:: do_only_1h1p - - - File : :file:`fci/class.irp.f` - - .. code:: fortran - - logical :: do_only_1h1p - logical :: do_only_cas - logical :: do_ddci - - - In the FCI case, all those are always false - - - -.. c:var:: do_only_cas - - - File : :file:`fci/class.irp.f` - - .. code:: fortran - - logical :: do_only_1h1p - logical :: do_only_cas - logical :: do_ddci - - - In the FCI case, all those are always false - - - - Subroutines / functions ----------------------- -.. c:function:: save_energy: +.. c:function:: write_c_ij_ab: - File : :file:`fci/save_energy.irp.f` + File : :file:`write_c_ij_ab.irp.f` .. code:: fortran - subroutine save_energy(E,pt2) + subroutine write_c_ij_ab - Saves the energy in |EZFIO|. Needs: .. hlist:: :columns: 3 - * :c:data:`n_states` + * :c:data:`read_wf` - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`run_cipsi` - * :c:func:`run_stochastic_cipsi` + * :c:func:`routine` - Calls: + Touches: .. hlist:: :columns: 3 - * :c:func:`ezfio_set_fci_energy` - * :c:func:`ezfio_set_fci_energy_pt2` + * :c:data:`read_wf` diff --git a/docs/source/modules/generators_cas.rst b/docs/source/modules/generators_cas.rst index e4452aca..d1c0f328 100644 --- a/docs/source/modules/generators_cas.rst +++ b/docs/source/modules/generators_cas.rst @@ -17,3 +17,334 @@ the generators as the |CAS| determinants, which can be useful to define post-CAS + + +Providers +--------- + +.. c:var:: n_det_generators + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer :: n_det_generators + + + Number of generator detetrminants + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`mpi_master` + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`output_wall_time_0` + * :c:data:`psi_det_sorted` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`global_selection_buffer` + * :c:data:`n_det_selectors` + * :c:data:`psi_det_generators` + * :c:data:`pt2_f` + * :c:data:`pt2_j` + * :c:data:`pt2_n_tasks` + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_u` + * :c:data:`pt2_w` + + +.. c:var:: psi_coef_generators + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) + integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) + integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) + + + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`n_det` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_w` + + +.. c:var:: psi_coef_sorted_gen + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) + integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) + integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) + + + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`n_det` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_w` + + +.. c:var:: psi_det_generators + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) + integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) + integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) + + + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`n_det` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_w` + + +.. c:var:: psi_det_sorted_gen + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) + integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) + integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) + + + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`n_det` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_w` + + +.. c:var:: psi_det_sorted_gen_order + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) + integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) + double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) + integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) + + + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`act_bitmask` + * :c:data:`n_det` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted` + * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`virt_bitmask` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt2_n_teeth` + * :c:data:`pt2_w` + + +.. c:var:: select_max + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + double precision, allocatable :: select_max (size_select_max) + + + Memo to skip useless selectors + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`size_select_max` + + + +.. c:var:: size_select_max + + + File : :file:`generators_cas/generators.irp.f` + + .. code:: fortran + + integer :: size_select_max + + + Size of the select_max array + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`select_max` + + + +Subroutines / functions +----------------------- + +.. c:function:: extract_cas: + + + File : :file:`generators_cas/extract_cas.irp.f` + + .. code:: fortran + + subroutine extract_cas + + + Replaces the total wave function by the normalized projection on the CAS. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`n_det_generators` + * :c:data:`n_int` + * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`psi_det` + * :c:data:`psi_det_generators` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`n_det` + * :c:data:`psi_coef` + * :c:data:`psi_det` + diff --git a/docs/source/modules/generators_full.rst b/docs/source/modules/generators_full.rst index 98546ad3..8b65f3aa 100644 --- a/docs/source/modules/generators_full.rst +++ b/docs/source/modules/generators_full.rst @@ -42,252 +42,3 @@ Providers * :c:data:`psi_det_generators` - -.. c:var:: n_det_generators - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer :: n_det_generators - - - For Single reference wave functions, the number of generators is 1 : the - Hartree-Fock determinant - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mpi_master` - * :c:data:`n_det` - * :c:data:`output_wall_time_0` - * :c:data:`psi_det_sorted` - * :c:data:`threshold_generators` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`degree_max_generators` - * :c:data:`global_selection_buffer` - * :c:data:`n_det_selectors` - * :c:data:`pt2_f` - * :c:data:`pt2_j` - * :c:data:`pt2_n_tasks` - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_u` - * :c:data:`pt2_w` - - -.. c:var:: psi_coef_generators - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) - double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) - - - For Single reference wave functions, the generator is the - Hartree-Fock determinant - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`degree_max_generators` - - -.. c:var:: psi_coef_sorted_gen - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) - double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) - integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) - - - For Single reference wave functions, the generator is the - Hartree-Fock determinant - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_w` - - -.. c:var:: psi_det_generators - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_det_generators (N_int,2,psi_det_size) - double precision, allocatable :: psi_coef_generators (psi_det_size,N_states) - - - For Single reference wave functions, the generator is the - Hartree-Fock determinant - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`degree_max_generators` - - -.. c:var:: psi_det_sorted_gen - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) - double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) - integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) - - - For Single reference wave functions, the generator is the - Hartree-Fock determinant - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_w` - - -.. c:var:: psi_det_sorted_gen_order - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer(bit_kind), allocatable :: psi_det_sorted_gen (N_int,2,psi_det_size) - double precision, allocatable :: psi_coef_sorted_gen (psi_det_size,N_states) - integer, allocatable :: psi_det_sorted_gen_order (psi_det_size) - - - For Single reference wave functions, the generator is the - Hartree-Fock determinant - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_int` - * :c:data:`n_states` - * :c:data:`psi_det_size` - * :c:data:`psi_det_sorted` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_n_teeth` - * :c:data:`pt2_w` - - -.. c:var:: select_max - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - double precision, allocatable :: select_max (size_select_max) - - - Memo to skip useless selectors - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`size_select_max` - - - -.. c:var:: size_select_max - - - File : :file:`generators_full/generators.irp.f` - - .. code:: fortran - - integer :: size_select_max - - - Size of the select_max array - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`select_max` - diff --git a/docs/source/modules/hartree_fock.rst b/docs/source/modules/hartree_fock.rst index 7513caac..b8673bd9 100644 --- a/docs/source/modules/hartree_fock.rst +++ b/docs/source/modules/hartree_fock.rst @@ -51,7 +51,6 @@ Programs -------- * :ref:`scf` - * :ref:`test` Providers --------- @@ -83,8 +82,10 @@ Providers * :c:data:`ao_overlap_abs` * :c:data:`ao_power` * :c:data:`ao_prim_num` + * :c:data:`ao_two_e_integral_alpha_chol` * :c:data:`ao_two_e_integral_schwartz` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`do_ao_cholesky` * :c:data:`do_direct_integrals` * :c:data:`is_periodic` * :c:data:`n_pt_max_integrals` @@ -92,6 +93,8 @@ Providers * :c:data:`read_ao_two_e_integrals` * :c:data:`scf_density_matrix_ao_alpha` * :c:data:`scf_density_matrix_ao_beta` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` Needed by: @@ -102,6 +105,41 @@ Providers * :c:data:`hf_energy` +.. c:var:: ao_two_e_integral_alpha_chol + + + File : :file:`hartree_fock/fock_matrix_hf.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_two_e_integral_alpha_chol (ao_num,ao_num) + double precision, allocatable :: ao_two_e_integral_beta_chol (ao_num,ao_num) + + + Alpha and Beta Fock matrices in AO basis set + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`cholesky_ao_num` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`qp_max_mem` + * :c:data:`scf_density_matrix_ao` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha` + + .. c:var:: ao_two_e_integral_beta @@ -129,8 +167,10 @@ Providers * :c:data:`ao_overlap_abs` * :c:data:`ao_power` * :c:data:`ao_prim_num` + * :c:data:`ao_two_e_integral_alpha_chol` * :c:data:`ao_two_e_integral_schwartz` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`do_ao_cholesky` * :c:data:`do_direct_integrals` * :c:data:`is_periodic` * :c:data:`n_pt_max_integrals` @@ -138,6 +178,8 @@ Providers * :c:data:`read_ao_two_e_integrals` * :c:data:`scf_density_matrix_ao_alpha` * :c:data:`scf_density_matrix_ao_beta` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` Needed by: @@ -148,6 +190,41 @@ Providers * :c:data:`hf_energy` +.. c:var:: ao_two_e_integral_beta_chol + + + File : :file:`hartree_fock/fock_matrix_hf.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_two_e_integral_alpha_chol (ao_num,ao_num) + double precision, allocatable :: ao_two_e_integral_beta_chol (ao_num,ao_num) + + + Alpha and Beta Fock matrices in AO basis set + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`cholesky_ao_num` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`qp_max_mem` + * :c:data:`scf_density_matrix_ao` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integral_alpha` + + .. c:var:: extra_e_contrib_density @@ -202,6 +279,7 @@ Providers * :c:data:`fock_matrix_ao` * :c:data:`fock_matrix_mo_alpha` * :c:data:`fock_matrix_mo_beta` + * :c:data:`mcscf_fock_alpha_ao` * :c:data:`scf_energy` @@ -235,6 +313,7 @@ Providers * :c:data:`fock_matrix_ao` * :c:data:`fock_matrix_mo_alpha` * :c:data:`fock_matrix_mo_beta` + * :c:data:`mcscf_fock_alpha_ao` * :c:data:`scf_energy` @@ -266,6 +345,58 @@ Providers +.. c:var:: hf_kinetic_energy + + + File : :file:`hartree_fock/hf_energy.irp.f` + + .. code:: fortran + + double precision :: hf_kinetic_energy + double precision :: hf_n_e_energy + + + Hartree-Fock energy containing the nuclear repulsion, and its one- and two-body components. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_num` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + + +.. c:var:: hf_n_e_energy + + + File : :file:`hartree_fock/hf_energy.irp.f` + + .. code:: fortran + + double precision :: hf_kinetic_energy + double precision :: hf_n_e_energy + + + Hartree-Fock energy containing the nuclear repulsion, and its one- and two-body components. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_n_e` + * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_num` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + + .. c:var:: hf_one_electron_energy @@ -344,7 +475,6 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` - * :c:data:`ao_ortho_lowdin_coef` * :c:data:`ezfio_filename` * :c:data:`mo_coef` * :c:data:`mo_guess_type` @@ -379,3 +509,149 @@ Subroutines / functions * :c:data:`mo_coef` * :c:data:`mo_label` + +.. c:function:: main: + + + File : :file:`hartree_fock/print_scf_int.irp.f` + + .. code:: fortran + + subroutine main() + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_map` + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`fock_matrix_ao` + * :c:data:`fock_matrix_mo_alpha` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`print_scf_int` + + +.. c:function:: print_fock_diag: + + + File : :file:`hartree_fock/print_fock_diag.irp.f` + + .. code:: fortran + + subroutine print_fock_diag + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_mo` + * :c:data:`mo_num` + + +.. c:function:: print_pseudo_overlap: + + + File : :file:`hartree_fock/print_pseudo_overlap.irp.f` + + .. code:: fortran + + subroutine print_pseudo_overlap + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_overlap` + * :c:data:`list_core` + * :c:data:`mo_coef` + * :c:data:`mo_num` + * :c:data:`n_core_orb` + + +.. c:function:: print_scf_int: + + + File : :file:`hartree_fock/print_scf_int.irp.f` + + .. code:: fortran + + subroutine print_scf_int + + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`main` + + +.. c:function:: run: + + + File : :file:`hartree_fock/scf.irp.f` + + .. code:: fortran + + subroutine run + + + Run SCF calculation + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`json_int_fmt` + * :c:data:`json_unit` + * :c:data:`mo_label` + * :c:data:`scf_energy` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`casscf` + * :c:func:`scf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ezfio_set_hartree_fock_energy` + * :c:func:`json_close` + * :c:func:`roothaan_hall_scf` + + Touches: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`mo_coef` + * :c:data:`level_shift` + * :c:data:`mo_coef` + diff --git a/docs/source/modules/iterations.rst b/docs/source/modules/iterations.rst index 2d625419..a0f63e06 100644 --- a/docs/source/modules/iterations.rst +++ b/docs/source/modules/iterations.rst @@ -13,115 +13,141 @@ the |FCI| limit. -EZFIO parameters ----------------- - -.. option:: n_iter - - Number of saved iterations - - Default: 1 - -.. option:: n_det_iterations - - Number of determinants at each iteration - - -.. option:: energy_iterations - - The variational energy at each iteration - - -.. option:: pt2_iterations - - The |PT2| correction at each iteration - - - Providers --------- -.. c:var:: extrapolated_energy +.. c:var:: energy_iterations File : :file:`iterations/iterations.irp.f` .. code:: fortran - double precision, allocatable :: extrapolated_energy (N_iter,N_states) + double precision, allocatable :: energy_iterations (n_states,N_iter_max) + double precision, allocatable :: pt2_iterations (n_states,N_iter_max) + double precision, allocatable :: extrapolated_energy (N_iter_max,N_states) - Extrapolated energy, using E_var = f(PT2) where PT2=0 + The energy at each iteration for the extrapolations Needs: .. hlist:: :columns: 3 - * :c:data:`energy_iterations` - * :c:data:`n_det` - * :c:data:`n_iter` + * :c:data:`n_iter_max` * :c:data:`n_states` - * :c:data:`pt2_iterations` -.. c:var:: n_iter +.. c:var:: extrapolated_energy - File : :file:`iterations/io.irp.f` + File : :file:`iterations/iterations.irp.f` .. code:: fortran - integer :: n_iter + double precision, allocatable :: energy_iterations (n_states,N_iter_max) + double precision, allocatable :: pt2_iterations (n_states,N_iter_max) + double precision, allocatable :: extrapolated_energy (N_iter_max,N_states) - number of iterations + The energy at each iteration for the extrapolations Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` - * :c:data:`mpi_master` + * :c:data:`n_iter_max` * :c:data:`n_states` - * :c:data:`output_wall_time_0` + + + +.. c:var:: n_iter + + + File : :file:`iterations/iterations.irp.f` + + .. code:: fortran + + integer :: n_iter + + + Number of CIPSI iterations + + + +.. c:var:: n_iter_max + + + File : :file:`iterations/iterations.irp.f` + + .. code:: fortran + + integer :: n_iter_max + + + Max number of iterations for extrapolations Needed by: .. hlist:: :columns: 3 - * :c:data:`extrapolated_energy` + * :c:data:`energy_iterations` + + +.. c:var:: pt2_iterations + + + File : :file:`iterations/iterations.irp.f` + + .. code:: fortran + + double precision, allocatable :: energy_iterations (n_states,N_iter_max) + double precision, allocatable :: pt2_iterations (n_states,N_iter_max) + double precision, allocatable :: extrapolated_energy (N_iter_max,N_states) + + + The energy at each iteration for the extrapolations + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_iter_max` + * :c:data:`n_states` + Subroutines / functions ----------------------- -.. c:function:: print_extrapolated_energy: +.. c:function:: increment_n_iter: - File : :file:`iterations/print_extrapolation.irp.f` + File : :file:`iterations/iterations.irp.f` .. code:: fortran - subroutine print_extrapolated_energy + subroutine increment_n_iter(e, pt2_data) - Print the extrapolated energy in the output + Does what is necessary to increment n_iter Needs: .. hlist:: :columns: 3 - * :c:data:`extrapolated_energy` + * :c:data:`energy_iterations` * :c:data:`n_det` * :c:data:`n_iter` + * :c:data:`n_iter_max` * :c:data:`n_states` - * :c:data:`pt2_iterations` Called by: @@ -131,15 +157,22 @@ Subroutines / functions * :c:func:`run_cipsi` * :c:func:`run_stochastic_cipsi` + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`extrapolate_data` + -.. c:function:: print_summary: +.. c:function:: print_extrapolated_energy: - File : :file:`iterations/print_summary.irp.f` + File : :file:`iterations/print_extrapolation.irp.f` .. code:: fortran - subroutine print_summary(e_,pt2_data,pt2_data_err,n_det_,n_occ_pattern_,n_st,s2_) + subroutine print_extrapolated_energy Print the extrapolated energy in the output @@ -149,8 +182,10 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`do_pt2` - * :c:data:`s2_eig` + * :c:data:`energy_iterations` + * :c:data:`n_det` + * :c:data:`n_iter` + * :c:data:`n_states` Called by: @@ -160,36 +195,28 @@ Subroutines / functions * :c:func:`run_cipsi` * :c:func:`run_stochastic_cipsi` - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`print_energy_components` - -.. c:function:: save_iterations: +.. c:function:: print_summary: - File : :file:`iterations/iterations.irp.f` + File : :file:`iterations/print_summary.irp.f` .. code:: fortran - subroutine save_iterations(e_, pt2_,n_) + subroutine print_summary(e_,pt2_data,pt2_data_err,n_det_,n_configuration_,n_st,s2_) - Update the energy in the EZFIO file. + Print the extrapolated energy in the output Needs: .. hlist:: :columns: 3 - * :c:data:`energy_iterations` - * :c:data:`n_det_iterations` - * :c:data:`n_iter` - * :c:data:`n_states` - * :c:data:`pt2_iterations` + * :c:data:`do_pt2` + * :c:data:`nsomomax` + * :c:data:`only_expected_s2` + * :c:data:`s2_eig` Called by: @@ -199,20 +226,26 @@ Subroutines / functions * :c:func:`run_cipsi` * :c:func:`run_stochastic_cipsi` - Calls: + +.. c:function:: print_summary_tc: - .. hlist:: - :columns: 3 - * :c:func:`ezfio_set_iterations_energy_iterations` - * :c:func:`ezfio_set_iterations_n_det_iterations` - * :c:func:`ezfio_set_iterations_n_iter` - * :c:func:`ezfio_set_iterations_pt2_iterations` + File : :file:`iterations/summary_tc.irp.f` + + .. code:: fortran + + subroutine print_summary_tc(e_,pt2_data,pt2_data_err,n_det_,n_configuration_,n_st,s2_) - Touches: + + Print the extrapolated energy in the output + + Needs: .. hlist:: :columns: 3 - * :c:data:`n_iter` + * :c:data:`do_pt2` + * :c:data:`nsomomax` + * :c:data:`only_expected_s2` + * :c:data:`s2_eig` diff --git a/docs/source/modules/kohn_sham.rst b/docs/source/modules/kohn_sham.rst index 333e07d8..b78909cd 100644 --- a/docs/source/modules/kohn_sham.rst +++ b/docs/source/modules/kohn_sham.rst @@ -46,10 +46,229 @@ Programs -------- * :ref:`ks_scf` + * :ref:`print_mos` Providers --------- +.. c:var:: ao_potential_alpha_xc + + + File : :file:`pot_functionals.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_potential_alpha_xc (ao_num,ao_num) + double precision, allocatable :: ao_potential_beta_xc (ao_num,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`potential_c_alpha_ao` + * :c:data:`potential_x_alpha_ao` + * :c:data:`potential_xc_alpha_ao` + * :c:data:`same_xc_func` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`ks_energy` + + +.. c:var:: ao_potential_beta_xc + + + File : :file:`pot_functionals.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_potential_alpha_xc (ao_num,ao_num) + double precision, allocatable :: ao_potential_beta_xc (ao_num,ao_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`potential_c_alpha_ao` + * :c:data:`potential_x_alpha_ao` + * :c:data:`potential_xc_alpha_ao` + * :c:data:`same_xc_func` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`ks_energy` + + +.. c:var:: e_correlation_dft + + + File : :file:`pot_functionals.irp.f` + + .. code:: fortran + + double precision :: e_correlation_dft + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`energy_c` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`extra_e_contrib_density` + * :c:data:`ks_energy` + + +.. c:var:: e_exchange_dft + + + File : :file:`pot_functionals.irp.f` + + .. code:: fortran + + double precision :: e_exchange_dft + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`energy_x` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`extra_e_contrib_density` + * :c:data:`ks_energy` + + +.. c:var:: fock_matrix_alpha_no_xc_ao + + + File : :file:`fock_matrix_ks.irp.f` + + .. code:: fortran + + double precision, allocatable :: fock_matrix_alpha_no_xc_ao (ao_num,ao_num) + double precision, allocatable :: fock_matrix_beta_no_xc_ao (ao_num,ao_num) + + + Mono electronic an Coulomb matrix in ao basis set + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_two_e_integral_alpha` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao_alpha` + + +.. c:var:: fock_matrix_beta_no_xc_ao + + + File : :file:`fock_matrix_ks.irp.f` + + .. code:: fortran + + double precision, allocatable :: fock_matrix_alpha_no_xc_ao (ao_num,ao_num) + double precision, allocatable :: fock_matrix_beta_no_xc_ao (ao_num,ao_num) + + + Mono electronic an Coulomb matrix in ao basis set + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_two_e_integral_alpha` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao_alpha` + + +.. c:var:: fock_matrix_energy + + + File : :file:`ks_enery.irp.f` + + .. code:: fortran + + double precision :: ks_energy + double precision :: two_e_energy + double precision :: one_e_energy + double precision :: fock_matrix_energy + double precision :: trace_potential_xc + + + Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_potential_alpha_xc` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`e_correlation_dft` + * :c:data:`e_exchange_dft` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`nuclear_repulsion` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`extra_e_contrib_density` + + .. c:var:: ks_energy @@ -90,6 +309,153 @@ Providers * :c:data:`extra_e_contrib_density` +.. c:var:: one_e_energy + + + File : :file:`ks_enery.irp.f` + + .. code:: fortran + + double precision :: ks_energy + double precision :: two_e_energy + double precision :: one_e_energy + double precision :: fock_matrix_energy + double precision :: trace_potential_xc + + + Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_potential_alpha_xc` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`e_correlation_dft` + * :c:data:`e_exchange_dft` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`nuclear_repulsion` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`extra_e_contrib_density` + + +.. c:var:: trace_potential_xc + + + File : :file:`ks_enery.irp.f` + + .. code:: fortran + + double precision :: ks_energy + double precision :: two_e_energy + double precision :: one_e_energy + double precision :: fock_matrix_energy + double precision :: trace_potential_xc + + + Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_potential_alpha_xc` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`e_correlation_dft` + * :c:data:`e_exchange_dft` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`nuclear_repulsion` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`extra_e_contrib_density` + + +.. c:var:: two_e_energy + + + File : :file:`ks_enery.irp.f` + + .. code:: fortran + + double precision :: ks_energy + double precision :: two_e_energy + double precision :: one_e_energy + double precision :: fock_matrix_energy + double precision :: trace_potential_xc + + + Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals` + * :c:data:`ao_potential_alpha_xc` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`e_correlation_dft` + * :c:data:`e_exchange_dft` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`nuclear_repulsion` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`extra_e_contrib_density` + + Subroutines / functions ----------------------- + +.. c:function:: check_coherence_functional: + + + File : :file:`ks_scf.irp.f` + + .. code:: fortran + + subroutine check_coherence_functional + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`correlation_functional` + * :c:data:`exchange_functional` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`ks_scf` + diff --git a/docs/source/modules/kohn_sham_rs.rst b/docs/source/modules/kohn_sham_rs.rst index d32fca3f..6ef21da8 100644 --- a/docs/source/modules/kohn_sham_rs.rst +++ b/docs/source/modules/kohn_sham_rs.rst @@ -63,264 +63,6 @@ Programs Providers --------- -.. c:var:: ao_potential_alpha_xc - - - File : :file:`pot_functionals.irp.f` - - .. code:: fortran - - double precision, allocatable :: ao_potential_alpha_xc (ao_num,ao_num) - double precision, allocatable :: ao_potential_beta_xc (ao_num,ao_num) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`potential_c_alpha_ao` - * :c:data:`potential_x_alpha_ao` - * :c:data:`potential_xc_alpha_ao` - * :c:data:`same_xc_func` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`rs_ks_energy` - - -.. c:var:: ao_potential_beta_xc - - - File : :file:`pot_functionals.irp.f` - - .. code:: fortran - - double precision, allocatable :: ao_potential_alpha_xc (ao_num,ao_num) - double precision, allocatable :: ao_potential_beta_xc (ao_num,ao_num) - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`potential_c_alpha_ao` - * :c:data:`potential_x_alpha_ao` - * :c:data:`potential_xc_alpha_ao` - * :c:data:`same_xc_func` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`rs_ks_energy` - - -.. c:var:: e_correlation_dft - - - File : :file:`pot_functionals.irp.f` - - .. code:: fortran - - double precision :: e_correlation_dft - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`energy_c` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`extra_e_contrib_density` - * :c:data:`rs_ks_energy` - - -.. c:var:: e_exchange_dft - - - File : :file:`pot_functionals.irp.f` - - .. code:: fortran - - double precision :: e_exchange_dft - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`energy_x` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`extra_e_contrib_density` - * :c:data:`rs_ks_energy` - - -.. c:var:: fock_matrix_alpha_no_xc_ao - - - File : :file:`fock_matrix_rs_ks.irp.f` - - .. code:: fortran - - double precision, allocatable :: fock_matrix_alpha_no_xc_ao (ao_num,ao_num) - double precision, allocatable :: fock_matrix_beta_no_xc_ao (ao_num,ao_num) - - - Mono electronic an Coulomb matrix in ao basis set - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`ao_one_e_integrals` - * :c:data:`ao_two_e_integral_alpha` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`fock_matrix_ao_alpha` - - -.. c:var:: fock_matrix_beta_no_xc_ao - - - File : :file:`fock_matrix_rs_ks.irp.f` - - .. code:: fortran - - double precision, allocatable :: fock_matrix_alpha_no_xc_ao (ao_num,ao_num) - double precision, allocatable :: fock_matrix_beta_no_xc_ao (ao_num,ao_num) - - - Mono electronic an Coulomb matrix in ao basis set - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`ao_one_e_integrals` - * :c:data:`ao_two_e_integral_alpha` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`fock_matrix_ao_alpha` - - -.. c:var:: fock_matrix_energy - - - File : :file:`rs_ks_energy.irp.f` - - .. code:: fortran - - double precision :: rs_ks_energy - double precision :: two_e_energy - double precision :: one_e_energy - double precision :: fock_matrix_energy - double precision :: trace_potential_xc - - - Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`ao_one_e_integrals` - * :c:data:`ao_potential_alpha_xc` - * :c:data:`ao_two_e_integral_alpha` - * :c:data:`e_correlation_dft` - * :c:data:`e_exchange_dft` - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`nuclear_repulsion` - * :c:data:`scf_density_matrix_ao_alpha` - * :c:data:`scf_density_matrix_ao_beta` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`extra_e_contrib_density` - - -.. c:var:: one_e_energy - - - File : :file:`rs_ks_energy.irp.f` - - .. code:: fortran - - double precision :: rs_ks_energy - double precision :: two_e_energy - double precision :: one_e_energy - double precision :: fock_matrix_energy - double precision :: trace_potential_xc - - - Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`ao_one_e_integrals` - * :c:data:`ao_potential_alpha_xc` - * :c:data:`ao_two_e_integral_alpha` - * :c:data:`e_correlation_dft` - * :c:data:`e_exchange_dft` - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`nuclear_repulsion` - * :c:data:`scf_density_matrix_ao_alpha` - * :c:data:`scf_density_matrix_ao_beta` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`extra_e_contrib_density` - - .. c:var:: rs_ks_energy @@ -361,113 +103,6 @@ Providers * :c:data:`extra_e_contrib_density` -.. c:var:: trace_potential_xc - - - File : :file:`rs_ks_energy.irp.f` - - .. code:: fortran - - double precision :: rs_ks_energy - double precision :: two_e_energy - double precision :: one_e_energy - double precision :: fock_matrix_energy - double precision :: trace_potential_xc - - - Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`ao_one_e_integrals` - * :c:data:`ao_potential_alpha_xc` - * :c:data:`ao_two_e_integral_alpha` - * :c:data:`e_correlation_dft` - * :c:data:`e_exchange_dft` - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`nuclear_repulsion` - * :c:data:`scf_density_matrix_ao_alpha` - * :c:data:`scf_density_matrix_ao_beta` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`extra_e_contrib_density` - - -.. c:var:: two_e_energy - - - File : :file:`rs_ks_energy.irp.f` - - .. code:: fortran - - double precision :: rs_ks_energy - double precision :: two_e_energy - double precision :: one_e_energy - double precision :: fock_matrix_energy - double precision :: trace_potential_xc - - - Range-separated Kohn-Sham energy containing the nuclear repulsion energy, and the various components of this quantity. - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_num` - * :c:data:`ao_one_e_integrals` - * :c:data:`ao_potential_alpha_xc` - * :c:data:`ao_two_e_integral_alpha` - * :c:data:`e_correlation_dft` - * :c:data:`e_exchange_dft` - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`nuclear_repulsion` - * :c:data:`scf_density_matrix_ao_alpha` - * :c:data:`scf_density_matrix_ao_beta` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`extra_e_contrib_density` - - Subroutines / functions ----------------------- - -.. c:function:: check_coherence_functional: - - - File : :file:`rs_ks_scf.irp.f` - - .. code:: fortran - - subroutine check_coherence_functional - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`correlation_functional` - * :c:data:`exchange_functional` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`rs_ks_scf` - diff --git a/docs/source/modules/mo_basis.rst b/docs/source/modules/mo_basis.rst index 3dde0f19..38d7fd51 100644 --- a/docs/source/modules/mo_basis.rst +++ b/docs/source/modules/mo_basis.rst @@ -44,6 +44,16 @@ EZFIO parameters Coefficient of the i-th |AO| on the j-th |MO| +.. option:: mo_coef_aux + + AUX Coefficient of the i-th |AO| on the j-th |MO| + + +.. option:: mo_coef_imag + + Imaginary part of the MO coefficient of the i-th |AO| on the j-th |MO| + + .. option:: mo_label Label characterizing the MOS (Local, Canonical, Natural, *etc*) @@ -54,6 +64,11 @@ EZFIO parameters |MO| occupation numbers +.. option:: mo_symmetry + + MOs with the same integer belong to the same irrep. + + .. option:: mo_class [ Core | Inactive | Active | Virtual | Deleted ], as defined by :ref:`qp_set_mo_class` @@ -88,20 +103,19 @@ Providers * :c:data:`ezfio_filename` * :c:data:`mo_num` * :c:data:`mpi_master` - * :c:data:`output_wall_time_0` Needed by: .. hlist:: :columns: 3 - * :c:data:`full_ijkl_bitmask` * :c:data:`list_act` * :c:data:`list_all_but_del_orb` * :c:data:`list_core` * :c:data:`list_del` * :c:data:`list_inact` * :c:data:`list_virt` + * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`n_act_orb` * :c:data:`n_all_but_del_orb` @@ -143,27 +157,65 @@ Providers .. hlist:: :columns: 3 + * :c:data:`attachment_orbitals` + * :c:data:`cholesky_mo_transp` + * :c:data:`d0tu_alpha_ao` + * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`fock_matrix_mo_alpha` + * :c:data:`fock_matrix_mo_beta` + * :c:data:`fps_spf_matrix_mo` + * :c:data:`mcscf_fock_alpha_mo` * :c:data:`mo_coef_in_ao_ortho_basis` - * :c:data:`mo_coef_novirt` * :c:data:`mo_coef_transp` + * :c:data:`mo_deriv_1_x` * :c:data:`mo_dipole_x` * :c:data:`mo_integrals_n_e` * :c:data:`mo_integrals_n_e_per_atom` * :c:data:`mo_kinetic_integrals` * :c:data:`mo_overlap` * :c:data:`mo_pseudo_integrals` + * :c:data:`mo_pseudo_integrals_local` + * :c:data:`mo_pseudo_integrals_non_local` * :c:data:`mo_spread_x` - * :c:data:`mo_two_e_integral_jj_from_ao` + * :c:data:`mo_two_e_int_erf_jj_from_ao` + * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` + * :c:data:`natorbsfci` * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` * :c:data:`one_e_dm_ao_alpha` + * :c:data:`one_e_dm_ao_alpha_nstates` * :c:data:`one_e_dm_mo_alpha_for_dft` * :c:data:`one_e_dm_mo_beta_for_dft` * :c:data:`one_e_spin_density_ao` * :c:data:`psi_det` * :c:data:`s_mo_coef` + * :c:data:`scf_density_matrix_ao_alpha` + * :c:data:`scf_density_matrix_ao_beta` + + +.. c:var:: mo_coef_aux + + + File : :file:`mo_basis/mos_aux.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_coef_aux (ao_num,mo_num) + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_ortho_canonical_coef` + * :c:data:`ezfio_filename` + * :c:data:`mo_num` + * :c:data:`mpi_master` + .. c:var:: mo_coef_imag @@ -246,9 +298,10 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mo_two_e_integral_jj_from_ao` + * :c:data:`cholesky_semi_mo_transp_simple` + * :c:data:`mo_two_e_int_erf_jj_from_ao` + * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_vv_from_ao` .. c:var:: mo_label @@ -311,14 +364,44 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ao_one_e_integrals_from_mo` + * :c:data:`ao_ortho_canonical_nucl_elec_integrals` + * :c:data:`ao_ortho_lowdin_nucl_elec_integrals` + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` * :c:data:`banned_excitation` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`bielecci` + * :c:data:`bielecci_no` * :c:data:`big_array_coulomb_integrals` + * :c:data:`cholesky_mo` + * :c:data:`cholesky_mo_transp` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_total_transp` + * :c:data:`cholesky_semi_mo_transp_simple` * :c:data:`core_fock_operator` + * :c:data:`core_fock_operator_erf` + * :c:data:`d0tu_alpha_ao` * :c:data:`data_one_e_dm_alpha_mo` * :c:data:`data_one_e_dm_beta_mo` + * :c:data:`difference_dm` + * :c:data:`difference_dm_eigvect` + * :c:data:`eigenvectors_fock_matrix_mo` + * :c:data:`fapq` + * :c:data:`fipq` + * :c:data:`fock_matrix_ao` + * :c:data:`fock_matrix_mo` + * :c:data:`fock_matrix_mo_alpha` + * :c:data:`fock_matrix_mo_beta` * :c:data:`fock_operator_closed_shell_ref_bitmask` * :c:data:`fock_wee_closed_shell` + * :c:data:`fps_spf_matrix_mo` * :c:data:`full_ijkl_bitmask` + * :c:data:`h_core_ri` + * :c:data:`int_erf_3_index` * :c:data:`list_act` * :c:data:`list_all_but_del_orb` * :c:data:`list_core` @@ -328,14 +411,21 @@ Providers * :c:data:`list_inact` * :c:data:`list_inact_act` * :c:data:`list_virt` + * :c:data:`lowest_super_ci_coef_mo` + * :c:data:`mcscf_fock_alpha_mo` + * :c:data:`mcscf_fock_mo` * :c:data:`mo_class` * :c:data:`mo_coef` + * :c:data:`mo_coef_aux` * :c:data:`mo_coef_begin_iteration` * :c:data:`mo_coef_imag` * :c:data:`mo_coef_in_ao_ortho_basis` * :c:data:`mo_coef_transp` + * :c:data:`mo_deriv_1_x` * :c:data:`mo_dipole_x` * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_integrals_map` * :c:data:`mo_integrals_n_e` * :c:data:`mo_integrals_n_e_per_atom` @@ -344,22 +434,34 @@ Providers * :c:data:`mo_one_e_integrals` * :c:data:`mo_overlap` * :c:data:`mo_pseudo_integrals` + * :c:data:`mo_pseudo_integrals_local` + * :c:data:`mo_pseudo_integrals_non_local` + * :c:data:`mo_spread_centered_x` * :c:data:`mo_spread_x` - * :c:data:`mo_two_e_integral_jj_from_ao` + * :c:data:`mo_two_e_int_erf_jj` + * :c:data:`mo_two_e_int_erf_jj_from_ao` + * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`mo_two_e_integrals_jj` - * :c:data:`mo_two_e_integrals_vv_from_ao` + * :c:data:`multi_s_deriv_1` + * :c:data:`multi_s_dipole_moment` * :c:data:`n_act_orb` * :c:data:`n_all_but_del_orb` + * :c:data:`n_attachment` * :c:data:`n_core_orb` * :c:data:`n_del_orb` * :c:data:`n_inact_orb` * :c:data:`n_int` * :c:data:`n_virt_orb` + * :c:data:`natorbsci_mos` + * :c:data:`natorbsfci` + * :c:data:`neworbs` + * :c:data:`occnum` * :c:data:`one_body_dm_mo_alpha_one_det` * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` * :c:data:`one_e_dm_ao_alpha` + * :c:data:`one_e_dm_ao_alpha_nstates` * :c:data:`one_e_dm_average_alpha_mo_for_dft` * :c:data:`one_e_dm_average_beta_mo_for_dft` * :c:data:`one_e_dm_average_mo_for_dft` @@ -376,10 +478,19 @@ Providers * :c:data:`one_e_dm_mo_spin_index` * :c:data:`one_e_spin_density_ao` * :c:data:`one_e_spin_density_mo` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` + * :c:data:`one_ints_no` + * :c:data:`ormas_n_orb` * :c:data:`psi_energy_h_core` * :c:data:`s_mo_coef` - * :c:data:`singles_alpha_csc_idx` - * :c:data:`singles_beta_csc_idx` + * :c:data:`super_ci_dm` + * :c:data:`superci_natorb` + * :c:data:`switch_mo_coef` + * :c:data:`two_e_dm_mo` + * :c:data:`umat` + * :c:data:`v_ne_psi_energy` + * :c:data:`z_dipole_moment` .. c:var:: mo_occ @@ -469,12 +580,18 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`four_idx_novvvv` + * :c:data:`fock_matrix_mo_alpha` + * :c:data:`fock_matrix_mo_beta` + * :c:data:`fps_spf_matrix_mo` + * :c:data:`mcscf_fock_alpha_mo` + * :c:data:`mo_deriv_1_x` * :c:data:`mo_dipole_x` * :c:data:`mo_integrals_n_e` * :c:data:`mo_integrals_n_e_per_atom` * :c:data:`mo_kinetic_integrals` * :c:data:`mo_pseudo_integrals` + * :c:data:`mo_pseudo_integrals_local` + * :c:data:`mo_pseudo_integrals_non_local` * :c:data:`mo_spread_x` * :c:data:`one_e_dm_mo_alpha_for_dft` * :c:data:`one_e_dm_mo_beta_for_dft` @@ -554,6 +671,7 @@ Subroutines / functions subroutine give_all_mos_at_r(r,mos_array) + mos_array(i) = ith MO function evaluated at "r" Needs: @@ -622,6 +740,16 @@ Subroutines / functions * :c:data:`mo_label` * :c:data:`mo_num` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`create_guess` + * :c:func:`damping_scf` + * :c:func:`hcore_guess` + * :c:func:`roothaan_hall_scf` + Calls: .. hlist:: @@ -689,7 +817,9 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`set_natorb_no_ov_rot` * :c:func:`set_natural_mos` + * :c:func:`set_natural_mos_canon_label` Calls: @@ -751,7 +881,6 @@ Subroutines / functions * :c:data:`ao_md5` * :c:data:`ao_num` - * :c:data:`ezfio_filename` * :c:data:`mo_class` * :c:data:`mo_coef` * :c:data:`mo_label` @@ -763,7 +892,14 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`damping_scf` + * :c:func:`hcore_guess` + * :c:func:`huckel_guess` + * :c:func:`roothaan_hall_scf` + * :c:func:`run_orb_opt_trust_v2` * :c:func:`save_natural_mos` + * :c:func:`save_natural_mos_canon_label` + * :c:func:`save_natural_mos_no_ov_rot` Calls: @@ -776,7 +912,6 @@ Subroutines / functions * :c:func:`ezfio_set_mo_basis_mo_label` * :c:func:`ezfio_set_mo_basis_mo_num` * :c:func:`ezfio_set_mo_basis_mo_occ` - * :c:func:`system` .. c:function:: save_mos_no_occ: @@ -796,7 +931,6 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` - * :c:data:`ezfio_filename` * :c:data:`mo_coef` * :c:data:`mo_num` @@ -806,7 +940,6 @@ Subroutines / functions :columns: 3 * :c:func:`ezfio_set_mo_basis_mo_coef` - * :c:func:`system` .. c:function:: save_mos_truncated: @@ -827,7 +960,6 @@ Subroutines / functions * :c:data:`ao_md5` * :c:data:`ao_num` - * :c:data:`ezfio_filename` * :c:data:`mo_class` * :c:data:`mo_coef` * :c:data:`mo_label` @@ -844,5 +976,4 @@ Subroutines / functions * :c:func:`ezfio_set_mo_basis_mo_label` * :c:func:`ezfio_set_mo_basis_mo_num` * :c:func:`ezfio_set_mo_basis_mo_occ` - * :c:func:`system` diff --git a/docs/source/modules/mo_guess.rst b/docs/source/modules/mo_guess.rst index 25c9acde..ff35a91b 100644 --- a/docs/source/modules/mo_guess.rst +++ b/docs/source/modules/mo_guess.rst @@ -60,6 +60,7 @@ Providers * :c:data:`ao_num` * :c:data:`ao_overlap` + * :c:data:`lin_dep_cutoff` Needed by: @@ -138,9 +139,11 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`ao_num` + * :c:data:`mo_coef` * :c:data:`mo_label` + * :c:data:`mo_num` * :c:data:`mo_one_e_integrals` - * :c:data:`mo_coef` Calls: @@ -148,6 +151,7 @@ Subroutines / functions :columns: 3 * :c:func:`mo_as_eigvectors_of_mo_matrix` + * :c:func:`nullify_small_elements` * :c:func:`save_mos` Touches: diff --git a/docs/source/modules/mo_one_e_ints.rst b/docs/source/modules/mo_one_e_ints.rst index 1b90c675..f956085c 100644 --- a/docs/source/modules/mo_one_e_ints.rst +++ b/docs/source/modules/mo_one_e_ints.rst @@ -23,12 +23,12 @@ Note that you can find other interesting integrals related to the position opera EZFIO parameters ---------------- -.. option:: mo_integrals_e_n +.. option:: mo_integrals_n_e Nucleus-electron integrals in |MO| basis set -.. option:: io_mo_integrals_e_n +.. option:: io_mo_integrals_n_e Read/Write |MO| electron-nucleus attraction integrals from/to disk [ Write | Read | None ] @@ -71,6 +71,32 @@ EZFIO parameters Providers --------- +.. c:var:: ao_one_e_integrals_from_mo + + + File : :file:`mo_one_e_ints/ao_to_mo.irp.f` + + .. code:: fortran + + double precision, allocatable :: ao_one_e_integrals_from_mo (ao_num,ao_num) + + + Integrals of the one e hamiltonian obtained from the integrals on the MO basis + + WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_num` + * :c:data:`mo_one_e_integrals` + * :c:data:`s_mo_coef` + + + .. c:var:: mo_dipole_x @@ -97,6 +123,14 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_spread_centered_x` + * :c:data:`multi_s_dipole_moment` + * :c:data:`z_dipole_moment` .. c:var:: mo_dipole_y @@ -125,6 +159,14 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_spread_centered_x` + * :c:data:`multi_s_dipole_moment` + * :c:data:`z_dipole_moment` .. c:var:: mo_dipole_z @@ -153,6 +195,14 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_spread_centered_x` + * :c:data:`multi_s_dipole_moment` + * :c:data:`z_dipole_moment` .. c:var:: mo_integrals_n_e @@ -185,6 +235,7 @@ Providers * :c:data:`mo_one_e_integrals` * :c:data:`ref_bitmask_energy` + * :c:data:`v_ne_psi_energy` .. c:var:: mo_integrals_n_e_per_atom @@ -274,8 +325,12 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ao_one_e_integrals_from_mo` * :c:data:`core_energy` + * :c:data:`etwo` * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`h_core_ri` + * :c:data:`one_ints_no` * :c:data:`psi_energy_h_core` * :c:data:`ref_bitmask_energy` @@ -330,6 +385,137 @@ Providers +.. c:var:: mo_pseudo_integrals_local + + + File : :file:`mo_one_e_ints/pot_mo_pseudo_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_pseudo_integrals_local (mo_num,mo_num) + + + Pseudopotential integrals in |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_pseudo_integrals_local` + * :c:data:`do_pseudo` + * :c:data:`mo_coef` + * :c:data:`mo_num` + + + +.. c:var:: mo_pseudo_integrals_non_local + + + File : :file:`mo_one_e_ints/pot_mo_pseudo_ints.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_pseudo_integrals_non_local (mo_num,mo_num) + + + Pseudopotential integrals in |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_pseudo_integrals_non_local` + * :c:data:`do_pseudo` + * :c:data:`mo_coef` + * :c:data:`mo_num` + + + +.. c:var:: mo_spread_centered_x + + + File : :file:`mo_one_e_ints/spread_dipole_mo.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_spread_centered_x (mo_num,mo_num) + double precision, allocatable :: mo_spread_centered_y (mo_num,mo_num) + double precision, allocatable :: mo_spread_centered_z (mo_num,mo_num) + + + array of the integrals of MO_i * (x^2 - ^2) MO_j = MO_i x^2 MO_j - (MO_i x MO_j)^2 + array of the integrals of MO_i * (y^2 - ^2) MO_j = MO_i y^2 MO_j - (MO_i y MO_j)^2 + array of the integrals of MO_i * (z^2 - ^2) MO_j = MO_i z^2 MO_j - (MO_i z MO_j)^2 + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_dipole_x` + * :c:data:`mo_num` + * :c:data:`mo_spread_x` + + + +.. c:var:: mo_spread_centered_y + + + File : :file:`mo_one_e_ints/spread_dipole_mo.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_spread_centered_x (mo_num,mo_num) + double precision, allocatable :: mo_spread_centered_y (mo_num,mo_num) + double precision, allocatable :: mo_spread_centered_z (mo_num,mo_num) + + + array of the integrals of MO_i * (x^2 - ^2) MO_j = MO_i x^2 MO_j - (MO_i x MO_j)^2 + array of the integrals of MO_i * (y^2 - ^2) MO_j = MO_i y^2 MO_j - (MO_i y MO_j)^2 + array of the integrals of MO_i * (z^2 - ^2) MO_j = MO_i z^2 MO_j - (MO_i z MO_j)^2 + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_dipole_x` + * :c:data:`mo_num` + * :c:data:`mo_spread_x` + + + +.. c:var:: mo_spread_centered_z + + + File : :file:`mo_one_e_ints/spread_dipole_mo.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_spread_centered_x (mo_num,mo_num) + double precision, allocatable :: mo_spread_centered_y (mo_num,mo_num) + double precision, allocatable :: mo_spread_centered_z (mo_num,mo_num) + + + array of the integrals of MO_i * (x^2 - ^2) MO_j = MO_i x^2 MO_j - (MO_i x MO_j)^2 + array of the integrals of MO_i * (y^2 - ^2) MO_j = MO_i y^2 MO_j - (MO_i y MO_j)^2 + array of the integrals of MO_i * (z^2 - ^2) MO_j = MO_i z^2 MO_j - (MO_i z MO_j)^2 + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_dipole_x` + * :c:data:`mo_num` + * :c:data:`mo_spread_x` + + + .. c:var:: mo_spread_x @@ -356,6 +542,12 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_spread_centered_x` .. c:var:: mo_spread_y @@ -384,6 +576,12 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_spread_centered_x` .. c:var:: mo_spread_z @@ -412,6 +610,12 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_spread_centered_x` .. c:var:: s_mo_coef @@ -436,6 +640,13 @@ Providers * :c:data:`mo_coef` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_one_e_integrals_from_mo` + * :c:data:`fock_matrix_ao` @@ -465,6 +676,14 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`s_mo_coef` + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_one_e_integrals_from_mo` + * :c:data:`fock_matrix_ao` + Calls: .. hlist:: @@ -499,6 +718,7 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`d0tu_alpha_ao` * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` @@ -537,16 +757,19 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`huckel_guess` + * :c:func:`roothaan_hall_scf` * :c:func:`save_natural_mos` + * :c:func:`save_natural_mos_canon_label` + * :c:func:`save_natural_mos_no_ov_rot` + * :c:func:`scf` Calls: .. hlist:: :columns: 3 - * :c:func:`nullify_small_elements` * :c:func:`ortho_lowdin` - * :c:func:`restore_symmetry` Touches: diff --git a/docs/source/modules/mo_two_e_ints.rst b/docs/source/modules/mo_two_e_ints.rst index a08e3868..115229d5 100644 --- a/docs/source/modules/mo_two_e_ints.rst +++ b/docs/source/modules/mo_two_e_ints.rst @@ -31,18 +31,36 @@ The conventions are: EZFIO parameters ---------------- +.. option:: io_mo_cholesky + + Read/Write |MO| Cholesky integrals from/to disk [ Write | Read | None ] + + Default: None + .. option:: io_mo_two_e_integrals Read/Write |MO| integrals from/to disk [ Write | Read | None ] Default: None +.. option:: mo_integrals_cache_shift + + Adjusts the size of the MO integrals cache. 2: 2KB, 3: 32KB, 4: 512KB, 5: 8MB, 6: 128MB, 7: 2GB, 8: 32GB, 9: 512GB + + Default: 7 + .. option:: mo_integrals_threshold If | | < `mo_integrals_threshold` then is zero Default: 1.e-15 +.. option:: io_mo_two_e_integrals_erf + + Read/Write MO integrals with the long range interaction from/to disk [ Write | Read | None ] + + Default: None + Providers --------- @@ -55,6 +73,7 @@ Providers .. code:: fortran logical, allocatable :: banned_excitation (mo_num,mo_num) + logical :: use_banned_excitation If true, the excitation is banned in the selection. Useful with local MOs. @@ -64,7 +83,6 @@ Providers .. hlist:: :columns: 3 - * :c:data:`mo_integrals_map` * :c:data:`mo_num` Needed by: @@ -88,9 +106,9 @@ Providers double precision, allocatable :: big_array_exchange_integrals (mo_num,mo_num,mo_num) - big_array_coulomb_integrals(i,j) = = (ii|jj) + big_array_coulomb_integrals(j,i,k) = = (ik|jj) - big_array_exchange_integrals(i,j) = = (ij|ij) + big_array_exchange_integrals(j,i,k) = = (ij|kj) Needs: @@ -98,6 +116,9 @@ Providers :columns: 3 * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` * :c:data:`mo_integrals_cache` * :c:data:`mo_integrals_cache_min` * :c:data:`mo_integrals_map` @@ -109,8 +130,12 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` + * :c:data:`h_core_ri` * :c:data:`h_matrix_all_dets` * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`psi_energy_two_e_trans` .. c:var:: big_array_exchange_integrals @@ -124,9 +149,9 @@ Providers double precision, allocatable :: big_array_exchange_integrals (mo_num,mo_num,mo_num) - big_array_coulomb_integrals(i,j) = = (ii|jj) + big_array_coulomb_integrals(j,i,k) = = (ik|jj) - big_array_exchange_integrals(i,j) = = (ij|ij) + big_array_exchange_integrals(j,i,k) = = (ij|kj) Needs: @@ -134,6 +159,9 @@ Providers :columns: 3 * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` * :c:data:`mo_integrals_cache` * :c:data:`mo_integrals_cache_min` * :c:data:`mo_integrals_map` @@ -145,8 +173,152 @@ Providers .. hlist:: :columns: 3 + * :c:data:`coef_hf_selector` + * :c:data:`h_core_ri` * :c:data:`h_matrix_all_dets` * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`psi_energy_two_e_trans` + + +.. c:var:: cholesky_mo + + + File : :file:`mo_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + double precision, allocatable :: cholesky_mo (mo_num,mo_num,cholesky_mo_num) + + + Cholesky vectors in MO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`mo_num` + + + +.. c:var:: cholesky_mo_num + + + File : :file:`mo_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + integer :: cholesky_mo_num + + + Number of Cholesky vectors in MO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_ao_num` + * :c:data:`ezfio_work_dir` + * :c:data:`read_mo_cholesky` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`cholesky_mo` + * :c:data:`cholesky_mo_transp` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_2_idx_transp` + * :c:data:`cholesky_no_total_transp` + * :c:data:`cholesky_semi_mo_transp_simple` + * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_jj` + + +.. c:var:: cholesky_mo_transp + + + File : :file:`mo_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + double precision, allocatable :: cholesky_mo_transp (cholesky_mo_num,mo_num,mo_num) + + + Cholesky vectors in MO basis. Warning: it is transposed wrt cholesky_ao: + + - cholesky_ao is (ao_num^2 x cholesky_ao_num) + + - cholesky_mo_transp is (cholesky_mo_num x mo_num^2) + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`cholesky_ao_num` + * :c:data:`cholesky_mo_num` + * :c:data:`ezfio_work_dir` + * :c:data:`mo_coef` + * :c:data:`mo_num` + * :c:data:`read_mo_cholesky` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`cholesky_mo` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_total_transp` + * :c:data:`cholesky_semi_mo_transp_simple` + * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_jj` + + +.. c:var:: cholesky_semi_mo_transp_simple + + + File : :file:`mo_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + double precision, allocatable :: cholesky_semi_mo_transp_simple (cholesky_mo_num,ao_num,mo_num) + + + Cholesky vectors in MO basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`mo_coef_transp` + * :c:data:`mo_num` + .. c:var:: core_energy @@ -174,6 +346,30 @@ Providers +.. c:var:: core_energy_erf + + + File : :file:`mo_two_e_ints/core_quantities_erf.irp.f` + + .. code:: fortran + + double precision :: core_energy_erf + + + energy from the core : contains all core-core contributionswith the erf interaction + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`list_core` + * :c:data:`mo_two_e_int_erf_jj` + * :c:data:`n_core_orb` + * :c:data:`nuclear_repulsion` + + + .. c:var:: core_fock_operator @@ -192,6 +388,9 @@ Providers :columns: 3 * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` * :c:data:`list_act` * :c:data:`list_core` * :c:data:`mo_integrals_cache` @@ -204,211 +403,267 @@ Providers -.. c:function:: insert_into_mo_integrals_map: +.. c:var:: core_fock_operator_erf - File : :file:`mo_two_e_ints/map_integrals.irp.f` + File : :file:`mo_two_e_ints/core_quantities_erf.irp.f` .. code:: fortran - subroutine insert_into_mo_integrals_map(n_integrals, & - buffer_i, buffer_values, thr) + double precision, allocatable :: core_fock_operator_erf (mo_num,mo_num) - Create new entry into MO map, or accumulate in an existing entry + this is the contribution to the Fock operator from the core electrons with the erf interaction Needs: .. hlist:: :columns: 3 - * :c:data:`mo_integrals_map` + * :c:data:`list_act` + * :c:data:`list_core` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`n_act_orb` + * :c:data:`n_core_orb` - Called by: + + +.. c:var:: do_mo_cholesky + + + File : :file:`mo_two_e_ints/cholesky.irp.f` + + .. code:: fortran + + logical :: do_mo_cholesky + + + If True, use Cholesky vectors for MO integrals + + Needs: .. hlist:: :columns: 3 - * :c:func:`add_integrals_to_map` - * :c:func:`add_integrals_to_map_no_exit_34` - * :c:func:`add_integrals_to_map_three_indices` + * :c:data:`do_ao_cholesky` - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`map_update` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_jj` -.. c:var:: mo_coef_novirt +.. c:var:: h_core_ri - File : :file:`mo_two_e_ints/four_idx_novvvv.irp.f` + File : :file:`mo_two_e_ints/core_quantities.irp.f` .. code:: fortran - double precision, allocatable :: mo_coef_novirt (ao_num,n_core_inact_act_orb) + double precision, allocatable :: h_core_ri (mo_num,mo_num) - MO coefficients without virtual MOs + Core Hamiltonian with 3-index exchange integrals: + + :math:`\tilde{h}{pq} = h_{pq} - \frac{1}{2}\sum_{k} g(pk,kq)` Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` - * :c:data:`list_core_inact_act` - * :c:data:`mo_coef` - * :c:data:`n_core_inact_act_orb` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`mo_num` + * :c:data:`mo_one_e_integrals` -.. c:var:: mo_integrals_cache +.. c:function:: insert_into_mo_integrals_erf_map: - File : :file:`mo_two_e_ints/map_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_integrals_cache (0_8:128_8*128_8*128_8*128_8) + subroutine insert_into_mo_integrals_erf_map(n_integrals, & + buffer_i, buffer_values, thr) - Cache of MO integrals for fast access + Create new entry into |MO| map, or accumulate in an existing entry Needs: .. hlist:: :columns: 3 - * :c:data:`mo_integrals_cache_min` - * :c:data:`mo_integrals_map` - * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_integrals_erf_map` - Needed by: + Called by: .. hlist:: :columns: 3 - * :c:data:`big_array_coulomb_integrals` - * :c:data:`core_fock_operator` - * :c:data:`mo_two_e_integrals_jj` + * :c:func:`add_integrals_to_map_erf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_update` -.. c:var:: mo_integrals_cache_max +.. c:function:: insert_into_mo_integrals_map: File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - integer*4 :: mo_integrals_cache_min - integer*4 :: mo_integrals_cache_max - integer*8 :: mo_integrals_cache_min_8 - integer*8 :: mo_integrals_cache_max_8 + subroutine insert_into_mo_integrals_map(n_integrals, & + buffer_i, buffer_values, thr) - Min and max values of the MOs for which the integrals are in the cache + Create new entry into MO map, or accumulate in an existing entry Needs: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`mo_num` + * :c:data:`mo_integrals_map` - Needed by: + Called by: .. hlist:: :columns: 3 - * :c:data:`big_array_coulomb_integrals` - * :c:data:`core_fock_operator` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_two_e_integrals_jj` + * :c:func:`add_integrals_to_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_update` -.. c:var:: mo_integrals_cache_max_8 +.. c:var:: int_erf_3_index - File : :file:`mo_two_e_ints/map_integrals.irp.f` + File : :file:`mo_two_e_ints/ints_erf_3_index.irp.f` .. code:: fortran - integer*4 :: mo_integrals_cache_min - integer*4 :: mo_integrals_cache_max - integer*8 :: mo_integrals_cache_min_8 - integer*8 :: mo_integrals_cache_max_8 + double precision, allocatable :: int_erf_3_index (mo_num,mo_num,mo_num) + double precision, allocatable :: int_erf_3_index_exc (mo_num,mo_num,mo_num) - Min and max values of the MOs for which the integrals are in the cache + int_erf_3_index(i,j) = = (ii|jj) with the erf interaction + + int_erf_3_index_exc(i,j) = = (ij|ij) with the erf interaction Needs: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + + + +.. c:var:: int_erf_3_index_exc + + + File : :file:`mo_two_e_ints/ints_erf_3_index.irp.f` + + .. code:: fortran + + double precision, allocatable :: int_erf_3_index (mo_num,mo_num,mo_num) + double precision, allocatable :: int_erf_3_index_exc (mo_num,mo_num,mo_num) - Needed by: + + int_erf_3_index(i,j) = = (ii|jj) with the erf interaction + + int_erf_3_index_exc(i,j) = = (ij|ij) with the erf interaction + + Needs: .. hlist:: :columns: 3 - * :c:data:`big_array_coulomb_integrals` - * :c:data:`core_fock_operator` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_two_e_integrals_jj` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + -.. c:var:: mo_integrals_cache_min +.. c:var:: mo_integrals_cache File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - integer*4 :: mo_integrals_cache_min - integer*4 :: mo_integrals_cache_max - integer*8 :: mo_integrals_cache_min_8 - integer*8 :: mo_integrals_cache_max_8 + double precision, allocatable :: mo_integrals_cache (0_8:(1_8*mo_integrals_cache_size)**4) - Min and max values of the MOs for which the integrals are in the cache + Cache of MO integrals for fast access Needs: .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`mo_num` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_cache_shift` + * :c:data:`mo_integrals_map` + * :c:data:`mo_two_e_integrals_in_map` Needed by: .. hlist:: :columns: 3 + * :c:data:`bielecci` * :c:data:`big_array_coulomb_integrals` * :c:data:`core_fock_operator` - * :c:data:`mo_integrals_cache` * :c:data:`mo_two_e_integrals_jj` -.. c:var:: mo_integrals_cache_min_8 +.. c:var:: mo_integrals_cache_max File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - integer*4 :: mo_integrals_cache_min - integer*4 :: mo_integrals_cache_max - integer*8 :: mo_integrals_cache_min_8 - integer*8 :: mo_integrals_cache_max_8 + integer :: mo_integrals_cache_min + integer :: mo_integrals_cache_max + integer :: mo_integrals_cache_size Min and max values of the MOs for which the integrals are in the cache @@ -419,6 +674,7 @@ Providers :columns: 3 * :c:data:`elec_alpha_num` + * :c:data:`mo_integrals_cache_shift` * :c:data:`mo_num` Needed by: @@ -426,29 +682,37 @@ Providers .. hlist:: :columns: 3 + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` * :c:data:`big_array_coulomb_integrals` * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` * :c:data:`mo_integrals_cache` * :c:data:`mo_two_e_integrals_jj` -.. c:var:: mo_integrals_map +.. c:var:: mo_integrals_cache_min File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - type(map_type) :: mo_integrals_map + integer :: mo_integrals_cache_min + integer :: mo_integrals_cache_max + integer :: mo_integrals_cache_size - MO integrals + Min and max values of the MOs for which the integrals are in the cache Needs: .. hlist:: :columns: 3 + * :c:data:`elec_alpha_num` + * :c:data:`mo_integrals_cache_shift` * :c:data:`mo_num` Needed by: @@ -456,221 +720,231 @@ Providers .. hlist:: :columns: 3 - * :c:data:`banned_excitation` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` * :c:data:`big_array_coulomb_integrals` * :c:data:`core_fock_operator` * :c:data:`fock_operator_closed_shell_ref_bitmask` * :c:data:`fock_wee_closed_shell` - * :c:data:`h_matrix_all_dets` - * :c:data:`h_matrix_cas` * :c:data:`mo_integrals_cache` - * :c:data:`mo_two_e_integrals_in_map` * :c:data:`mo_two_e_integrals_jj` -.. c:var:: mo_two_e_integral_jj_from_ao +.. c:var:: mo_integrals_cache_size - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integral_jj_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_exchange_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_anti_from_ao (mo_num,mo_num) + integer :: mo_integrals_cache_min + integer :: mo_integrals_cache_max + integer :: mo_integrals_cache_size - mo_two_e_integral_jj_from_ao(i,j) = J_ij - mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij - mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij + Min and max values of the MOs for which the integrals are in the cache Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`do_direct_integrals` - * :c:data:`mo_coef` - * :c:data:`mo_coef_transp` + * :c:data:`elec_alpha_num` + * :c:data:`mo_integrals_cache_shift` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_two_e_integrals_jj` -.. c:var:: mo_two_e_integrals_in_map +.. c:var:: mo_integrals_erf_cache - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - logical :: mo_two_e_integrals_in_map + double precision, allocatable :: mo_integrals_erf_cache (0:64*64*64*64) - If True, the map of MO two-electron integrals is provided + Cache of |MO| integrals for fast access Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`ezfio_filename` - * :c:data:`full_ijkl_bitmask_4` - * :c:data:`list_core_inact_act` - * :c:data:`mo_class` - * :c:data:`mo_coef` - * :c:data:`mo_coef_transp` - * :c:data:`mo_integrals_map` - * :c:data:`mo_integrals_threshold` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`core_fock_operator_erf` + * :c:data:`int_erf_3_index` + * :c:data:`mo_two_e_int_erf_jj` + + +.. c:var:: mo_integrals_erf_cache_max + + + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + integer :: mo_integrals_erf_cache_min + integer :: mo_integrals_erf_cache_max + + + Min and max values of the MOs for which the integrals are in the cache + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` * :c:data:`mo_num` - * :c:data:`mpi_master` - * :c:data:`n_core_inact_act_orb` - * :c:data:`n_int` - * :c:data:`no_vvvv_integrals` - * :c:data:`read_mo_two_e_integrals` Needed by: .. hlist:: :columns: 3 - * :c:data:`act_2_rdm_aa_mo` - * :c:data:`act_2_rdm_ab_mo` - * :c:data:`act_2_rdm_bb_mo` - * :c:data:`act_2_rdm_spin_trace_mo` - * :c:data:`big_array_coulomb_integrals` - * :c:data:`ci_electronic_energy` - * :c:data:`core_fock_operator` - * :c:data:`fock_operator_closed_shell_ref_bitmask` - * :c:data:`fock_wee_closed_shell` - * :c:data:`h_matrix_all_dets` - * :c:data:`h_matrix_cas` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_two_e_integrals_jj` + * :c:data:`core_fock_operator_erf` + * :c:data:`int_erf_3_index` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_two_e_int_erf_jj` -.. c:var:: mo_two_e_integrals_jj +.. c:var:: mo_integrals_erf_cache_min - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integrals_jj (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_exchange (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_anti (mo_num,mo_num) + integer :: mo_integrals_erf_cache_min + integer :: mo_integrals_erf_cache_max - mo_two_e_integrals_jj(i,j) = J_ij - mo_two_e_integrals_jj_exchange(i,j) = K_ij - mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij + Min and max values of the MOs for which the integrals are in the cache Needs: .. hlist:: :columns: 3 - * :c:data:`banned_excitation` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_integrals_cache_min` - * :c:data:`mo_integrals_map` + * :c:data:`elec_alpha_num` * :c:data:`mo_num` - * :c:data:`mo_two_e_integrals_in_map` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`ref_bitmask_energy` + * :c:data:`core_fock_operator_erf` + * :c:data:`int_erf_3_index` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_two_e_int_erf_jj` -.. c:var:: mo_two_e_integrals_jj_anti +.. c:var:: mo_integrals_erf_map - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integrals_jj (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_exchange (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_anti (mo_num,mo_num) + type(map_type) :: mo_integrals_erf_map - mo_two_e_integrals_jj(i,j) = J_ij - mo_two_e_integrals_jj_exchange(i,j) = K_ij - mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij + |MO| integrals Needs: .. hlist:: :columns: 3 - * :c:data:`banned_excitation` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_integrals_cache_min` - * :c:data:`mo_integrals_map` * :c:data:`mo_num` - * :c:data:`mo_two_e_integrals_in_map` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`ref_bitmask_energy` + * :c:data:`core_fock_operator_erf` + * :c:data:`int_erf_3_index` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_two_e_int_erf_jj` + * :c:data:`mo_two_e_integrals_erf_in_map` -.. c:var:: mo_two_e_integrals_jj_anti_from_ao +.. c:var:: mo_integrals_map - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integral_jj_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_exchange_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_anti_from_ao (mo_num,mo_num) + type(map_type) :: mo_integrals_map - mo_two_e_integral_jj_from_ao(i,j) = J_ij - mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij - mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij + MO integrals Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`do_direct_integrals` - * :c:data:`mo_coef` - * :c:data:`mo_coef_transp` * :c:data:`mo_num` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielecci` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`coef_hf_selector` + * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` + * :c:data:`h_matrix_all_dets` + * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_jj` + * :c:data:`psi_energy_two_e_trans` -.. c:var:: mo_two_e_integrals_jj_exchange +.. c:var:: mo_two_e_int_erf_jj - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integrals_jj (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_exchange (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_anti (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_exchange (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_anti (mo_num,mo_num) mo_two_e_integrals_jj(i,j) = J_ij @@ -682,222 +956,200 @@ Providers .. hlist:: :columns: 3 - * :c:data:`banned_excitation` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_integrals_cache_min` - * :c:data:`mo_integrals_map` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_num` - * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_erf_in_map` Needed by: .. hlist:: :columns: 3 - * :c:data:`core_energy` - * :c:data:`ref_bitmask_energy` + * :c:data:`core_energy_erf` -.. c:var:: mo_two_e_integrals_jj_exchange_from_ao +.. c:var:: mo_two_e_int_erf_jj_anti - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integral_jj_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_exchange_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_jj_anti_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_exchange (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_anti (mo_num,mo_num) - mo_two_e_integral_jj_from_ao(i,j) = J_ij - mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij - mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij + mo_two_e_integrals_jj(i,j) = J_ij + mo_two_e_integrals_jj_exchange(i,j) = K_ij + mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`do_direct_integrals` - * :c:data:`mo_coef` - * :c:data:`mo_coef_transp` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Needed by: + .. hlist:: + :columns: 3 + + * :c:data:`core_energy_erf` -.. c:var:: mo_two_e_integrals_vv_anti_from_ao +.. c:var:: mo_two_e_int_erf_jj_anti_from_ao - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integrals_vv_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_vv_exchange_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_vv_anti_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_exchange_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_anti_from_ao (mo_num,mo_num) - mo_two_e_integrals_vv_from_ao(i,j) = J_ij - mo_two_e_integrals_vv_exchange_from_ao(i,j) = J_ij - mo_two_e_integrals_vv_anti_from_ao(i,j) = J_ij - K_ij - but only for the virtual orbitals + mo_two_e_integral_jj_from_ao(i,j) = J_ij + mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij + mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` + * :c:data:`ao_integrals_erf_map` * :c:data:`ao_integrals_threshold` * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`ao_two_e_integral_erf_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`do_direct_integrals` - * :c:data:`list_virt` * :c:data:`mo_coef` * :c:data:`mo_coef_transp` * :c:data:`mo_num` - * :c:data:`n_virt_orb` -.. c:var:: mo_two_e_integrals_vv_exchange_from_ao +.. c:var:: mo_two_e_int_erf_jj_exchange - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integrals_vv_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_vv_exchange_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_vv_anti_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_exchange (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_anti (mo_num,mo_num) - mo_two_e_integrals_vv_from_ao(i,j) = J_ij - mo_two_e_integrals_vv_exchange_from_ao(i,j) = J_ij - mo_two_e_integrals_vv_anti_from_ao(i,j) = J_ij - K_ij - but only for the virtual orbitals + mo_two_e_integrals_jj(i,j) = J_ij + mo_two_e_integrals_jj_exchange(i,j) = K_ij + mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_integrals_threshold` - * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`do_direct_integrals` - * :c:data:`list_virt` - * :c:data:`mo_coef` - * :c:data:`mo_coef_transp` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_num` - * :c:data:`n_virt_orb` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Needed by: + .. hlist:: + :columns: 3 + + * :c:data:`core_energy_erf` -.. c:var:: mo_two_e_integrals_vv_from_ao +.. c:var:: mo_two_e_int_erf_jj_exchange_from_ao - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - double precision, allocatable :: mo_two_e_integrals_vv_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_vv_exchange_from_ao (mo_num,mo_num) - double precision, allocatable :: mo_two_e_integrals_vv_anti_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_exchange_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_anti_from_ao (mo_num,mo_num) - mo_two_e_integrals_vv_from_ao(i,j) = J_ij - mo_two_e_integrals_vv_exchange_from_ao(i,j) = J_ij - mo_two_e_integrals_vv_anti_from_ao(i,j) = J_ij - K_ij - but only for the virtual orbitals + mo_two_e_integral_jj_from_ao(i,j) = J_ij + mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij + mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` + * :c:data:`ao_integrals_erf_map` * :c:data:`ao_integrals_threshold` * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`ao_two_e_integral_erf_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`do_direct_integrals` - * :c:data:`list_virt` * :c:data:`mo_coef` * :c:data:`mo_coef_transp` * :c:data:`mo_num` - * :c:data:`n_virt_orb` - -Subroutines / functions ------------------------ - -.. c:function:: add_integrals_to_map: +.. c:var:: mo_two_e_int_erf_jj_from_ao - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - subroutine add_integrals_to_map(mask_ijkl) + double precision, allocatable :: mo_two_e_int_erf_jj_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_exchange_from_ao (mo_num,mo_num) + double precision, allocatable :: mo_two_e_int_erf_jj_anti_from_ao (mo_num,mo_num) - Adds integrals to tha MO map according to some bitmask + mo_two_e_integral_jj_from_ao(i,j) = J_ij + mo_two_e_integrals_jj_exchange_from_ao(i,j) = J_ij + mo_two_e_integrals_jj_anti_from_ao(i,j) = J_ij - K_ij Needs: .. hlist:: :columns: 3 + * :c:data:`ao_integrals_erf_map` + * :c:data:`ao_integrals_threshold` * :c:data:`ao_num` - * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`ao_two_e_integral_erf_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` + * :c:data:`do_direct_integrals` * :c:data:`mo_coef` * :c:data:`mo_coef_transp` - * :c:data:`mo_integrals_map` - * :c:data:`mo_integrals_threshold` * :c:data:`mo_num` - * :c:data:`n_int` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`four_idx_novvvv2` - * :c:data:`mo_two_e_integrals_in_map` - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`bitstring_to_list` - * :c:func:`cpu_time` - * :c:func:`get_ao_two_e_integrals` - * :c:func:`insert_into_mo_integrals_map` - * :c:func:`map_merge` - * :c:func:`mo_two_e_integrals_index` - * :c:func:`wall_time` -.. c:function:: add_integrals_to_map_no_exit_34: +.. c:var:: mo_two_e_integrals_erf_in_map - File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` .. code:: fortran - subroutine add_integrals_to_map_no_exit_34(mask_ijkl) + logical :: mo_two_e_integrals_erf_in_map - Adds integrals to tha MO map according to some bitmask + If True, the map of MO two-electron integrals is provided Needs: @@ -905,39 +1157,43 @@ Subroutines / functions :columns: 3 * :c:data:`ao_num` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`ezfio_filename` + * :c:data:`full_ijkl_bitmask_4` + * :c:data:`mo_class` * :c:data:`mo_coef` * :c:data:`mo_coef_transp` - * :c:data:`mo_integrals_map` + * :c:data:`mo_integrals_erf_map` * :c:data:`mo_integrals_threshold` * :c:data:`mo_num` + * :c:data:`mpi_master` * :c:data:`n_int` + * :c:data:`qp_max_mem` + * :c:data:`read_mo_two_e_integrals_erf` - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`bitstring_to_list` - * :c:func:`cpu_time` - * :c:func:`get_ao_two_e_integrals` - * :c:func:`insert_into_mo_integrals_map` - * :c:func:`map_merge` - * :c:func:`mo_two_e_integrals_index` - * :c:func:`wall_time` + * :c:data:`core_fock_operator_erf` + * :c:data:`int_erf_3_index` + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_two_e_int_erf_jj` -.. c:function:: add_integrals_to_map_three_indices: +.. c:var:: mo_two_e_integrals_in_map File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` .. code:: fortran - subroutine add_integrals_to_map_three_indices(mask_ijk) + logical :: mo_two_e_integrals_in_map - Adds integrals to tha MO map according to some bitmask + If True, the map of MO two-electron integrals is provided Needs: @@ -946,20 +1202,245 @@ Subroutines / functions * :c:data:`ao_num` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_ao_cholesky` + * :c:data:`do_mo_cholesky` + * :c:data:`ezfio_filename` + * :c:data:`full_ijkl_bitmask_4` + * :c:data:`mo_class` * :c:data:`mo_coef` * :c:data:`mo_coef_transp` * :c:data:`mo_integrals_map` * :c:data:`mo_integrals_threshold` * :c:data:`mo_num` + * :c:data:`mpi_master` * :c:data:`n_int` + * :c:data:`qp_max_mem` + * :c:data:`read_mo_two_e_integrals` - Calls: + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielecci` + * :c:data:`big_array_coulomb_integrals` + * :c:data:`ci_electronic_energy` + * :c:data:`coef_hf_selector` + * :c:data:`core_fock_operator` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` + * :c:data:`h_matrix_all_dets` + * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`hessmat` + * :c:data:`hessmat_peter` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_two_e_integrals_jj` + * :c:data:`psi_energy_two_e_trans` + + +.. c:var:: mo_two_e_integrals_jj + + + File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_two_e_integrals_jj (mo_num,mo_num) + double precision, allocatable :: mo_two_e_integrals_jj_exchange (mo_num,mo_num) + double precision, allocatable :: mo_two_e_integrals_jj_anti (mo_num,mo_num) + + + mo_two_e_integrals_jj(i,j) = J_ij + mo_two_e_integrals_jj_exchange(i,j) = K_ij + mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_in_map` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`core_energy` + * :c:data:`ref_bitmask_energy` + + +.. c:var:: mo_two_e_integrals_jj_anti + + + File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_two_e_integrals_jj (mo_num,mo_num) + double precision, allocatable :: mo_two_e_integrals_jj_exchange (mo_num,mo_num) + double precision, allocatable :: mo_two_e_integrals_jj_anti (mo_num,mo_num) + + + mo_two_e_integrals_jj(i,j) = J_ij + mo_two_e_integrals_jj_exchange(i,j) = K_ij + mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_in_map` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`core_energy` + * :c:data:`ref_bitmask_energy` + + +.. c:var:: mo_two_e_integrals_jj_exchange + + + File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + + .. code:: fortran + + double precision, allocatable :: mo_two_e_integrals_jj (mo_num,mo_num) + double precision, allocatable :: mo_two_e_integrals_jj_exchange (mo_num,mo_num) + double precision, allocatable :: mo_two_e_integrals_jj_anti (mo_num,mo_num) + + + mo_two_e_integrals_jj(i,j) = J_ij + mo_two_e_integrals_jj_exchange(i,j) = K_ij + mo_two_e_integrals_jj_anti(i,j) = J_ij - K_ij + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_map` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_in_map` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`core_energy` + * :c:data:`ref_bitmask_energy` + + +.. c:var:: use_banned_excitation + + + File : :file:`mo_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + logical, allocatable :: banned_excitation (mo_num,mo_num) + logical :: use_banned_excitation + + + If true, the excitation is banned in the selection. Useful with local MOs. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`big_array_coulomb_integrals` + * :c:data:`core_fock_operator` + * :c:data:`mo_two_e_integrals_jj` + + + +Subroutines / functions +----------------------- + +.. c:function:: add_integrals_to_map: + + + File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + + .. code:: fortran + + subroutine add_integrals_to_map(mask_ijkl) + + + Adds integrals to the MO map according to some bitmask + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`mo_coef` + * :c:data:`mo_coef_transp` + * :c:data:`mo_integrals_map` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + * :c:data:`n_int` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_two_e_integrals_in_map` + + Calls: .. hlist:: :columns: 3 * :c:func:`bitstring_to_list` - * :c:func:`cpu_time` * :c:func:`get_ao_two_e_integrals` * :c:func:`insert_into_mo_integrals_map` * :c:func:`map_merge` @@ -967,35 +1448,35 @@ Subroutines / functions * :c:func:`wall_time` -.. c:function:: ao_to_mo_novirt: +.. c:function:: add_integrals_to_map_cholesky: - File : :file:`mo_two_e_ints/four_idx_novvvv.irp.f` + File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` .. code:: fortran - subroutine ao_to_mo_novirt(A_ao,LDA_ao,A_mo,LDA_mo) + subroutine add_integrals_to_map_cholesky - Transform A from the |AO| basis to the |MO| basis excluding virtuals - - $C^\dagger.A_{ao}.C$ + Adds integrals to the MO map using Cholesky vectors Needs: .. hlist:: :columns: 3 - * :c:data:`ao_num` - * :c:data:`mo_coef_novirt` - * :c:data:`n_core_inact_act_orb` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`mo_integrals_map` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` Called by: .. hlist:: :columns: 3 - * :c:func:`four_idx_novvvv` + * :c:data:`mo_two_e_integrals_in_map` Calls: @@ -1003,6 +1484,86 @@ Subroutines / functions :columns: 3 * :c:func:`dgemm` + * :c:func:`map_append` + * :c:func:`map_sort` + * :c:func:`map_unique` + * :c:func:`mo_two_e_integrals_index` + * :c:func:`set_multiple_levels_omp` + + +.. c:function:: add_integrals_to_map_erf: + + + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` + + .. code:: fortran + + subroutine add_integrals_to_map_erf(mask_ijkl) + + + Adds integrals to tha MO map according to some bitmask + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`mo_coef` + * :c:data:`mo_coef_transp` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + * :c:data:`n_int` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`bitstring_to_list` + * :c:func:`bitstring_to_str` + * :c:func:`cpu_time` + * :c:func:`get_ao_two_e_integrals_erf` + * :c:func:`insert_into_mo_integrals_erf_map` + * :c:func:`map_merge` + * :c:func:`mo_two_e_integrals_index` + * :c:func:`wall_time` + + +.. c:function:: clear_mo_erf_map: + + + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` + + .. code:: fortran + + subroutine clear_mo_erf_map + + + Frees the memory of the MO map + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_deinit` .. c:function:: clear_mo_map: @@ -1024,204 +1585,483 @@ Subroutines / functions * :c:data:`mo_integrals_map` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`run_orb_opt_trust_v2` + * :c:func:`update_parameters` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_deinit` + + +.. c:function:: dump_mo_integrals: + + + File : :file:`mo_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine dump_mo_integrals(filename) + + + Save to disk the |MO| integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_map` + * :c:data:`mpi_master` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ezfio_set_work_empty` + + +.. c:function:: four_idx_dgemm: + + + File : :file:`mo_two_e_ints/mo_bi_integrals.irp.f` + + .. code:: fortran + + subroutine four_idx_dgemm + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`mo_coef` + * :c:data:`mo_integrals_map` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`get_ao_two_e_integrals` + * :c:func:`map_append` + * :c:func:`map_sort` + * :c:func:`map_unique` + * :c:func:`mo_two_e_integrals_index` + + +.. c:function:: four_idx_dgemm_erf: + + + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` + + .. code:: fortran + + subroutine four_idx_dgemm_erf + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`mo_coef` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_integrals_threshold` + * :c:data:`mo_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`get_ao_two_e_integrals_erf` + * :c:func:`map_append` + * :c:func:`map_sort` + * :c:func:`map_unique` + * :c:func:`mo_two_e_integrals_index` + + +.. c:function:: get_mo_erf_map_size: + + + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + integer*8 function get_mo_erf_map_size() + + + Returns the number of elements in the |MO| map + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_map` + + +.. c:function:: get_mo_map_size: + + + File : :file:`mo_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + integer*8 function get_mo_map_size() + + + Return the number of elements in the MO map + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_map` + + +.. c:function:: get_mo_two_e_integral_erf: + + + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + double precision function get_mo_two_e_integral_erf(i,j,k,l,map) + + + Returns one integral $\langle ij|kl \rangle$ in the |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_cache_min` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_get` + * :c:func:`two_e_integrals_index` + + +.. c:function:: get_mo_two_e_integrals: + + + File : :file:`mo_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) + + + Returns multiple integrals in the MO basis, all + i for j,k,l fixed. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_num` + * :c:data:`mo_two_e_integrals_in_map` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`get_d0` + * :c:func:`get_d1` + * :c:func:`get_mo_two_e_integrals_i1j1` + * :c:func:`get_mo_two_e_integrals_ij` + Calls: .. hlist:: :columns: 3 - * :c:func:`map_deinit` + * :c:func:`dgemv` + * :c:func:`get_mo_two_e_integrals_cache` + * :c:func:`map_get` -.. c:function:: dump_mo_integrals: +.. c:function:: get_mo_two_e_integrals_cache: File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine dump_mo_integrals(filename) + subroutine get_mo_two_e_integrals_cache(j,k,l,sze,out_val) - Save to disk the |MO| integrals + Returns multiple integrals in the MO basis, all + i for j,k,l fixed, all integrals from the cache Needs: .. hlist:: :columns: 3 - * :c:data:`mo_integrals_map` - * :c:data:`mpi_master` + * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_cache_shift` - Calls: + Called by: .. hlist:: :columns: 3 - * :c:func:`ezfio_set_work_empty` + * :c:func:`get_mo_two_e_integrals` + * :c:func:`get_mo_two_e_integrals_i1j1` + * :c:func:`get_mo_two_e_integrals_ij` -.. c:function:: four_idx_novvvv: +.. c:function:: get_mo_two_e_integrals_coulomb_ii: - File : :file:`mo_two_e_ints/four_idx_novvvv.irp.f` + File : :file:`mo_two_e_ints/map_integrals.irp.f` .. code:: fortran - subroutine four_idx_novvvv + subroutine get_mo_two_e_integrals_coulomb_ii(k,l,sze,out_val,map) - Retransform MO integrals for next CAS-SCF step + Returns multiple integrals + k(1)i(2) 1/r12 l(1)i(2) :: out_val(i1) + for k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`ao_integrals_map` - * :c:data:`ao_num` - * :c:data:`list_core_inact_act` - * :c:data:`mo_integrals_map` - * :c:data:`mo_integrals_threshold` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` * :c:data:`mo_num` - * :c:data:`n_core_inact_act_orb` + * :c:data:`mo_two_e_integrals_in_map` Called by: .. hlist:: :columns: 3 - * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`fock_operator_closed_shell_ref_bitmask` + * :c:data:`fock_wee_closed_shell` Calls: .. hlist:: :columns: 3 - * :c:func:`ao_to_mo` - * :c:func:`ao_to_mo_novirt` - * :c:func:`map_append` - * :c:func:`map_shrink` - * :c:func:`map_sort` - * :c:func:`map_unique` - * :c:func:`two_e_integrals_index` + * :c:func:`dgemv` -.. c:function:: four_idx_novvvv2: +.. c:function:: get_mo_two_e_integrals_erf: - File : :file:`mo_two_e_ints/four_idx_novvvv.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - subroutine four_idx_novvvv2 + subroutine get_mo_two_e_integrals_erf(j,k,l,sze,out_val,map) + Returns multiple integrals $\langle ij|kl \rangle$ in the |MO| basis, all + i for j,k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`core_inact_act_bitmask_4` - * :c:data:`full_ijkl_bitmask_4` - * :c:data:`n_int` - * :c:data:`virt_bitmask` + * :c:data:`mo_two_e_integrals_erf_in_map` Calls: .. hlist:: :columns: 3 - * :c:func:`add_integrals_to_map` + * :c:func:`map_get_many` + * :c:func:`two_e_integrals_index` -.. c:function:: get_mo_map_size: +.. c:function:: get_mo_two_e_integrals_erf_coulomb_ii: - File : :file:`mo_two_e_ints/map_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - integer*8 function get_mo_map_size() + subroutine get_mo_two_e_integrals_erf_coulomb_ii(k,l,sze,out_val,map) - Return the number of elements in the MO map + Returns multiple integrals $\langle ki|li \rangle$ + + k(1)i(2) 1/r12 l(1)i(2) :: out_val(i1) + for k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`mo_integrals_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`map_get_many` + * :c:func:`two_e_integrals_index` -.. c:function:: get_mo_two_e_integrals: +.. c:function:: get_mo_two_e_integrals_erf_exch_ii: - File : :file:`mo_two_e_ints/map_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) + subroutine get_mo_two_e_integrals_erf_exch_ii(k,l,sze,out_val,map) - Returns multiple integrals in the MO basis, all - i for j,k,l fixed. + Returns multiple integrals $\langle ki|il \rangle$ + + $\int k(1)i(2) \frac{1}{r_{12}} i(1)l(2)$ :: out_val(i1) + for k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`banned_excitation` - * :c:data:`mo_integrals_cache` - * :c:data:`mo_integrals_cache_min` - * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_erf_in_map` - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`get_mo_two_e_integrals_i1j1` - * :c:func:`get_mo_two_e_integrals_ij` + * :c:func:`map_get_many` + * :c:func:`two_e_integrals_index` + + +.. c:function:: get_mo_two_e_integrals_erf_i1j1: + + + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + subroutine get_mo_two_e_integrals_erf_i1j1(k,l,sze,out_array,map) + + + Returns multiple integrals $\langle ik|jl \rangle$ in the |MO| basis, all + $\int i(1)j(1) \frac{\erf(\mu * r_{12})}{r_{12}} k(2)l(2)$ + i, j for k,l fixed. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_integrals_erf_in_map` Calls: .. hlist:: :columns: 3 - * :c:func:`map_get` + * :c:func:`i2sort` + * :c:func:`i8sort` + * :c:func:`isort` + * :c:func:`map_get_many` + * :c:func:`two_e_integrals_index` -.. c:function:: get_mo_two_e_integrals_coulomb_ii: +.. c:function:: get_mo_two_e_integrals_erf_ij: - File : :file:`mo_two_e_ints/map_integrals.irp.f` + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` .. code:: fortran - subroutine get_mo_two_e_integrals_coulomb_ii(k,l,sze,out_val,map) + subroutine get_mo_two_e_integrals_erf_ij(k,l,sze,out_array,map) - Returns multiple integrals - k(1)i(2) 1/r12 l(1)i(2) :: out_val(i1) - for k,l fixed. + Returns multiple integrals $\langle ij|kl \rangle$ in the |MO| basis, all + $\int i(1)j(2) \frac{1}{r_{12}} k(1)l(2)$ + i, j for k,l fixed. Needs: .. hlist:: :columns: 3 - * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_integrals_erf_in_map` - Called by: + Calls: .. hlist:: :columns: 3 - * :c:data:`fock_operator_closed_shell_ref_bitmask` - * :c:data:`fock_wee_closed_shell` + * :c:func:`i2sort` + * :c:func:`i8sort` + * :c:func:`isort` + * :c:func:`map_get_many` + * :c:func:`two_e_integrals_index` .. c:function:: get_mo_two_e_integrals_exch_ii: @@ -1243,6 +2083,11 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_num` * :c:data:`mo_two_e_integrals_in_map` Called by: @@ -1273,14 +2118,28 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_num` * :c:data:`mo_two_e_integrals_in_map` + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pqxx_array` + Calls: .. hlist:: :columns: 3 + * :c:func:`dgemv` * :c:func:`get_mo_two_e_integrals` + * :c:func:`get_mo_two_e_integrals_cache` .. c:function:: get_mo_two_e_integrals_ij: @@ -1297,12 +2156,32 @@ Subroutines / functions i(1)j(2) 1/r12 k(1)l(2) i, j for k,l fixed. + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`bielec_pxxq_array` + Calls: .. hlist:: :columns: 3 + * :c:func:`dgemm` * :c:func:`get_mo_two_e_integrals` + * :c:func:`get_mo_two_e_integrals_cache` .. c:function:: get_two_e_integral: @@ -1323,6 +2202,9 @@ Subroutines / functions :columns: 3 * :c:data:`banned_excitation` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`do_mo_cholesky` * :c:data:`mo_integrals_cache` * :c:data:`mo_integrals_cache_min` * :c:data:`mo_two_e_integrals_in_map` @@ -1336,6 +2218,28 @@ Subroutines / functions * :c:func:`two_e_integrals_index` +.. c:function:: get_two_e_integral_cache: + + + File : :file:`mo_two_e_ints/map_integrals.irp.f` + + .. code:: fortran + + double precision function get_two_e_integral_cache(i,j,k,l) + + + Returns one integral in the MO basis taken from the cache + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_cache` + * :c:data:`mo_integrals_cache_min` + * :c:data:`mo_integrals_cache_shift` + + .. c:function:: load_mo_integrals: @@ -1357,6 +2261,37 @@ Subroutines / functions Calls: + .. hlist:: + :columns: 3 + + * :c:func:`cache_map_reallocate` + * :c:func:`lock_io` + * :c:func:`map_deinit` + * :c:func:`map_sort` + * :c:func:`unlock_io` + + +.. c:function:: load_mo_integrals_erf: + + + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + integer function load_mo_integrals_erf(filename) + + + Read from disk the |MO| erf integrals + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_map` + + Calls: + .. hlist:: :columns: 3 @@ -1387,6 +2322,41 @@ Subroutines / functions * :c:data:`mo_two_e_integrals_in_map` +.. c:function:: mo_two_e_integral_erf: + + + File : :file:`mo_two_e_ints/map_integrals_erf.irp.f` + + .. code:: fortran + + double precision function mo_two_e_integral_erf(i,j,k,l) + + + Returns one integral $\langle ij|kl \rangle$ in the |MO| basis + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_cache` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + + +.. c:function:: mo_two_e_integrals_erf_index: + + + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` + + .. code:: fortran + + subroutine mo_two_e_integrals_erf_index(i,j,k,l,i1) + + + Computes an unique index for i,j,k,l integrals + + .. c:function:: mo_two_e_integrals_index: @@ -1405,6 +2375,91 @@ Subroutines / functions :columns: 3 * :c:func:`add_integrals_to_map` - * :c:func:`add_integrals_to_map_no_exit_34` - * :c:func:`add_integrals_to_map_three_indices` + * :c:func:`add_integrals_to_map_cholesky` + * :c:func:`add_integrals_to_map_erf` + * :c:func:`four_idx_dgemm` + * :c:func:`four_idx_dgemm_erf` + + +.. c:function:: provide_all_mo_integrals_erf: + + + File : :file:`mo_two_e_ints/mo_bi_integrals_erf.irp.f` + + .. code:: fortran + + subroutine provide_all_mo_integrals_erf + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_int_erf_jj` + * :c:data:`mo_two_e_int_erf_jj` + * :c:data:`mo_two_e_int_erf_jj` + * :c:data:`mo_two_e_integrals_erf_in_map` + + +.. c:function:: save_erf_two_e_integrals_mo: + + + File : :file:`mo_two_e_ints/routines_save_integrals_erf.irp.f` + + .. code:: fortran + + subroutine save_erf_two_e_integrals_mo + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ezfio_set_mo_two_e_ints_io_mo_two_e_integrals_erf` + * :c:func:`ezfio_set_work_empty` + * :c:func:`map_save_to_disk` + + +.. c:function:: save_erf_two_e_ints_mo_into_ints_mo: + + + File : :file:`mo_two_e_ints/routines_save_integrals_erf.irp.f` + + .. code:: fortran + + subroutine save_erf_two_e_ints_mo_into_ints_mo + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mo_integrals_erf_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`ezfio_set_mo_two_e_ints_io_mo_two_e_integrals` + * :c:func:`ezfio_set_work_empty` + * :c:func:`map_save_to_disk` diff --git a/docs/source/modules/mpi.rst b/docs/source/modules/mpi.rst index 2f25799e..17a120ba 100644 --- a/docs/source/modules/mpi.rst +++ b/docs/source/modules/mpi.rst @@ -59,19 +59,39 @@ Providers .. hlist:: :columns: 3 + * :c:data:`absolute_eig` + * :c:data:`act_mos_opt` + * :c:data:`adaptive_pt2_max` * :c:data:`ao_cartesian` + * :c:data:`ao_cholesky_threshold` * :c:data:`ao_coef` * :c:data:`ao_expo` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_pw` * :c:data:`ao_integrals_threshold` * :c:data:`ao_md5` + * :c:data:`ao_normalized` * :c:data:`ao_nucl` * :c:data:`ao_num` + * :c:data:`ao_one_e_integrals_threshold` + * :c:data:`ao_ortho_canonical_coef` * :c:data:`ao_power` * :c:data:`ao_prim_num` * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`cas_bitmask` + * :c:data:`avoid_saddle` + * :c:data:`basis` + * :c:data:`basis_nucleus_index` + * :c:data:`calc_dipole_moment` + * :c:data:`calc_energy_components` + * :c:data:`calc_osc_str` + * :c:data:`calc_tr_dipole_moment` * :c:data:`ci_energy` * :c:data:`correlation_energy_ratio_max` + * :c:data:`correlation_functional` + * :c:data:`criterion_casscf` + * :c:data:`csf_based` + * :c:data:`damping_for_rs_dft` * :c:data:`data_energy_proj` * :c:data:`data_energy_var` * :c:data:`data_one_e_dm_alpha_ao` @@ -79,63 +99,90 @@ Providers * :c:data:`data_one_e_dm_beta_ao` * :c:data:`data_one_e_dm_beta_mo` * :c:data:`davidson_sze_max` - * :c:data:`disk_access_nuclear_repulsion` + * :c:data:`density_for_dft` + * :c:data:`diag_hess_cas` * :c:data:`disk_based_davidson` * :c:data:`distributed_davidson` - * :c:data:`do_direct_integrals` + * :c:data:`do_ao_cholesky` + * :c:data:`do_mom` + * :c:data:`do_ormas` * :c:data:`do_pseudo` * :c:data:`do_pt2` * :c:data:`elec_alpha_num` * :c:data:`elec_beta_num` * :c:data:`element_name` - * :c:data:`energy_iterations` + * :c:data:`exchange_functional` + * :c:data:`excitation_alpha_max` + * :c:data:`excitation_beta_max` + * :c:data:`excitation_max` + * :c:data:`excitation_ref` + * :c:data:`fast_2rdm` * :c:data:`frozen_orb_scf` - * :c:data:`generators_bitmask` - * :c:data:`generators_bitmask_restart` * :c:data:`h0_type` - * :c:data:`io_ao_integrals_e_n` + * :c:data:`hess_cv_cv` + * :c:data:`hf_exchange` + * :c:data:`io_ao_cholesky` * :c:data:`io_ao_integrals_kinetic` + * :c:data:`io_ao_integrals_n_e` * :c:data:`io_ao_integrals_overlap` * :c:data:`io_ao_integrals_pseudo` * :c:data:`io_ao_one_e_integrals` * :c:data:`io_ao_two_e_integrals` * :c:data:`io_ao_two_e_integrals_erf` - * :c:data:`io_mo_integrals_e_n` + * :c:data:`io_mo_cholesky` * :c:data:`io_mo_integrals_kinetic` + * :c:data:`io_mo_integrals_n_e` * :c:data:`io_mo_integrals_pseudo` * :c:data:`io_mo_one_e_integrals` * :c:data:`io_mo_two_e_integrals` * :c:data:`io_mo_two_e_integrals_erf` + * :c:data:`io_nuclear_repulsion` + * :c:data:`io_two_body_rdm_aa` + * :c:data:`io_two_body_rdm_ab` + * :c:data:`io_two_body_rdm_bb` + * :c:data:`io_two_body_rdm_spin_trace` + * :c:data:`is_periodic` * :c:data:`level_shift` + * :c:data:`level_shift_casscf` + * :c:data:`lin_dep_cutoff` * :c:data:`max_dim_diis` * :c:data:`mo_class` * :c:data:`mo_coef` + * :c:data:`mo_coef_aux` + * :c:data:`mo_coef_imag` * :c:data:`mo_guess_type` + * :c:data:`mo_integrals_cache_shift` * :c:data:`mo_integrals_threshold` * :c:data:`mo_label` * :c:data:`mo_num` * :c:data:`mo_occ` + * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`mu_dft_type` * :c:data:`mu_erf` - * :c:data:`n_cas_bitmask` + * :c:data:`n_act_orb` + * :c:data:`n_big_act_orb` * :c:data:`n_core_orb` + * :c:data:`n_del_orb` * :c:data:`n_det` * :c:data:`n_det_generators` - * :c:data:`n_det_iterations` * :c:data:`n_det_max` * :c:data:`n_det_max_full` + * :c:data:`n_det_max_opt` * :c:data:`n_det_print_wf` * :c:data:`n_det_selectors` - * :c:data:`n_generators_bitmask` - * :c:data:`n_generators_bitmask_restart` + * :c:data:`n_inact_orb` * :c:data:`n_int` * :c:data:`n_it_scf_max` - * :c:data:`n_iter` + * :c:data:`n_pts_charge` * :c:data:`n_states` * :c:data:`n_states_diag` - * :c:data:`no_ivvv_integrals` - * :c:data:`no_vvv_integrals` - * :c:data:`no_vvvv_integrals` + * :c:data:`n_virt_orb` + * :c:data:`nb_it_max_lambda` + * :c:data:`nb_it_max_pre_search` + * :c:data:`no_core_density` + * :c:data:`no_oa_or_av_opt` + * :c:data:`normalize_dm` * :c:data:`nthreads_davidson` * :c:data:`nthreads_pt2` * :c:data:`nucl_charge` @@ -144,7 +191,22 @@ Providers * :c:data:`nucl_label` * :c:data:`nucl_num` * :c:data:`nuclear_repulsion` + * :c:data:`nucleus_shell_num` * :c:data:`only_expected_s2` + * :c:data:`optimization_max_nb_iter` + * :c:data:`optimization_method` + * :c:data:`ormas_max_e` + * :c:data:`ormas_min_e` + * :c:data:`ormas_mstart` + * :c:data:`ormas_n_space` + * :c:data:`point_charges` + * :c:data:`prim_coef` + * :c:data:`prim_expo` + * :c:data:`prim_normalization_factor` + * :c:data:`prim_num` + * :c:data:`primitives_normalized` + * :c:data:`print_all_transitions` + * :c:data:`pruning` * :c:data:`pseudo_dz_k` * :c:data:`pseudo_dz_kl` * :c:data:`pseudo_grid_rmax` @@ -166,25 +228,59 @@ Providers * :c:data:`psi_det_size` * :c:data:`pt2_e0_denominator` * :c:data:`pt2_f` - * :c:data:`pt2_iterations` * :c:data:`pt2_max` + * :c:data:`pt2_min_casscf` + * :c:data:`pt2_min_parallel_tasks` * :c:data:`pt2_n_teeth` * :c:data:`pt2_relative_error` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` * :c:data:`qp_max_mem` * :c:data:`read_wf` + * :c:data:`restore_symm` * :c:data:`s2_eig` + * :c:data:`save_threshold` + * :c:data:`save_wf_after_selection` * :c:data:`scf_algorithm` * :c:data:`selection_factor` + * :c:data:`seniority_max` + * :c:data:`shell_ang_mom` + * :c:data:`shell_index` + * :c:data:`shell_normalization_factor` + * :c:data:`shell_num` + * :c:data:`shell_prim_num` + * :c:data:`small_active_space` * :c:data:`state_following` + * :c:data:`state_following_casscf` * :c:data:`target_energy` + * :c:data:`thresh_casscf` + * :c:data:`thresh_cc` + * :c:data:`thresh_delta` + * :c:data:`thresh_eig` + * :c:data:`thresh_model` + * :c:data:`thresh_model_2` + * :c:data:`thresh_opt_max_elem_grad` + * :c:data:`thresh_rho` + * :c:data:`thresh_rho_2` * :c:data:`thresh_scf` * :c:data:`thresh_sym` + * :c:data:`thresh_wtg` + * :c:data:`thresh_wtg2` * :c:data:`threshold_davidson` + * :c:data:`threshold_davidson_from_pt2` * :c:data:`threshold_diis` * :c:data:`threshold_generators` + * :c:data:`threshold_nonsym_davidson` + * :c:data:`twice_hierarchy_max` + * :c:data:`typ` + * :c:data:`use_cgtos` + * :c:data:`use_only_lr` * :c:data:`variance_max` + * :c:data:`version_avoid_saddle` + * :c:data:`version_lambda_search` * :c:data:`weight_one_e_dm` * :c:data:`weight_selection` + * :c:data:`without_diagonal` .. c:var:: mpi_rank diff --git a/docs/source/modules/nuclei.rst b/docs/source/modules/nuclei.rst index 24a7a6e6..8c70d73a 100644 --- a/docs/source/modules/nuclei.rst +++ b/docs/source/modules/nuclei.rst @@ -49,6 +49,34 @@ EZFIO parameters Nuclear repulsion (Computed automaticaly or Read in the |EZFIO|) +.. option:: is_periodic + + If true, the calculation uses periodic boundary conditions + + Default: false + +.. option:: n_pts_charge + + Number of point charges to be added to the potential + + Default: 0 + +.. option:: pts_charge_z + + Charge associated to each point charge + + +.. option:: pts_charge_coord + + Coordinate of each point charge. + + +.. option:: point_charges + + If |true|, point charges (see nuclei/write_pt_charges.py) are added to the one-electron potential + + Default: False + Providers --------- @@ -216,6 +244,39 @@ Providers +.. c:var:: n_pts_charge + + + File : :file:`nuclei/point_charges.irp.f` + + .. code:: fortran + + integer :: n_pts_charge + + + Number of point charges to be added to the potential + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + * :c:data:`output_wall_time_0` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_pt_chrg` + * :c:data:`pt_chrg_interaction` + * :c:data:`pt_chrg_nuclei_interaction` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` + + .. c:var:: nucl_coord @@ -245,23 +306,37 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_deriv2_cgtos_x` * :c:data:`ao_deriv2_x` * :c:data:`ao_deriv_1_x` * :c:data:`ao_dipole_x` * :c:data:`ao_integrals_n_e` + * :c:data:`ao_integrals_n_e_cgtos` * :c:data:`ao_integrals_n_e_per_atom` + * :c:data:`ao_integrals_pt_chrg` * :c:data:`ao_overlap` * :c:data:`ao_overlap_abs` + * :c:data:`ao_overlap_cgtos` * :c:data:`ao_pseudo_integrals_local` * :c:data:`ao_pseudo_integrals_non_local` * :c:data:`ao_spread_x` + * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_erf_schwartz` * :c:data:`ao_two_e_integral_schwartz` + * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` * :c:data:`center_of_mass` + * :c:data:`cholesky_ao_num` * :c:data:`inertia_tensor` + * :c:data:`multi_s_deriv_1` + * :c:data:`multi_s_dipole_moment` * :c:data:`nucl_coord_transp` * :c:data:`nucl_dist_2` * :c:data:`nuclear_repulsion` + * :c:data:`pt_chrg_nuclei_interaction` + * :c:data:`z_dipole_moment` .. c:var:: nucl_coord_transp @@ -501,6 +576,8 @@ Providers * :c:data:`nucl_coord` * :c:data:`nucl_num` * :c:data:`output_wall_time_0` + * :c:data:`point_charges` + * :c:data:`pt_chrg_nuclei_interaction` Needed by: @@ -508,8 +585,139 @@ Providers :columns: 3 * :c:data:`ci_energy` + * :c:data:`ci_energy_no_diag` * :c:data:`core_energy` + * :c:data:`core_energy_erf` + * :c:data:`etwo` + * :c:data:`hf_energy` * :c:data:`psi_energy_with_nucl_rep` + * :c:data:`pt2_e0_denominator` + * :c:data:`scf_energy` + + +.. c:var:: pt_chrg_interaction + + + File : :file:`nuclei/point_charges.irp.f` + + .. code:: fortran + + double precision :: pt_chrg_interaction + + + Interaction between the point charges + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pts_charge` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`pt_chrg_nuclei_interaction` + + +.. c:var:: pt_chrg_nuclei_interaction + + + File : :file:`nuclei/point_charges.irp.f` + + .. code:: fortran + + double precision :: pt_chrg_nuclei_interaction + + + repulsion between the point charges and the nuclei + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`n_pts_charge` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_num` + * :c:data:`point_charges` + * :c:data:`pt_chrg_interaction` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`nuclear_repulsion` + + +.. c:var:: pts_charge_coord + + + File : :file:`nuclei/point_charges.irp.f` + + .. code:: fortran + + double precision, allocatable :: pts_charge_coord (n_pts_charge,3) + + + Coordinates of each point charge. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + * :c:data:`n_pts_charge` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_pt_chrg` + * :c:data:`pt_chrg_interaction` + * :c:data:`pt_chrg_nuclei_interaction` + + +.. c:var:: pts_charge_z + + + File : :file:`nuclei/point_charges.irp.f` + + .. code:: fortran + + double precision, allocatable :: pts_charge_z (n_pts_charge) + + + Charge associated to each point charge. + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ezfio_filename` + * :c:data:`mpi_master` + * :c:data:`n_pts_charge` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_integrals_pt_chrg` + * :c:data:`pt_chrg_interaction` + * :c:data:`pt_chrg_nuclei_interaction` .. c:var:: slater_bragg_radii diff --git a/docs/source/modules/perturbation.rst b/docs/source/modules/perturbation.rst index b1124aac..6f1b02ad 100644 --- a/docs/source/modules/perturbation.rst +++ b/docs/source/modules/perturbation.rst @@ -92,6 +92,12 @@ EZFIO parameters Default: 0.0 +.. option:: pt2_min_parallel_tasks + + Minimum number of tasks in PT2 calculation + + Default: 1 + .. option:: pt2_relative_error Stop stochastic |PT2| when the relative error is smaller than `pT2_relative_error` @@ -106,7 +112,7 @@ EZFIO parameters .. option:: h0_type - Type of denominator in PT2. [EN | SOP | HF] + Type of denominator in PT2. [EN | CFG | HF] Default: EN @@ -218,8 +224,6 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` * :c:data:`n_int` @@ -257,7 +261,6 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -293,7 +296,6 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -329,7 +331,6 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -365,7 +366,6 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -401,7 +401,6 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -437,7 +436,6 @@ Subroutines / functions * :c:data:`n_det` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -472,7 +470,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -509,7 +506,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -546,7 +542,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -583,7 +578,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -620,7 +614,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -657,7 +650,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_generators` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_det_generators` * :c:data:`psi_selectors` @@ -737,7 +729,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_selectors` * :c:data:`psi_selectors_size` * :c:data:`selection_criterion` @@ -783,7 +774,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_selectors` * :c:data:`psi_selectors_size` @@ -829,7 +819,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_energy` * :c:data:`psi_selectors` * :c:data:`psi_selectors_size` @@ -876,7 +865,6 @@ Subroutines / functions * :c:data:`fock_matrix_mo` * :c:data:`mo_num` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_selectors` * :c:data:`psi_selectors_size` * :c:data:`ref_bitmask` @@ -922,7 +910,6 @@ Subroutines / functions * :c:data:`mo_num` * :c:data:`n_det_selectors` - * :c:data:`n_int` * :c:data:`psi_selectors` * :c:data:`psi_selectors_size` * :c:data:`selection_criterion` diff --git a/docs/source/modules/pseudo.rst b/docs/source/modules/pseudo.rst index 8a48aa9f..324efcd5 100644 --- a/docs/source/modules/pseudo.rst +++ b/docs/source/modules/pseudo.rst @@ -27,7 +27,7 @@ EZFIO parameters .. option:: pseudo_n_k - Number of gaussians in the local component + Powers of r - 2 in the local component .. option:: pseudo_v_k @@ -52,7 +52,7 @@ EZFIO parameters .. option:: pseudo_n_kl - Number of functions in the non-local component + Powers of r - 2 in the non-local component .. option:: pseudo_v_kl diff --git a/docs/source/modules/scf_utils.rst b/docs/source/modules/scf_utils.rst index e822b9e6..429db9b9 100644 --- a/docs/source/modules/scf_utils.rst +++ b/docs/source/modules/scf_utils.rst @@ -97,16 +97,58 @@ EZFIO parameters Calculated HF energy +.. option:: do_mom + + If true, this will run a MOM calculation. The overlap will be computed at each step with respect to the initial MOs. After an initial Hartree-Fock calculation, the guess can be created by swapping molecular orbitals through the qp run swap_mos command. + + Default: False + .. option:: frozen_orb_scf If true, leave untouched all the orbitals defined as core and optimize all the orbitals defined as active with qp_set_mo_class Default: False +.. option:: no_oa_or_av_opt + + If true, you set to zero all Fock elements between the orbital set to active and all the other orbitals + + Default: False + Providers --------- +.. c:var:: all_shells_closed + + + File : :file:`scf_utils/scf_density_matrix_ao.irp.f` + + .. code:: fortran + + logical :: all_shells_closed + + + + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`fock_matrix_ao` + * :c:data:`fock_matrix_mo` + * :c:data:`scf_density_matrix_ao` + + .. c:var:: eigenvalues_fock_matrix_ao @@ -180,10 +222,15 @@ Providers * :c:data:`level_shift` * :c:data:`list_act` * :c:data:`list_core` + * :c:data:`list_inact` + * :c:data:`list_virt` * :c:data:`mo_coef` * :c:data:`mo_num` * :c:data:`n_act_orb` * :c:data:`n_core_orb` + * :c:data:`n_inact_orb` + * :c:data:`n_virt_orb` + * :c:data:`no_oa_or_av_opt` @@ -224,7 +271,6 @@ Providers :columns: 3 * :c:func:`dgecon` - * :c:func:`dgemm` * :c:func:`dgesv` * :c:func:`dgetrf` @@ -246,9 +292,8 @@ Providers .. hlist:: :columns: 3 + * :c:data:`all_shells_closed` * :c:data:`ao_num` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`fock_matrix_ao_alpha` * :c:data:`fock_matrix_mo` * :c:data:`frozen_orb_scf` @@ -279,16 +324,27 @@ Providers Fock matrix on the MO basis. For open shells, the ROHF Fock Matrix is :: - | F-K | F + K/2 | F | - |---------------------------------| - | F + K/2 | F | F - K/2 | - |---------------------------------| - | F | F - K/2 | F + K | + | Rcc | F^b | Fcv | + |-----------------------| + | F^b | Roo | F^a | + |-----------------------| + | Fcv | F^a | Rvv | + + C: Core, O: Open, V: Virtual + Rcc = Acc Fcc^a + Bcc Fcc^b + Roo = Aoo Foo^a + Boo Foo^b + Rvv = Avv Fvv^a + Bvv Fvv^b + Fcv = (F^a + F^b)/2 - F = 1/2 (Fa + Fb) + F^a: Fock matrix alpha (MO), F^b: Fock matrix beta (MO) + A,B: Coupling parameters - K = Fb - Fa + J. Chem. Phys. 133, 141102 (2010), https://doi.org/10.1063/1.3503173 + Coupling parameters from J. Chem. Phys. 125, 204110 (2006); https://doi.org/10.1063/1.2393223. + cc oo vv + A -0.5 0.5 1.5 + B 1.5 0.5 -0.5 Needs: @@ -296,6 +352,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`all_shells_closed` * :c:data:`elec_alpha_num` * :c:data:`elec_beta_num` * :c:data:`fock_matrix_mo_alpha` @@ -303,9 +360,14 @@ Providers * :c:data:`frozen_orb_scf` * :c:data:`list_act` * :c:data:`list_core` + * :c:data:`list_inact` + * :c:data:`list_virt` * :c:data:`mo_num` * :c:data:`n_act_orb` * :c:data:`n_core_orb` + * :c:data:`n_inact_orb` + * :c:data:`n_virt_orb` + * :c:data:`no_oa_or_av_opt` Needed by: @@ -330,16 +392,27 @@ Providers Fock matrix on the MO basis. For open shells, the ROHF Fock Matrix is :: - | F-K | F + K/2 | F | - |---------------------------------| - | F + K/2 | F | F - K/2 | - |---------------------------------| - | F | F - K/2 | F + K | + | Rcc | F^b | Fcv | + |-----------------------| + | F^b | Roo | F^a | + |-----------------------| + | Fcv | F^a | Rvv | + + C: Core, O: Open, V: Virtual + Rcc = Acc Fcc^a + Bcc Fcc^b + Roo = Aoo Foo^a + Boo Foo^b + Rvv = Avv Fvv^a + Bvv Fvv^b + Fcv = (F^a + F^b)/2 - F = 1/2 (Fa + Fb) + F^a: Fock matrix alpha (MO), F^b: Fock matrix beta (MO) + A,B: Coupling parameters - K = Fb - Fa + J. Chem. Phys. 133, 141102 (2010), https://doi.org/10.1063/1.3503173 + Coupling parameters from J. Chem. Phys. 125, 204110 (2006); https://doi.org/10.1063/1.2393223. + cc oo vv + A -0.5 0.5 1.5 + B 1.5 0.5 -0.5 Needs: @@ -347,6 +420,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`all_shells_closed` * :c:data:`elec_alpha_num` * :c:data:`elec_beta_num` * :c:data:`fock_matrix_mo_alpha` @@ -354,9 +428,14 @@ Providers * :c:data:`frozen_orb_scf` * :c:data:`list_act` * :c:data:`list_core` + * :c:data:`list_inact` + * :c:data:`list_virt` * :c:data:`mo_num` * :c:data:`n_act_orb` * :c:data:`n_core_orb` + * :c:data:`n_inact_orb` + * :c:data:`n_virt_orb` + * :c:data:`no_oa_or_av_opt` Needed by: @@ -498,9 +577,8 @@ Providers .. hlist:: :columns: 3 + * :c:data:`all_shells_closed` * :c:data:`ao_num` - * :c:data:`elec_alpha_num` - * :c:data:`elec_beta_num` * :c:data:`scf_density_matrix_ao_alpha` * :c:data:`scf_density_matrix_ao_beta` @@ -509,6 +587,7 @@ Providers .. hlist:: :columns: 3 + * :c:data:`ao_two_e_integral_alpha_chol` * :c:data:`fps_spf_matrix_ao` @@ -539,7 +618,10 @@ Providers :columns: 3 * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_alpha_chol` * :c:data:`hf_energy` + * :c:data:`hf_kinetic_energy` + * :c:data:`mcscf_fock_alpha_ao` * :c:data:`scf_density_matrix_ao` * :c:data:`scf_energy` @@ -571,7 +653,10 @@ Providers :columns: 3 * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_alpha_chol` * :c:data:`hf_energy` + * :c:data:`hf_kinetic_energy` + * :c:data:`mcscf_fock_alpha_ao` * :c:data:`scf_density_matrix_ao` * :c:data:`scf_energy` @@ -734,6 +819,47 @@ Subroutines / functions * :c:data:`mo_coef` +.. c:function:: reorder_mo_max_overlap: + + + File : :file:`scf_utils/reorder_mo_max_overlap.irp.f` + + .. code:: fortran + + subroutine reorder_mo_max_overlap + + + routines that compute the projection of each MO of the current `mo_coef` on the space spanned by the occupied orbitals of `mo_coef_begin_iteration` + + Needs: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_num` + * :c:data:`ao_overlap` + * :c:data:`elec_alpha_num` + * :c:data:`elec_beta_num` + * :c:data:`mo_coef` + * :c:data:`mo_coef_begin_iteration` + * :c:data:`mo_num` + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`roothaan_hall_scf` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`dsort` + + .. c:function:: roothaan_hall_scf: @@ -753,6 +879,7 @@ Subroutines / functions * :c:data:`ao_md5` * :c:data:`ao_num` + * :c:data:`do_mom` * :c:data:`eigenvectors_fock_matrix_mo` * :c:data:`fock_matrix_ao` * :c:data:`fock_matrix_ao_alpha` @@ -761,6 +888,8 @@ Subroutines / functions * :c:data:`fps_spf_matrix_ao` * :c:data:`fps_spf_matrix_mo` * :c:data:`frozen_orb_scf` + * :c:data:`json_int_fmt` + * :c:data:`json_unit` * :c:data:`level_shift` * :c:data:`max_dim_diis` * :c:data:`mo_coef` @@ -773,18 +902,31 @@ Subroutines / functions * :c:data:`thresh_scf` * :c:data:`threshold_diis_nonzero` + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`run` + Calls: .. hlist:: :columns: 3 + * :c:func:`dgemm` * :c:func:`extrapolate_fock_matrix` * :c:func:`initialize_mo_coef_begin_iteration` + * :c:func:`lock_io` * :c:func:`mo_as_eigvectors_of_mo_matrix` - * :c:func:`nullify_small_elements` * :c:func:`orthonormalize_mos` + * :c:func:`pivoted_cholesky` * :c:func:`reorder_core_orb` + * :c:func:`reorder_mo_max_overlap` + * :c:func:`restore_symmetry` * :c:func:`save_mos` + * :c:func:`sleep` + * :c:func:`unlock_io` * :c:func:`write_double` * :c:func:`write_time` diff --git a/docs/source/modules/selectors_utils.rst b/docs/source/modules/selectors_utils.rst index 9c4b3bd4..24898475 100644 --- a/docs/source/modules/selectors_utils.rst +++ b/docs/source/modules/selectors_utils.rst @@ -579,9 +579,9 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`mpi_master` * :c:data:`n_det_generators` * :c:data:`zmq_state` - * :c:data:`mpi_master` .. c:function:: zmq_get_n_det_selectors: @@ -601,9 +601,9 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`mpi_master` * :c:data:`n_det_selectors` * :c:data:`zmq_state` - * :c:data:`mpi_master` .. c:function:: zmq_put_n_det_generators: diff --git a/docs/source/modules/tools.rst b/docs/source/modules/tools.rst index 31769efe..ec893ec5 100644 --- a/docs/source/modules/tools.rst +++ b/docs/source/modules/tools.rst @@ -15,160 +15,158 @@ Useful tools are grouped in this module. Programs -------- + * :ref:`attachement_orb` + * :ref:`cas_complete` * :ref:`diagonalize_h` * :ref:`fcidump` + * :ref:`fcidump_pyscf` * :ref:`four_idx_transform` + * :ref:`guess_hcore` + * :ref:`guess_huckel` * :ref:`molden` * :ref:`print_ci_vectors` - * :ref:`print_e_conv` + * :ref:`print_detweights` + * :ref:`print_dipole` + * :ref:`print_energy` + * :ref:`print_hamiltonian` + * :ref:`print_sorted_wf_coef` + * :ref:`print_var_energy` * :ref:`print_wf` * :ref:`rotate_mos` * :ref:`save_natorb` + * :ref:`save_natorb_no_ov_rot` + * :ref:`save_natorb_no_ref` * :ref:`save_one_e_dm` * :ref:`save_ortho_mos` * :ref:`sort_by_fock_energies` + * :ref:`sort_wf` * :ref:`swap_mos` + * :ref:`truncate_wf` * :ref:`write_integrals_erf` Subroutines / functions ----------------------- -.. c:function:: print_energy: +.. c:function:: molden_attachment: - File : :file:`print_energy.irp.f` + File : :file:`attachement_orb.irp.f` .. code:: fortran - subroutine print_energy + subroutine molden_attachment - Prints the energy of the wave function stored in the |EZFIO| directory. + Produces a Molden file Needs: .. hlist:: :columns: 3 - * :c:data:`n_states` - * :c:data:`read_wf` + * :c:data:`ao_coef` + * :c:data:`ao_expo` + * :c:data:`ao_l` + * :c:data:`ao_num` + * :c:data:`ao_power` + * :c:data:`ao_prim_num` + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` + * :c:data:`element_name` + * :c:data:`ezfio_filename` + * :c:data:`n_attachment` + * :c:data:`nucl_charge` + * :c:data:`nucl_coord` + * :c:data:`nucl_list_shell_aos` + * :c:data:`nucl_num` - Calls: + Called by: .. hlist:: :columns: 3 - * :c:func:`run` + * :c:func:`attachement_orb` - Touches: + Calls: .. hlist:: :columns: 3 - * :c:data:`read_wf` + * :c:func:`isort` -.. c:function:: print_hamiltonian: +.. c:function:: print_exc: - File : :file:`print_hamiltonian.irp.f` + File : :file:`print_detweights.irp.f` .. code:: fortran - subroutine print_hamiltonian + subroutine print_exc() - Prints the Hamiltonian matrix defined in the space of determinants - present in the |EZFIO| directory. Needs: .. hlist:: :columns: 3 - * :c:data:`read_wf` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`run` - - Touches: - - .. hlist:: - :columns: 3 - - * :c:data:`read_wf` - - -.. c:function:: routine: - - - File : :file:`write_integrals_erf.irp.f` - - .. code:: fortran - - subroutine routine - - + * :c:data:`n_det` + * :c:data:`n_int` + * :c:data:`psi_det` Called by: .. hlist:: :columns: 3 - * :c:func:`diagonalize_h` - * :c:func:`print_ci_vectors` - * :c:func:`print_wf` - * :c:func:`write_integrals_erf` + * :c:func:`print_detweights` Calls: .. hlist:: :columns: 3 - * :c:func:`save_erf_two_e_integrals_ao` - * :c:func:`save_erf_two_e_integrals_mo` + * :c:func:`get_excitation_degree` -.. c:function:: routine_e_conv: +.. c:function:: routine_s2: - File : :file:`print_e_conv.irp.f` + File : :file:`truncate_wf.irp.f` .. code:: fortran - subroutine routine_e_conv + subroutine routine_s2 - routine called by :c:func:`print_e_conv` Needs: .. hlist:: :columns: 3 - * :c:data:`ezfio_filename` + * :c:data:`det_to_configuration` + * :c:data:`n_det` + * :c:data:`n_int` * :c:data:`n_states` + * :c:data:`psi_coef` + * :c:data:`psi_det` + * :c:data:`weight_configuration` Called by: .. hlist:: :columns: 3 - * :c:func:`print_e_conv` + * :c:func:`truncate_wf` Calls: .. hlist:: :columns: 3 - * :c:func:`ezfio_get_iterations_energy_iterations` - * :c:func:`ezfio_get_iterations_n_det_iterations` - * :c:func:`ezfio_get_iterations_n_iter` - * :c:func:`ezfio_get_iterations_pt2_iterations` + * :c:func:`save_wavefunction_general` .. c:function:: routine_save_one_e_dm: @@ -208,41 +206,3 @@ Subroutines / functions * :c:func:`ezfio_set_aux_quantities_data_one_e_dm_beta_ao` * :c:func:`ezfio_set_aux_quantities_data_one_e_dm_beta_mo` - -.. c:function:: run: - - - File : :file:`print_hamiltonian.irp.f` - - .. code:: fortran - - subroutine run - - - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`n_det` - * :c:data:`n_int` - * :c:data:`psi_det` - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`print_energy` - * :c:func:`print_hamiltonian` - * :c:func:`pt2` - * :c:func:`scf` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`i_h_j` - diff --git a/docs/source/modules/utils.rst b/docs/source/modules/utils.rst index d7d078ca..c36f0189 100644 --- a/docs/source/modules/utils.rst +++ b/docs/source/modules/utils.rst @@ -13,9 +13,38 @@ Contains general purpose utilities (sorting, maps, etc). +EZFIO parameters +---------------- + +.. option:: restore_symm + + If true, try to find symmetry in the MO coefficient matrices + + Default: False + + Providers --------- +.. c:var:: au_to_d + + + File : :file:`utils/units.irp.f` + + .. code:: fortran + + double precision :: ha_to_ev + double precision :: au_to_d + double precision :: planck_cte + double precision :: light_speed + double precision :: ha_to_j + double precision :: ha_to_nm + + + Some conversion between different units + + + .. c:var:: binom @@ -35,6 +64,9 @@ Providers :columns: 3 * :c:data:`binom_int` + * :c:data:`dettocsftransformationmatrix` + * :c:data:`nsomomax` + * :c:data:`psi_csf_coef` .. c:var:: binom_int @@ -57,6 +89,14 @@ Providers * :c:data:`binom` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`dominant_dets_of_cfgs` + * :c:data:`n_dominant_dets_of_cfgs` + * :c:data:`psi_configuration_to_psi_det` .. c:var:: binom_int_transp @@ -79,6 +119,14 @@ Providers * :c:data:`binom` + Needed by: + + .. hlist:: + :columns: 3 + + * :c:data:`dominant_dets_of_cfgs` + * :c:data:`n_dominant_dets_of_cfgs` + * :c:data:`psi_configuration_to_psi_det` .. c:var:: binom_transp @@ -100,6 +148,9 @@ Providers :columns: 3 * :c:data:`binom_int` + * :c:data:`dettocsftransformationmatrix` + * :c:data:`nsomomax` + * :c:data:`psi_csf_coef` .. c:var:: degree_max_integration_lebedev @@ -145,6 +196,11 @@ Providers * :c:func:`h_s2_u_0_nstates_openmp` * :c:func:`h_s2_u_0_nstates_zmq` * :c:func:`h_s2_u_0_two_e_nstates_openmp` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_zmq` + * :c:func:`orb_range_2_rdm_openmp` + * :c:func:`orb_range_2_rdm_state_av_openmp` + * :c:func:`orb_range_2_trans_rdm_openmp` Calls: @@ -168,186 +224,178 @@ Providers -.. c:function:: i2radix_sort: +.. c:function:: give_explicit_cpoly_and_cgaussian: - File : :file:`utils/sort.irp.f_template_644` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - recursive subroutine i2radix_sort(x,iorder,isize,iradix) + subroutine give_explicit_cpoly_and_cgaussian(P_new, P_center, p, fact_k, iorder, & + alpha, beta, a, b, Ae_center, Be_center, Ap_center, Bp_center, dim) - Sort integer array x(isize) using the radix sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - iradix should be -1 in input. + + Transforms the product of + + (x - x_Ap)^a(1) (x - x_Bp)^b(1) exp(-alpha (x - x_Ae)^2) exp(-beta (x - x_Be)^2) x + (y - y_Ap)^a(2) (y - y_Bp)^b(2) exp(-alpha (y - y_Ae)^2) exp(-beta (y - y_Be)^2) x + (z - z_Ap)^a(3) (z - z_Bp)^b(3) exp(-alpha (z - z_Ae)^2) exp(-beta (z - z_Be)^2) + + into + fact_k * [sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x] exp (-p (x-P_center(1))^2) + * [sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y] exp (-p (y-P_center(2))^2) + * [sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z] exp (-p (z-P_center(3))^2) + + WARNING ::: IF fact_k is too smal then: + returns a "s" function centered in zero + with an inifinite exponent and a zero polynom coef + Called by: .. hlist:: :columns: 3 - * :c:func:`get_mo_two_e_integrals_erf_i1j1` - * :c:func:`get_mo_two_e_integrals_erf_ij` - * :c:func:`get_mo_two_e_integrals_i1j1` - * :c:func:`get_mo_two_e_integrals_ij` - * :c:func:`i2radix_sort` + * :c:func:`ao_2e_cgtos_schwartz_accel` + * :c:func:`ao_two_e_integral_cgtos` + * :c:func:`overlap_cgaussian_xyz` Calls: .. hlist:: :columns: 3 - * :c:func:`i2radix_sort` - * :c:func:`insertion_i2sort` + * :c:func:`cgaussian_product` + * :c:func:`multiply_cpoly` + * :c:func:`recentered_cpoly2` -.. c:function:: i8radix_sort: +.. c:function:: give_explicit_cpoly_and_cgaussian_x: - File : :file:`utils/sort.irp.f_template_644` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - recursive subroutine i8radix_sort(x,iorder,isize,iradix) + subroutine give_explicit_cpoly_and_cgaussian_x(P_new, P_center, p, fact_k, iorder, & + alpha, beta, a, b, Ae_center, Be_center, Ap_center, Bp_center, dim) - Sort integer array x(isize) using the radix sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - iradix should be -1 in input. + + Transform the product of + + (x - x_Ap)^a (x - x_Bp)^b exp(-alpha (r - Ae)^2) exp(-beta (r - Be)^2) + + into + + fact_k \sum_{i=0}^{iorder} (x - x_P)^i exp(-p (r - P)^2) + Called by: .. hlist:: :columns: 3 - * :c:func:`get_mo_two_e_integrals_erf_i1j1` - * :c:func:`get_mo_two_e_integrals_erf_ij` - * :c:func:`get_mo_two_e_integrals_i1j1` - * :c:func:`get_mo_two_e_integrals_ij` - * :c:func:`i8radix_sort` - * :c:data:`psi_bilinear_matrix_transp_values` + * :c:func:`overlap_cgaussian_x` Calls: .. hlist:: :columns: 3 - * :c:func:`i8radix_sort` - * :c:func:`insertion_i8sort` + * :c:func:`multiply_cpoly` + * :c:func:`recentered_cpoly2` -.. c:function:: i8radix_sort_big: +.. c:var:: ha_to_ev - File : :file:`utils/sort.irp.f_template_644` + File : :file:`utils/units.irp.f` .. code:: fortran - recursive subroutine i8radix_sort_big(x,iorder,isize,iradix) - - - Sort integer array x(isize) using the radix sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - iradix should be -1 in input. - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`i8radix_sort_big` + double precision :: ha_to_ev + double precision :: au_to_d + double precision :: planck_cte + double precision :: light_speed + double precision :: ha_to_j + double precision :: ha_to_nm - Calls: - .. hlist:: - :columns: 3 + Some conversion between different units - * :c:func:`i8radix_sort_big` - * :c:func:`insertion_i8sort_big` -.. c:var:: inv_int +.. c:var:: ha_to_j - File : :file:`utils/util.irp.f` + File : :file:`utils/units.irp.f` .. code:: fortran - double precision, allocatable :: inv_int (128) + double precision :: ha_to_ev + double precision :: au_to_d + double precision :: planck_cte + double precision :: light_speed + double precision :: ha_to_j + double precision :: ha_to_nm - 1/i + Some conversion between different units -.. c:function:: iradix_sort: +.. c:var:: ha_to_nm - File : :file:`utils/sort.irp.f_template_644` + File : :file:`utils/units.irp.f` .. code:: fortran - recursive subroutine iradix_sort(x,iorder,isize,iradix) - + double precision :: ha_to_ev + double precision :: au_to_d + double precision :: planck_cte + double precision :: light_speed + double precision :: ha_to_j + double precision :: ha_to_nm - Sort integer array x(isize) using the radix sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - iradix should be -1 in input. - Called by: - - .. hlist:: - :columns: 3 + Some conversion between different units - * :c:func:`get_mo_two_e_integrals_erf_i1j1` - * :c:func:`get_mo_two_e_integrals_erf_ij` - * :c:func:`get_mo_two_e_integrals_i1j1` - * :c:func:`get_mo_two_e_integrals_ij` - * :c:func:`iradix_sort` - Calls: + +.. c:var:: inv_int - .. hlist:: - :columns: 3 - * :c:func:`insertion_isort` - * :c:func:`iradix_sort` + File : :file:`utils/util.irp.f` - -.. c:function:: iradix_sort_big: + .. code:: fortran + double precision, allocatable :: inv_int (128) - File : :file:`utils/sort.irp.f_template_644` - .. code:: fortran + 1/i - recursive subroutine iradix_sort_big(x,iorder,isize,iradix) + +.. c:var:: light_speed - Sort integer array x(isize) using the radix sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - iradix should be -1 in input. - Called by: + File : :file:`utils/units.irp.f` - .. hlist:: - :columns: 3 + .. code:: fortran - * :c:func:`iradix_sort_big` + double precision :: ha_to_ev + double precision :: au_to_d + double precision :: planck_cte + double precision :: light_speed + double precision :: ha_to_j + double precision :: ha_to_nm - Calls: - .. hlist:: - :columns: 3 + Some conversion between different units - * :c:func:`insertion_isort_big` - * :c:func:`iradix_sort_big` .. c:var:: n_points_integration_angular_lebedev @@ -396,27 +444,31 @@ Providers * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`cholesky_ao_num` * :c:data:`h_apply_buffer_allocated` * :c:data:`n_det` * :c:data:`nthreads_davidson` * :c:data:`nthreads_pt2` -.. c:function:: overlap_gaussian_xyz: +.. c:function:: overlap_cgaussian_xyz: - File : :file:`utils/one_e_integration.irp.f` + File : :file:`utils/cgtos_one_e.irp.f` .. code:: fortran - subroutine overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,& - power_B,overlap_x,overlap_y,overlap_z,overlap,dim) + subroutine overlap_cgaussian_xyz(Ae_center, Be_center, alpha, beta, power_A, power_B, & + Ap_center, Bp_center, overlap_x, overlap_y, overlap_z, overlap, dim) - .. math:: - S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ - S = S_x S_y S_z + S_x = \int (x - Ap_x)^{a_x} exp(-\alpha (x - Ae_x)^2) + (x - Bp_x)^{b_x} exp(-\beta (x - Be_x)^2) dx + + S = S_x S_y S_z + + for complex arguments Called by: @@ -424,21 +476,16 @@ Providers .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalization_libint_factor` - * :c:data:`ao_coef_normalized` - * :c:data:`ao_deriv2_x` - * :c:data:`ao_deriv_1_x` - * :c:data:`ao_dipole_x` - * :c:data:`ao_overlap` - * :c:data:`ao_spread_x` + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_overlap_cgtos` Calls: .. hlist:: :columns: 3 - * :c:func:`gaussian_product_x` - * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`give_explicit_cpoly_and_cgaussian` .. c:var:: phi_angular_integration_lebedev @@ -467,167 +514,72 @@ Providers -.. c:var:: qp_max_mem - - - File : :file:`utils/memory.irp.f` - - .. code:: fortran - - integer :: qp_max_mem - - - Maximum memory in Gb - - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`mpi_master` - - Needed by: - - .. hlist:: - :columns: 3 - - * :c:data:`pt2_j` - * :c:data:`pt2_w` - - -.. c:function:: rec__quicksort: - - - File : :file:`utils/sort.irp.f_template_261` - - .. code:: fortran - - recursive subroutine rec__quicksort(x, iorder, isize, first, last, level) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`quick_sort` - * :c:func:`rec__quicksort` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`rec__quicksort` - - -.. c:function:: rec_d_quicksort: - - - File : :file:`utils/sort.irp.f_template_261` - - .. code:: fortran - - recursive subroutine rec_d_quicksort(x, iorder, isize, first, last, level) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`quick_dsort` - * :c:func:`rec_d_quicksort` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`rec_d_quicksort` - - -.. c:function:: rec_i2_quicksort: +.. c:var:: planck_cte - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/units.irp.f` .. code:: fortran - recursive subroutine rec_i2_quicksort(x, iorder, isize, first, last, level) - - - - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`quick_i2sort` - * :c:func:`rec_i2_quicksort` + double precision :: ha_to_ev + double precision :: au_to_d + double precision :: planck_cte + double precision :: light_speed + double precision :: ha_to_j + double precision :: ha_to_nm - Calls: - .. hlist:: - :columns: 3 + Some conversion between different units - * :c:func:`rec_i2_quicksort` -.. c:function:: rec_i8_quicksort: +.. c:var:: qp_max_mem - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/memory.irp.f` .. code:: fortran - recursive subroutine rec_i8_quicksort(x, iorder, isize, first, last, level) + integer :: qp_max_mem + Maximum memory in Gb - Called by: + Needs: .. hlist:: :columns: 3 - * :c:func:`quick_i8sort` - * :c:func:`rec_i8_quicksort` + * :c:data:`file_lock` + * :c:data:`mpi_master` - Calls: + Needed by: .. hlist:: :columns: 3 - * :c:func:`rec_i8_quicksort` + * :c:data:`ao_two_e_integral_alpha_chol` + * :c:data:`cholesky_ao_num` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`pt2_j` + * :c:data:`pt2_w` -.. c:function:: rec_i_quicksort: +.. c:var:: shiftfact_op5_inv - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/util.irp.f` .. code:: fortran - recursive subroutine rec_i_quicksort(x, iorder, isize, first, last, level) - - + double precision, allocatable :: shiftfact_op5_inv (128) - Called by: - - .. hlist:: - :columns: 3 - * :c:func:`quick_isort` - * :c:func:`rec_i_quicksort` - - Calls: - - .. hlist:: - :columns: 3 + + 1 / Gamma(n + 0.5) + - * :c:func:`rec_i_quicksort` .. c:var:: theta_angular_integration_lebedev @@ -713,16 +665,39 @@ Providers Subroutines / functions ----------------------- -.. c:function:: a_coef: +.. c:function:: add_cpoly: + + + File : :file:`utils/cgtos_utils.irp.f` + + .. code:: fortran + + subroutine add_cpoly(b, nb, c, nc, d, nd) + + + Add two complex polynomials + D(t) =! D(t) +( B(t) + C(t)) + + +.. c:function:: add_cpoly_multiply: - File : :file:`utils/need.irp.f` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - double precision function a_coef(n) + subroutine add_cpoly_multiply(b, nb, cst, d, nd) + + + Add a complex polynomial multiplied by a complex constant + D(t) =! D(t) +( cst * B(t)) + + Called by: + .. hlist:: + :columns: 3 + * :c:func:`general_primitive_integral_cgtos` .. c:function:: add_poly: @@ -793,32 +768,55 @@ Subroutines / functions -.. c:function:: b_coef: +.. c:function:: binom_func: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + double precision function binom_func(i,j) + + + .. math :: + + \frac{i!}{j!(i-j)!} + + + +.. c:function:: cgaussian_product: - File : :file:`utils/need.irp.f` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - double precision function b_coef(n,u) + subroutine cgaussian_product(a, xa, b, xb, k, p, xp) + + complex Gaussian product + e^{-a (r-r_A)^2} e^{-b (r-r_B)^2} = k e^{-p (r-r_P)^2} + + Called by: + + .. hlist:: + :columns: 3 + * :c:func:`give_explicit_cpoly_and_cgaussian` -.. c:function:: binom_func: +.. c:function:: cgaussian_product_x: - File : :file:`utils/util.irp.f` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - double precision function binom_func(i,j) + subroutine cgaussian_product_x(a, xa, b, xb, k, p, xp) - .. math :: - - \frac{i!}{j!(i-j)!} - + complex Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K e^{-p (x-x_P)^2} .. c:function:: check_mem: @@ -845,10 +843,20 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`ao_two_e_integral_alpha_chol` * :c:func:`create_selection_buffer` + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` * :c:func:`make_selection_buffer_s2` - * :c:func:`merge_selection_buffers` * :c:func:`pt2_collector` * :c:data:`pt2_j` * :c:data:`pt2_w` @@ -857,7 +865,6 @@ Subroutines / functions * :c:func:`run_slave_main` * :c:func:`run_stochastic_cipsi` * :c:func:`selection_collector` - * :c:func:`sort_selection_buffer` * :c:func:`testteethbuilding` * :c:func:`zmq_pt2` @@ -866,1355 +873,2321 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`print_memory_usage` * :c:func:`resident_memory` -.. c:function:: dble_fact: +.. c:function:: check_sym: File : :file:`utils/util.irp.f` .. code:: fortran - double precision function dble_fact(n) + subroutine check_sym(A, n) -.. c:function:: dble_fact_even: +.. c:function:: cpx_erf: - File : :file:`utils/util.irp.f` + File : :file:`utils/cpx_erf.irp.f` .. code:: fortran - double precision function dble_fact_even(n) result(fact2) - + complex*16 function cpx_erf(x, y) - n!! - -.. c:function:: dble_fact_odd: - - - File : :file:`utils/util.irp.f` - - .. code:: fortran - - double precision function dble_fact_odd(n) result(fact2) - - - n!! + + compute erf(z) for z = x + i y + + REF: Abramowitz and Stegun + -.. c:function:: dble_logfact: +.. c:function:: cpx_erf_1: - File : :file:`utils/util.irp.f` + File : :file:`utils/cpx_erf.irp.f` .. code:: fortran - double precision function dble_logfact(n) result(logfact2) + complex*16 function cpx_erf_1(x, y) - n!! + + compute erf(z) for z = x + i y + + REF: Abramowitz and Stegun + -.. c:function:: ddfact2: +.. c:function:: crint: - File : :file:`utils/need.irp.f` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - double precision function ddfact2(n) + complex*16 function crint(n, rho) -.. c:function:: dset_order: +.. c:function:: crint_1: - File : :file:`utils/sort.irp.f_template_347` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - subroutine dset_order(x,iorder,isize) + complex*16 function crint_1(n, rho) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. - Called by: + Calls: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered` - * :c:func:`h_s2_u_0_nstates_openmp` - * :c:func:`h_s2_u_0_nstates_zmq` - * :c:func:`h_s2_u_0_two_e_nstates_openmp` - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_values` - - -.. c:function:: dset_order_big: - - - File : :file:`utils/sort.irp.f_template_412` - - .. code:: fortran - - subroutine dset_order_big(x,iorder,isize) - - - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. - This is a version for very large arrays where the indices need - to be in integer*8 format + * :c:func:`zboysfun00_1` -.. c:function:: dsort: +.. c:function:: crint_1_vec: - File : :file:`utils/sort.irp.f_template_293` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - subroutine dsort(x,iorder,isize) + subroutine crint_1_vec(n_max, rho, vals) - Sort array x(isize). - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. Called by: .. hlist:: :columns: 3 - * :c:data:`ao_coef_normalized_ordered` - * :c:func:`make_selection_buffer_s2` - * :c:data:`psi_det_sorted` - * :c:func:`reorder_core_orb` - * :c:func:`sort_by_fock_energies` - * :c:func:`sort_selection_buffer` + * :c:func:`crint_sum` Calls: .. hlist:: :columns: 3 - * :c:func:`insertion_dsort` - * :c:func:`quick_dsort` + * :c:func:`crint_smallz_vec` + * :c:func:`zboysfun00_1` -.. c:function:: erf0: +.. c:function:: crint_2: - File : :file:`utils/need.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - double precision function erf0(x) + complex*16 function crint_2(n, rho) - -.. c:function:: extrapolate_data: + Calls: + .. hlist:: + :columns: 3 - File : :file:`utils/extrapolation.irp.f` + * :c:func:`zboysfun` + * :c:func:`zboysfunnrp` - .. code:: fortran + +.. c:function:: crint_2_vec: - subroutine extrapolate_data(N_data, data, pt2, output) + File : :file:`utils/cpx_boys.irp.f` - Extrapolate the data to the FCI limit + .. code:: fortran - Called by: + subroutine crint_2_vec(n_max, rho, vals) - .. hlist:: - :columns: 3 - * :c:data:`extrapolated_energy` Calls: .. hlist:: :columns: 3 - * :c:func:`get_pseudo_inverse` + * :c:func:`crint_smallz_vec` + * :c:func:`zboysfun` + * :c:func:`zboysfunnrp` -.. c:function:: f_integral: +.. c:function:: crint_quad_1: - File : :file:`utils/integration.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - double precision function F_integral(n,p) + subroutine crint_quad_1(n, rho, n_quad, crint_quad) - function that calculates the following integral - \int_{\-infty}^{+\infty} x^n \exp(-p x^2) dx -.. c:function:: fact: +.. c:function:: crint_quad_12: - File : :file:`utils/util.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - double precision function fact(n) + subroutine crint_quad_12(n, rho, n_quad, crint_quad) - n! + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`crint_quad_12_vec` -.. c:function:: find_rotation: +.. c:function:: crint_quad_12_vec: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - subroutine find_rotation(A,LDA,B,m,C,n) + subroutine crint_quad_12_vec(n_max, rho, vals) - Find A.C = B Calls: .. hlist:: :columns: 3 - * :c:func:`dgemm` - * :c:func:`get_pseudo_inverse` + * :c:func:`crint_quad_12` -.. c:function:: gammln: +.. c:function:: crint_quad_2: - File : :file:`utils/need.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - double precision function gammln(xx) + subroutine crint_quad_2(n, rho, n_quad, crint_quad) -.. c:function:: gammp: +.. c:function:: crint_smallz: - File : :file:`utils/need.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - double precision function gammp(a,x) - + complex*16 function crint_smallz(n, rho) - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`gcf` - * :c:func:`gser` + Standard version of rint -.. c:function:: gaussian_product: +.. c:function:: crint_smallz_vec: - File : :file:`utils/integration.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - subroutine gaussian_product(a,xa,b,xb,k,p,xp) + subroutine crint_smallz_vec(n_max, rho, vals) - Gaussian product in 1D. - e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + Standard version of rint Called by: .. hlist:: :columns: 3 - * :c:func:`give_explicit_poly_and_gaussian` - * :c:func:`give_explicit_poly_and_gaussian_double` + * :c:func:`crint_1_vec` + * :c:func:`crint_2_vec` -.. c:function:: gaussian_product_x: +.. c:function:: crint_sum: - File : :file:`utils/integration.irp.f` + File : :file:`utils/cpx_boys.irp.f` .. code:: fortran - subroutine gaussian_product_x(a,xa,b,xb,k,p,xp) + complex*16 function crint_sum(n_pt_out, rho, d1) - Gaussian product in 1D. - e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`overlap_gaussian_xyz` + * :c:func:`crint_1_vec` -.. c:function:: gcf: +.. c:function:: dble_fact: - File : :file:`utils/need.irp.f` + File : :file:`utils/util.irp.f` .. code:: fortran - subroutine gcf(gammcf,a,x,gln) - - - - Called by: + double precision function dble_fact(n) - .. hlist:: - :columns: 3 - * :c:func:`gammp` -.. c:function:: get_inverse: +.. c:function:: dble_fact_even: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/util.irp.f` .. code:: fortran - subroutine get_inverse(A,LDA,m,C,LDC) + double precision function dble_fact_even(n) result(fact2) - Returns the inverse of the square matrix A + n!! - Called by: + +.. c:function:: dble_fact_odd: - .. hlist:: - :columns: 3 - * :c:data:`ao_ortho_canonical_coef_inv` + File : :file:`utils/util.irp.f` - Calls: + .. code:: fortran - .. hlist:: - :columns: 3 + double precision function dble_fact_odd(n) result(fact2) - * :c:func:`dgetrf` - * :c:func:`dgetri` + + n!! -.. c:function:: get_pseudo_inverse: +.. c:function:: dble_logfact: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/util.irp.f` .. code:: fortran - subroutine get_pseudo_inverse(A,LDA,m,n,C,LDC) + double precision function dble_logfact(n) result(logfact2) - Find C = A^-1 + n!! - Called by: + +.. c:function:: derf_mu_x: - .. hlist:: - :columns: 3 - * :c:data:`ao_cart_to_sphe_inv` - * :c:func:`extrapolate_data` - * :c:func:`find_rotation` - * :c:data:`s_inv` + File : :file:`utils/util.irp.f` - Calls: + .. code:: fortran + + double precision function derf_mu_x(mu,x) - .. hlist:: - :columns: 3 - * :c:func:`dgesvd` -.. c:function:: give_explicit_poly_and_gaussian: +.. c:function:: diag_mat_per_fock_degen: - File : :file:`utils/integration.irp.f` + File : :file:`utils/block_diag_degen.irp.f` .. code:: fortran - subroutine give_explicit_poly_and_gaussian(P_new,P_center,p,fact_k,iorder,alpha,beta,a,b,A_center,B_center,dim) - - - Transforms the product of - (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) - into - fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) - * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) - * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) - - Called by: + subroutine diag_mat_per_fock_degen(fock_diag, mat_ref, n, thr_d, thr_nd, thr_deg, leigvec, reigvec, eigval) - .. hlist:: - :columns: 3 - * :c:func:`ao_two_e_integral` - * :c:func:`ao_two_e_integral_erf` - * :c:func:`ao_two_e_integral_schwartz_accel` - * :c:func:`ao_two_e_integral_schwartz_accel_erf` - * :c:func:`give_explicit_poly_and_gaussian_double` - * :c:func:`overlap_gaussian_xyz` + + subroutine that diagonalizes a matrix mat_ref BY BLOCK + + the blocks are defined by the elements having the SAME DEGENERACIES in the entries "fock_diag" + + examples : all elements having degeneracy 1 in fock_diag (i.e. not being degenerated) will be treated together + + : all elements having degeneracy 2 in fock_diag (i.e. two elements are equal) will be treated together + + : all elements having degeneracy 3 in fock_diag (i.e. two elements are equal) will be treated together + + etc... the advantage is to guarentee no spurious mixing because of numerical problems. + Calls: .. hlist:: :columns: 3 - * :c:func:`gaussian_product` - * :c:func:`multiply_poly` - * :c:func:`recentered_poly2` + * :c:func:`dsort` + * :c:func:`give_degen_full_list` + * :c:func:`isort` + * :c:func:`non_hrmt_bieig` -.. c:function:: give_explicit_poly_and_gaussian_double: +.. c:function:: diag_mat_per_fock_degen_core: - File : :file:`utils/integration.irp.f` + File : :file:`utils/block_diag_degen_core.irp.f` .. code:: fortran - subroutine give_explicit_poly_and_gaussian_double(P_new,P_center,p,fact_k,iorder,alpha,beta,gama,a,b,A_center,B_center,Nucl_center,dim) + subroutine diag_mat_per_fock_degen_core(fock_diag, mat_ref, listcore,ncore, n, thr_d, thr_nd, thr_deg, leigvec, reigvec, eigval) - Transforms the product of - (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) - exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) exp(-(r-Nucl_center)^2 gama - into - fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) - * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) - * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + subroutine that diagonalizes a matrix mat_ref BY BLOCK + + the blocks are defined by the elements having the SAME DEGENERACIES in the entries "fock_diag" + + the elements of listcore are untouched + + examples : all elements having degeneracy 1 in fock_diag (i.e. not being degenerated) will be treated together + + : all elements having degeneracy 2 in fock_diag (i.e. two elements are equal) will be treated together + + : all elements having degeneracy 3 in fock_diag (i.e. two elements are equal) will be treated together + + etc... the advantage is to guarentee no spurious mixing because of numerical problems. + Calls: .. hlist:: :columns: 3 - * :c:func:`gaussian_product` - * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`dsort` + * :c:func:`give_degen_full_listcore` + * :c:func:`isort` + * :c:func:`non_hrmt_bieig` -.. c:function:: give_explicit_poly_and_gaussian_x: +.. c:function:: diag_nonsym_right: - File : :file:`utils/integration.irp.f` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine give_explicit_poly_and_gaussian_x(P_new,P_center,p,fact_k,iorder,alpha,beta,a,b,A_center,B_center,dim) + subroutine diag_nonsym_right(n, A, A_ldim, V, V_ldim, energy, E_ldim) - Transform the product of - (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) - into - fact_k (x-x_P)^iorder(1) (y-y_P)^iorder(2) (z-z_P)^iorder(3) exp(-p(r-P)^2) Called by: .. hlist:: :columns: 3 - * :c:func:`overlap_gaussian_x` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` Calls: .. hlist:: :columns: 3 - * :c:func:`multiply_poly` - * :c:func:`recentered_poly2` + * :c:func:`dgeevx` + * :c:func:`dsort` -.. c:function:: gser: +.. c:function:: diagonalize_sym_matrix: - File : :file:`utils/need.irp.f` + File : :file:`utils/util.irp.f` .. code:: fortran - subroutine gser(gamser,a,x,gln) + subroutine diagonalize_sym_matrix(N, A, e) + + Diagonalize a symmetric matrix + - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`gammp` + * :c:func:`dsyev` -.. c:function:: heap_dsort: +.. c:function:: dset_order: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - subroutine heap_dsort(x,iorder,isize) + subroutine dset_order(x,iorder,isize) + + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + Called by: - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_norm_cgtos_ord` + * :c:data:`ao_coef_normalized_ordered` + * :c:func:`h_s2_u_0_nstates_openmp` + * :c:func:`h_s2_u_0_nstates_zmq` + * :c:func:`h_s2_u_0_two_e_nstates_openmp` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_zmq` + * :c:func:`orb_range_2_rdm_openmp` + * :c:func:`orb_range_2_rdm_state_av_openmp` + * :c:func:`orb_range_2_trans_rdm_openmp` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:func:`restore_symmetry` -.. c:function:: heap_dsort_big: +.. c:function:: dset_order_big: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - subroutine heap_dsort_big(x,iorder,isize) + subroutine dset_order_big(x,iorder,isize) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need to be in integer*8 format -.. c:function:: heap_i2sort: +.. c:function:: eigsvd: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine heap_i2sort(x,iorder,isize) + subroutine eigSVD(A,LDA,U,LDU,D,Vt,LDVt,m,n) + + + Algorithm 3 of https://arxiv.org/pdf/1810.06860.pdf + + A(m,n) = U(m,n) D(n) Vt(n,n) with m>n + + Calls: + .. hlist:: + :columns: 3 - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + * :c:func:`dgemm` + * :c:func:`dscal` + * :c:func:`lapack_diagd` + * :c:func:`svd` -.. c:function:: heap_i2sort_big: +.. c:function:: erf_e: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/cpx_erf.irp.f` .. code:: fortran - subroutine heap_i2sort_big(x,iorder,isize) + complex*16 function erf_E(x, yabs) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format -.. c:function:: heap_i8sort: +.. c:function:: erf_f: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/cpx_erf.irp.f` .. code:: fortran - subroutine heap_i8sort(x,iorder,isize) + double precision function erf_F(x, yabs) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. -.. c:function:: heap_i8sort_big: +.. c:function:: erf_g: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/cpx_erf.irp.f` .. code:: fortran - subroutine heap_i8sort_big(x,iorder,isize) + complex*16 function erf_G(x, yabs) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format -.. c:function:: heap_isort: +.. c:function:: erf_h: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/cpx_erf.irp.f` .. code:: fortran - subroutine heap_isort(x,iorder,isize) + complex*16 function erf_H(x, yabs) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. -.. c:function:: heap_isort_big: +.. c:function:: exp_matrix: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine heap_isort_big(x,iorder,isize) + subroutine exp_matrix(X,n,exp_X) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + exponential of the matrix X: X has to be ANTI HERMITIAN !! + + taken from Hellgaker, jorgensen, Olsen book + + section evaluation of matrix exponential (Eqs. 3.1.29 to 3.1.31) + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`get_a_squared` + * :c:func:`lapack_diagd` -.. c:function:: heap_sort: +.. c:function:: exp_matrix_taylor: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine heap_sort(x,iorder,isize) - + subroutine exp_matrix_taylor(X,n,exp_X,converged) - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - -.. c:function:: heap_sort_big: + exponential of a general real matrix X using the Taylor expansion of exp(X) + + returns the logical converged which checks the convergence + exponential of X using Taylor expansion + Called by: - File : :file:`utils/sort.irp.f_template_261` + .. hlist:: + :columns: 3 - .. code:: fortran + * :c:data:`umat` - subroutine heap_sort_big(x,iorder,isize) + Calls: + .. hlist:: + :columns: 3 - Sort array x(isize) using the heap sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + * :c:func:`dgemm` -.. c:function:: hermite: +.. c:function:: extrapolate_data: - File : :file:`utils/integration.irp.f` + File : :file:`utils/extrapolation.irp.f` .. code:: fortran - double precision function hermite(n,x) - + subroutine extrapolate_data(N_data, data, pt2, output) - Hermite polynomial - -.. c:function:: i2set_order: + Extrapolate the data to the FCI limit + Called by: - File : :file:`utils/sort.irp.f_template_347` + .. hlist:: + :columns: 3 - .. code:: fortran + * :c:func:`increment_n_iter` - subroutine i2set_order(x,iorder,isize) + Calls: + .. hlist:: + :columns: 3 - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. + * :c:func:`get_pseudo_inverse` -.. c:function:: i2set_order_big: +.. c:function:: f_integral: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine i2set_order_big(x,iorder,isize) + double precision function F_integral(n,p) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. - This is a version for very large arrays where the indices need - to be in integer*8 format + function that calculates the following integral + \int_{\-infty}^{+\infty} x^n \exp(-p x^2) dx -.. c:function:: i2sort: +.. c:function:: fact: - File : :file:`utils/sort.irp.f_template_315` + File : :file:`utils/util.irp.f` .. code:: fortran - subroutine i2sort(x,iorder,isize) - - - Sort array x(isize). - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - - Calls: + double precision function fact(n) - .. hlist:: - :columns: 3 - * :c:func:`quick_i2sort` + n! -.. c:function:: i8set_order: +.. c:function:: fc_integral: - File : :file:`utils/sort.irp.f_template_347` + File : :file:`utils/cgtos_utils.irp.f` .. code:: fortran - subroutine i8set_order(x,iorder,isize) + complex*16 function Fc_integral(n, inv_sq_p) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. + function that calculates the following integral + \int_{\-infty}^{+\infty} x^n \exp(-p x^2) dx + for complex valued p -.. c:function:: i8set_order_big: +.. c:function:: find_rotation: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine i8set_order_big(x,iorder,isize) + subroutine find_rotation(A,LDA,B,m,C,n) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. - This is a version for very large arrays where the indices need - to be in integer*8 format + Find A.C = B + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`get_pseudo_inverse` -.. c:function:: i8sort: +.. c:function:: format_w_error: - File : :file:`utils/sort.irp.f_template_315` + File : :file:`utils/format_w_error.irp.f` .. code:: fortran - subroutine i8sort(x,iorder,isize) + subroutine format_w_error(value,error,size_nb,max_nb_digits,format_value,str_error) - Sort array x(isize). - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Format for double precision, value(error) Called by: .. hlist:: :columns: 3 - * :c:func:`make_selection_buffer_s2` - * :c:data:`psi_bilinear_matrix_values` - * :c:data:`psi_det_alpha_unique` - * :c:data:`psi_det_beta_unique` - * :c:data:`psi_occ_pattern` - * :c:func:`remove_duplicates_in_selection_buffer` - * :c:func:`sort_dets_by_det_search_key` + * :c:func:`pt2_collector` Calls: .. hlist:: :columns: 3 - * :c:func:`quick_i8sort` + * :c:func:`lock_io` + * :c:func:`unlock_io` -.. c:function:: insertion_dsort: +.. c:function:: gaussian_product: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine insertion_dsort (x,iorder,isize) + subroutine gaussian_product(a,xa,b,xb,k,p,xp) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} Called by: .. hlist:: :columns: 3 - * :c:func:`dsort` + * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`give_explicit_poly_and_gaussian_double` -.. c:function:: insertion_dsort_big: +.. c:function:: gaussian_product_v: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine insertion_dsort_big (x,iorder,isize) + subroutine gaussian_product_v(a, xa, LD_xa, b, xb, k, p, xp, n_points) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + Using multiple A centers + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_poly_and_gaussian_v` -.. c:function:: insertion_i2sort: +.. c:function:: gaussian_product_x: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine insertion_i2sort (x,iorder,isize) + subroutine gaussian_product_x(a,xa,b,xb,k,p,xp) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} Called by: .. hlist:: :columns: 3 - * :c:func:`i2radix_sort` + * :c:func:`overlap_gaussian_xyz` -.. c:function:: insertion_i2sort_big: +.. c:function:: gaussian_product_x_v: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine insertion_i2sort_big (x,iorder,isize) + subroutine gaussian_product_x_v(a,xa,b,xb,k,p,xp,n_points) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + Gaussian product in 1D with multiple xa + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} -.. c:function:: insertion_i8sort: +.. c:function:: get_a_squared: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine insertion_i8sort (x,iorder,isize) + subroutine get_A_squared(A,n,A2) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + A2 = A A where A is n x n matrix. Use the dgemm routine Called by: .. hlist:: :columns: 3 - * :c:func:`i8radix_sort` + * :c:func:`exp_matrix` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` -.. c:function:: insertion_i8sort_big: +.. c:function:: get_ab_prod: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine insertion_i8sort_big (x,iorder,isize) + subroutine get_AB_prod(A,n,m,B,l,AB) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + AB = A B where A is n x m, B is m x l. Use the dgemm routine - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`i8radix_sort_big` + * :c:func:`dgemm` -.. c:function:: insertion_isort: +.. c:function:: get_inverse: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine insertion_isort (x,iorder,isize) + subroutine get_inverse(A,LDA,m,C,LDC) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Returns the inverse of the square matrix A Called by: .. hlist:: :columns: 3 - * :c:func:`iradix_sort` + * :c:data:`ao_ortho_canonical_coef_inv` + * :c:data:`overlap_states` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgetrf` + * :c:func:`dgetri` -.. c:function:: insertion_isort_big: +.. c:function:: get_inverse_complex: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine insertion_isort_big (x,iorder,isize) + subroutine get_inverse_complex(A,LDA,m,C,LDC) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + Returns the inverse of the square matrix A - Called by: + Calls: .. hlist:: :columns: 3 - * :c:func:`iradix_sort_big` + * :c:func:`zgetrf` + * :c:func:`zgetri` -.. c:function:: insertion_sort: +.. c:function:: get_pseudo_inverse: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine insertion_sort (x,iorder,isize) + subroutine get_pseudo_inverse(A, LDA, m, n, C, LDC, cutoff) - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Find C = A^-1 Called by: .. hlist:: :columns: 3 - * :c:func:`sort` - - -.. c:function:: insertion_sort_big: - - - File : :file:`utils/sort.irp.f_template_412` - - .. code:: fortran + * :c:data:`ao_cart_to_sphe_inv` + * :c:func:`extrapolate_data` + * :c:func:`find_rotation` + * :c:data:`s_inv` - subroutine insertion_sort_big (x,iorder,isize) + Calls: + .. hlist:: + :columns: 3 - Sort array x(isize) using the insertion sort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - This is a version for very large arrays where the indices need - to be in integer*8 format + * :c:func:`dgemm` + * :c:func:`dgesvd` -.. c:function:: iset_order: +.. c:function:: get_pseudo_inverse_complex: - File : :file:`utils/sort.irp.f_template_347` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine iset_order(x,iorder,isize) + subroutine get_pseudo_inverse_complex(A,LDA,m,n,C,LDC,cutoff) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. + Find C = A^-1 Called by: .. hlist:: :columns: 3 - * :c:data:`psi_bilinear_matrix_transp_values` - * :c:data:`psi_bilinear_matrix_values` + * :c:data:`s_inv_complex` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zgesvd` -.. c:function:: iset_order_big: +.. c:function:: get_total_available_memory: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/memory.irp.f` .. code:: fortran - subroutine iset_order_big(x,iorder,isize) + integer function get_total_available_memory() result(res) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. - This is a version for very large arrays where the indices need - to be in integer*8 format + Returns the total available memory on the current machine -.. c:function:: isort: +.. c:function:: give_degen: - File : :file:`utils/sort.irp.f_template_315` + File : :file:`utils/util.irp.f` .. code:: fortran - subroutine isort(x,iorder,isize) + subroutine give_degen(A, n, shift, list_degen, n_degen_list) + + + returns n_degen_list :: the number of degenerated SET of elements (i.e. with |A(i)-A(i+1)| below shift) + + for each of these sets, list_degen(1,i) = first degenerate element of the set i, + + list_degen(2,i) = last degenerate element of the set i. + +.. c:function:: give_degen_full_list: - Sort array x(isize). - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. - Called by: + File : :file:`utils/block_diag_degen.irp.f` - .. hlist:: - :columns: 3 + .. code:: fortran - * :c:func:`molden` - * :c:func:`select_singles_and_doubles` + subroutine give_degen_full_list(A, n, thr, list_degen, n_degen_list) - Calls: + + you enter with an array A(n) and spits out all the elements degenerated up to thr + + the elements of A(n) DON'T HAVE TO BE SORTED IN THE ENTRANCE: TOTALLY GENERAL + + list_degen(i,0) = number of degenerate entries + + list_degen(i,1) = index of the first degenerate entry + + list_degen(i,2:list_degen(i,0)) = list of all other dengenerate entries + + if list_degen(i,0) == 1 it means that there is no degeneracy for that element + + Called by: .. hlist:: :columns: 3 - * :c:func:`quick_isort` + * :c:func:`diag_mat_per_fock_degen` -.. c:function:: lapack_diag: +.. c:function:: give_degen_full_listcore: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/block_diag_degen_core.irp.f` .. code:: fortran - subroutine lapack_diag(eigvalues,eigvectors,H,nmax,n) + subroutine give_degen_full_listcore(A, n, listcore, ncore, thr, list_degen, n_degen_list) - Diagonalize matrix H + you enter with an array A(n) and spits out all the elements degenerated up to thr - H is untouched between input and ouptut + the elements of A(n) DON'T HAVE TO BE SORTED IN THE ENTRANCE: TOTALLY GENERAL - eigevalues(i) = ith lowest eigenvalue of the H matrix + list_degen(i,0) = number of degenerate entries - eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + list_degen(i,1) = index of the first degenerate entry + + list_degen(i,2:list_degen(i,0)) = list of all other dengenerate entries + if list_degen(i,0) == 1 it means that there is no degeneracy for that element + + if list_degen(i,0) >= 1000 it means that it is core orbitals Called by: .. hlist:: :columns: 3 - * :c:data:`ci_electronic_energy` - * :c:func:`davidson_diag_hjj_sjj` - * :c:func:`mo_as_eigvectors_of_mo_matrix` - * :c:data:`psi_coef_cas_diagonalized` + * :c:func:`diag_mat_per_fock_degen_core` - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`dsyev` - - -.. c:function:: lapack_diagd: + +.. c:function:: give_explicit_poly_and_gaussian: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine lapack_diagd(eigvalues,eigvectors,H,nmax,n) + subroutine give_explicit_poly_and_gaussian(P_new,P_center,p,fact_k,iorder,alpha,beta,a,b,A_center,B_center,dim) - Diagonalize matrix H - - H is untouched between input and ouptut - - eigevalues(i) = ith lowest eigenvalue of the H matrix - - eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + WARNING ::: IF fact_k is too smal then: + returns a "s" function centered in zero + with an inifinite exponent and a zero polynom coef Called by: .. hlist:: :columns: 3 - * :c:data:`inertia_tensor_eigenvectors` + * :c:func:`ao_two_e_integral` + * :c:func:`ao_two_e_integral_erf` + * :c:func:`ao_two_e_integral_schwartz_accel` + * :c:func:`ao_two_e_integral_schwartz_accel_erf` + * :c:func:`give_explicit_poly_and_gaussian_double` + * :c:func:`overlap_gaussian_xyz` Calls: .. hlist:: :columns: 3 - * :c:func:`dsyevd` + * :c:func:`gaussian_product` + * :c:func:`multiply_poly` + * :c:func:`recentered_poly2` -.. c:function:: logfact: +.. c:function:: give_explicit_poly_and_gaussian_double: - File : :file:`utils/util.irp.f` + File : :file:`utils/integration.irp.f` .. code:: fortran - double precision function logfact(n) + subroutine give_explicit_poly_and_gaussian_double(P_new,P_center,p,fact_k,iorder,alpha,beta,gama,a,b,A_center,B_center,Nucl_center,dim) - n! + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) + exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) exp(-(r-Nucl_center)^2 gama + + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`gaussian_product` + * :c:func:`give_explicit_poly_and_gaussian` -.. c:function:: lowercase: +.. c:function:: give_explicit_poly_and_gaussian_v: - File : :file:`utils/util.irp.f` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine lowercase(txt,n) + subroutine give_explicit_poly_and_gaussian_v(P_new, ldp, P_center, p, fact_k, iorder, alpha, beta, a, b, A_center, LD_A, B_center, n_points) - Transform to lower case + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (y-y_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + WARNING :: : IF fact_k is too smal then: + returns a "s" function centered in zero + with an inifinite exponent and a zero polynom coef Called by: .. hlist:: :columns: 3 - * :c:func:`end_parallel_job` - * :c:func:`new_parallel_job` + * :c:func:`overlap_gaussian_xyz_v` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`gaussian_product_v` + * :c:func:`multiply_poly_v` + * :c:func:`recentered_poly2_v` + * :c:func:`recentered_poly2_v0` -.. c:function:: map_load_from_disk: +.. c:function:: give_explicit_poly_and_gaussian_x: - File : :file:`utils/map_functions.irp.f` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine map_load_from_disk(filename,map) + subroutine give_explicit_poly_and_gaussian_x(P_new,P_center,p,fact_k,iorder,alpha,beta,a,b,A_center,B_center,dim) + Transform the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k (x-x_P)^iorder(1) (y-y_P)^iorder(2) (z-z_P)^iorder(3) exp(-p(r-P)^2) Called by: .. hlist:: :columns: 3 - * :c:data:`ao_two_e_integrals_erf_in_map` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_erf_in_map` - * :c:data:`mo_two_e_integrals_in_map` + * :c:func:`overlap_gaussian_x` Calls: .. hlist:: :columns: 3 - * :c:func:`c_f_pointer` - * :c:func:`mmap` + * :c:func:`multiply_poly` + * :c:func:`recentered_poly2` -.. c:function:: map_save_to_disk: +.. c:function:: give_pol_in_r: - File : :file:`utils/map_functions.irp.f` + File : :file:`utils/prim_in_r.irp.f` .. code:: fortran - subroutine map_save_to_disk(filename,map) + double precision function give_pol_in_r(r,pol,center, alpha,iorder, max_dim) - Called by: + +.. c:function:: hermite: - .. hlist:: - :columns: 3 - * :c:data:`ao_two_e_integrals_erf_in_map` - * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`mo_two_e_integrals_erf_in_map` - * :c:data:`mo_two_e_integrals_in_map` - * :c:func:`save_erf_two_e_integrals_ao` - * :c:func:`save_erf_two_e_integrals_mo` - * :c:func:`save_erf_two_e_ints_ao_into_ints_ao` - * :c:func:`save_erf_two_e_ints_mo_into_ints_mo` + File : :file:`utils/integration.irp.f` - Calls: + .. code:: fortran - .. hlist:: - :columns: 3 + double precision function hermite(n,x) - * :c:func:`c_f_pointer` - * :c:func:`map_sort` - * :c:func:`mmap` - * :c:func:`msync` + + Hermite polynomial -.. c:function:: memory_of_double: +.. c:function:: i2set_order: - File : :file:`utils/memory.irp.f` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - double precision function memory_of_double(n) + subroutine i2set_order(x,iorder,isize) - Computes the memory required for n double precision elements in gigabytes. + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. -.. c:function:: memory_of_int: +.. c:function:: i2set_order_big: - File : :file:`utils/memory.irp.f` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - double precision function memory_of_int(n) + subroutine i2set_order_big(x,iorder,isize) - Computes the memory required for n double precision elements in gigabytes. + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format -.. c:function:: multiply_poly: +.. c:function:: i8set_order: - File : :file:`utils/integration.irp.f` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - subroutine multiply_poly(b,nb,c,nc,d,nd) + subroutine i8set_order(x,iorder,isize) - Multiply two polynomials - D(t) =! D(t) +( B(t)*C(t)) + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +.. c:function:: i8set_order_big: + + + File : :file:`utils/sort.irp.f_template_90` + + .. code:: fortran + + subroutine i8set_order_big(x,iorder,isize) + + + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +.. c:function:: is_same_spin: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + logical function is_same_spin(sigma_1, sigma_2) + + + + true if sgn(sigma_1) = sgn(sigma_2) + + + +.. c:function:: iset_order: + + + File : :file:`utils/sort.irp.f_template_90` + + .. code:: fortran + + subroutine iset_order(x,iorder,isize) + + + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. Called by: .. hlist:: :columns: 3 - * :c:func:`general_primitive_integral` - * :c:func:`general_primitive_integral_erf` - * :c:func:`give_explicit_poly_and_gaussian` - * :c:func:`give_explicit_poly_and_gaussian_x` - * :c:func:`give_polynomial_mult_center_one_e` - * :c:func:`give_polynomial_mult_center_one_e_erf` - * :c:func:`give_polynomial_mult_center_one_e_erf_opt` - * :c:func:`i_x1_pol_mult_a1` - * :c:func:`i_x1_pol_mult_a2` - * :c:func:`i_x1_pol_mult_one_e` - * :c:func:`i_x1_pol_mult_recurs` - * :c:func:`i_x2_pol_mult` - * :c:func:`i_x2_pol_mult_one_e` + * :c:data:`psi_bilinear_matrix_transp_values` + * :c:data:`psi_bilinear_matrix_values` + * :c:func:`restore_symmetry` -.. c:function:: normalize: +.. c:function:: iset_order_big: + + + File : :file:`utils/sort.irp.f_template_90` + + .. code:: fortran + + subroutine iset_order_big(x,iorder,isize) + + + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +.. c:function:: kronecker_delta: File : :file:`utils/util.irp.f` .. code:: fortran - subroutine normalize(u,sze) + function Kronecker_delta(i, j) result(delta) - Normalizes vector u + Kronecker Delta + + +.. c:function:: lapack_diag: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine lapack_diag(eigvalues,eigvectors,H,nmax,n) + + + Diagonalize matrix H + + H is untouched between input and ouptut + + eigevalues(i) = ith lowest eigenvalue of the H matrix + + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + Called by: .. hlist:: :columns: 3 - * :c:func:`copy_h_apply_buffer_to_wf` - * :c:func:`davidson_diag_hjj_sjj` - * :c:func:`save_wavefunction_general` + * :c:data:`ci_electronic_energy` + * :c:func:`davidson_general` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:data:`difference_dm_eigvect` + * :c:func:`mo_as_eigvectors_of_mo_matrix` + * :c:data:`multi_s_x_dipole_moment_eigenvec` + * :c:data:`psi_coef_cas_diagonalized` + * :c:data:`sxeigenvec` Calls: .. hlist:: :columns: 3 - * :c:func:`dscal` + * :c:func:`dsyev` -.. c:function:: ortho_canonical: +.. c:function:: lapack_diag_complex: File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine ortho_canonical(overlap,LDA,N,C,LDC,m) + subroutine lapack_diag_complex(eigvalues,eigvectors,H,nmax,n) - Compute C_new=C_old.U.s^-1/2 canonical orthogonalization. + Diagonalize matrix H (complex) - overlap : overlap matrix + H is untouched between input and ouptut - LDA : leftmost dimension of overlap array + eigevalues(i) = ith lowest eigenvalue of the H matrix - N : Overlap matrix is NxN (array is (LDA,N) ) + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zheev` + + +.. c:function:: lapack_diagd: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine lapack_diagd(eigvalues,eigvectors,H,nmax,n) + + + Diagonalize matrix H + + H is untouched between input and ouptut + + eigevalues(i) = ith lowest eigenvalue of the H matrix + + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`eigsvd` + * :c:func:`exp_matrix` + * :c:data:`inertia_tensor_eigenvectors` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dsyevd` + + +.. c:function:: lapack_diagd_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine lapack_diagd_complex(eigvalues,eigvectors,H,nmax,n) + + + Diagonalize matrix H(complex) + + H is untouched between input and ouptut + + eigevalues(i) = ith lowest eigenvalue of the H matrix + + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zheevd` + + +.. c:function:: lapack_diagd_diag_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine lapack_diagd_diag_complex(eigvalues,eigvectors,H,nmax,n) + + + Diagonalize matrix H(complex) + + H is untouched between input and ouptut + + eigevalues(i) = ith lowest eigenvalue of the H matrix + + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zheev` + * :c:func:`zheevd` + + +.. c:function:: lapack_diagd_diag_in_place_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine lapack_diagd_diag_in_place_complex(eigvalues,eigvectors,nmax,n) + + + Diagonalize matrix H(complex) + + H is untouched between input and ouptut + + eigevalues(i) = ith lowest eigenvalue of the H matrix + + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zheev` + * :c:func:`zheevd` + + +.. c:function:: logfact: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + double precision function logfact(n) + + + n! + + +.. c:function:: lowercase: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + subroutine lowercase(txt,n) + + + Transform to lower case + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`end_parallel_job` + * :c:func:`new_parallel_job` + + +.. c:function:: map_load_from_disk: + + + File : :file:`utils/map_functions.irp.f` + + .. code:: fortran + + subroutine map_load_from_disk(filename,map) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integrals_erf_in_map` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`c_f_pointer` + * :c:func:`mmap` + + +.. c:function:: map_save_to_disk: + + + File : :file:`utils/map_functions.irp.f` + + .. code:: fortran + + subroutine map_save_to_disk(filename,map) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_two_e_integrals_erf_in_map` + * :c:data:`ao_two_e_integrals_in_map` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` + * :c:func:`save_erf_two_e_integrals_ao` + * :c:func:`save_erf_two_e_integrals_mo` + * :c:func:`save_erf_two_e_ints_ao_into_ints_ao` + * :c:func:`save_erf_two_e_ints_mo_into_ints_mo` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`c_f_pointer` + * :c:func:`map_sort` + * :c:func:`mmap` + * :c:func:`msync` + + +.. c:function:: matrix_vector_product_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine matrix_vector_product_complex(u0,u1,matrix,sze,lda) + + + performs u1 =! performs u1 +( u0 * matrix) + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zhemv` + + +.. c:function:: memory_of_double: + + + File : :file:`utils/memory.irp.f` + + .. code:: fortran + + double precision function memory_of_double(n) + + + Computes the memory required for n double precision elements in gigabytes. + + +.. c:function:: memory_of_double8: + + + File : :file:`utils/memory.irp.f` + + .. code:: fortran + + double precision function memory_of_double8(n) + + + Computes the memory required for n double precision elements in gigabytes. + + +.. c:function:: memory_of_int: + + + File : :file:`utils/memory.irp.f` + + .. code:: fortran + + double precision function memory_of_int(n) + + + Computes the memory required for n double precision elements in gigabytes. + + +.. c:function:: memory_of_int8: + + + File : :file:`utils/memory.irp.f` + + .. code:: fortran + + double precision function memory_of_int8(n) + + + Computes the memory required for n double precision elements in gigabytes. + + +.. c:function:: multiply_cpoly: + + + File : :file:`utils/cgtos_utils.irp.f` + + .. code:: fortran + + subroutine multiply_cpoly(b, nb, c, nc, d, nd) + + + Multiply two complex polynomials + D(t) =! D(t) +( B(t) * C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`general_primitive_integral_cgtos` + * :c:func:`give_cpolynomial_mult_center_one_e` + * :c:func:`give_explicit_cpoly_and_cgaussian` + * :c:func:`give_explicit_cpoly_and_cgaussian_x` + * :c:func:`i_x1_pol_mult_a1_cgtos` + * :c:func:`i_x1_pol_mult_a2_cgtos` + * :c:func:`i_x1_pol_mult_one_e_cgtos` + * :c:func:`i_x1_pol_mult_recurs_cgtos` + * :c:func:`i_x2_pol_mult_cgtos` + * :c:func:`i_x2_pol_mult_one_e_cgtos` + + +.. c:function:: multiply_poly: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly(b,nb,c,nc,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`general_primitive_integral_erf` + * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`give_explicit_poly_and_gaussian_x` + * :c:func:`give_polynomial_mult_center_one_e` + * :c:func:`give_polynomial_mult_center_one_e_erf` + * :c:func:`give_polynomial_mult_center_one_e_erf_opt` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`multiply_poly_b0` + * :c:func:`multiply_poly_b1` + * :c:func:`multiply_poly_b2` + * :c:func:`multiply_poly_c0` + * :c:func:`multiply_poly_c1` + * :c:func:`multiply_poly_c2` + + +.. c:function:: multiply_poly_b0: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_b0(b,c,nc,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`multiply_poly` + + +.. c:function:: multiply_poly_b1: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_b1(b,c,nc,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`multiply_poly` + + +.. c:function:: multiply_poly_b2: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_b2(b,c,nc,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`multiply_poly` + + +.. c:function:: multiply_poly_c0: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_c0(b,nb,c,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`multiply_poly` + + +.. c:function:: multiply_poly_c1: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_c1(b,nb,c,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`multiply_poly` + + +.. c:function:: multiply_poly_c2: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_c2(b,nb,c,d,nd) + + + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`i_x1_pol_mult_one_e` + * :c:func:`i_x2_pol_mult_one_e` + * :c:func:`multiply_poly` + + +.. c:function:: multiply_poly_v: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + subroutine multiply_poly_v(b,nb,c,nc,d,nd,n_points) + + + Multiply pairs of polynomials + D(t) =! D(t) +( B(t)*C(t)) + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`give_explicit_poly_and_gaussian_v` + + +.. c:function:: normalize: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + subroutine normalize(u,sze) + + + Normalizes vector u + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`copy_h_apply_buffer_to_wf` + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` + * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` + * :c:func:`save_wavefunction_general` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dscal` + + +.. c:function:: nullify_small_elements: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine nullify_small_elements(m,n,A,LDA,thresh) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ci_electronic_energy` + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` + * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`hcore_guess` + * :c:data:`mo_one_e_integrals` + * :c:func:`save_natural_mos` + * :c:func:`save_natural_mos_canon_label` + * :c:func:`save_natural_mos_no_ov_rot` + * :c:func:`save_wavefunction_truncated` + + +.. c:function:: ortho_canonical: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_canonical(overlap,LDA,N,C,LDC,m,cutoff) + + + Compute C_new=C_old.U.s^-1/2 canonical orthogonalization. + + overlap : overlap matrix + + LDA : leftmost dimension of overlap array + + N : Overlap matrix is NxN (array is (LDA,N) ) + + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + + LDC : leftmost dimension of C + + m : Coefficients matrix is MxN, ( array is (LDC,N) ) + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_ortho_canonical_coef` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`svd` + + +.. c:function:: ortho_canonical_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_canonical_complex(overlap,LDA,N,C,LDC,m,cutoff) + + + Compute C_new=C_old.U.s^-1/2 canonical orthogonalization. + + overlap : overlap matrix + + LDA : leftmost dimension of overlap array + + N : Overlap matrix is NxN (array is (LDA,N) ) + + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + + LDC : leftmost dimension of C + + m : Coefficients matrix is MxN, ( array is (LDC,N) ) + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`svd_complex` + * :c:func:`zgemm` + + +.. c:function:: ortho_lowdin: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_lowdin(overlap,LDA,N,C,LDC,m,cutoff) + + + Compute C_new=C_old.S^-1/2 orthogonalization. + + overlap : overlap matrix + + LDA : leftmost dimension of overlap array + + N : Overlap matrix is NxN (array is (LDA,N) ) + + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + + LDC : leftmost dimension of C + + M : Coefficients matrix is MxN, ( array is (LDC,N) ) + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_ortho_lowdin_coef` + * :c:func:`orthonormalize_mos` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`svd` + + +.. c:function:: ortho_lowdin_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_lowdin_complex(overlap,LDA,N,C,LDC,m,cutoff) + + + Compute C_new=C_old.S^-1/2 orthogonalization. + + overlap : overlap matrix + + LDA : leftmost dimension of overlap array + + N : Overlap matrix is NxN (array is (LDA,N) ) + + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + + LDC : leftmost dimension of C + + M : Coefficients matrix is MxN, ( array is (LDC,N) ) + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`svd_complex` + * :c:func:`zgemm` + + +.. c:function:: ortho_qr: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_qr(A,LDA,m,n) + + + Orthogonalization using Q.R factorization + + A : matrix to orthogonalize + + LDA : leftmost dimension of A + + m : Number of rows of A + + n : Number of columns of A + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` + * :c:func:`ortho_svd` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgeqrf` + * :c:func:`dorgqr` + + +.. c:function:: ortho_qr_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_qr_complex(A,LDA,m,n) + + + Orthogonalization using Q.R factorization + + A : matrix to orthogonalize + + LDA : leftmost dimension of A + + n : Number of rows of A + + m : Number of columns of A + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zgeqrf` + * :c:func:`zungqr` + + +.. c:function:: ortho_qr_unblocked: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_qr_unblocked(A,LDA,m,n) + + + Orthogonalization using Q.R factorization + + A : matrix to orthogonalize + + LDA : leftmost dimension of A + + n : Number of rows of A + + m : Number of columns of A + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgeqr2` + * :c:func:`dorg2r` + + +.. c:function:: ortho_qr_unblocked_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_qr_unblocked_complex(A,LDA,m,n) + + + Orthogonalization using Q.R factorization + + A : matrix to orthogonalize + + LDA : leftmost dimension of A + + n : Number of rows of A + + m : Number of columns of A + + + +.. c:function:: ortho_svd: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine ortho_svd(A,LDA,m,n) + + + Orthogonalization via fast SVD + + A : matrix to orthogonalize - C : Coefficients of the vectors to orthogonalize. On exit, - orthogonal vectors + LDA : leftmost dimension of A - LDC : leftmost dimension of C + m : Number of rows of A - m : Coefficients matrix is MxN, ( array is (LDC,N) ) + n : Number of columns of A Called by: @@ -2222,140 +3195,117 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`ao_ortho_canonical_coef` + * :c:func:`randomized_svd` Calls: .. hlist:: :columns: 3 - * :c:func:`dgemm` + * :c:func:`ortho_qr` * :c:func:`svd` -.. c:function:: ortho_lowdin: +.. c:function:: overlap_cgaussian_x: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/cgtos_one_e.irp.f` .. code:: fortran - subroutine ortho_lowdin(overlap,LDA,N,C,LDC,m) + complex*16 function overlap_cgaussian_x(Ae_center, Be_center, alpha, beta, power_A, power_B, Ap_center, Bp_center, dim) - Compute C_new=C_old.S^-1/2 orthogonalization. - - overlap : overlap matrix - - LDA : leftmost dimension of overlap array - - N : Overlap matrix is NxN (array is (LDA,N) ) - - C : Coefficients of the vectors to orthogonalize. On exit, - orthogonal vectors - LDC : leftmost dimension of C + \int_{-infty}^{+infty} (x - Ap_x)^ax (x - Bp_x)^bx exp(-alpha (x - Ae_x)^2) exp(-beta (x - Be_X)^2) dx - M : Coefficients matrix is MxN, ( array is (LDC,N) ) + with complex arguments - Called by: - - .. hlist:: - :columns: 3 - - * :c:data:`ao_ortho_lowdin_coef` - * :c:func:`orthonormalize_mos` - Calls: .. hlist:: :columns: 3 - * :c:func:`dgemm` - * :c:func:`svd` + * :c:func:`give_explicit_cpoly_and_cgaussian_x` -.. c:function:: ortho_qr: +.. c:function:: overlap_gaussian_x: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/one_e_integration.irp.f` .. code:: fortran - subroutine ortho_qr(A,LDA,m,n) + double precision function overlap_gaussian_x(A_center,B_center,alpha,beta,power_A,power_B,dim) - Orthogonalization using Q.R factorization - - A : matrix to orthogonalize - - LDA : leftmost dimension of A - - n : Number of rows of A + .. math:: - m : Number of columns of A + \sum_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha(x-A_x)^2) exp(-beta(x-B_X)^2) dx - Called by: - - .. hlist:: - :columns: 3 - - * :c:func:`davidson_diag_hjj_sjj` - Calls: .. hlist:: :columns: 3 - * :c:func:`dgeqrf` - * :c:func:`dorgqr` + * :c:func:`give_explicit_poly_and_gaussian_x` -.. c:function:: ortho_qr_unblocked: +.. c:function:: overlap_gaussian_xyz: - File : :file:`utils/linear_algebra.irp.f` + File : :file:`utils/one_e_integration.irp.f` .. code:: fortran - subroutine ortho_qr_unblocked(A,LDA,m,n) + subroutine overlap_gaussian_xyz(A_center, B_center, alpha, beta, power_A, power_B, overlap_x, overlap_y, overlap_z, overlap, dim) - Orthogonalization using Q.R factorization - - A : matrix to orthogonalize - - LDA : leftmost dimension of A - - n : Number of rows of A + .. math:: - m : Number of columns of A + S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ + S = S_x S_y S_z + Called by: + + .. hlist:: + :columns: 3 + + * :c:data:`ao_coef_normalized` + * :c:data:`ao_deriv2_x` + * :c:data:`ao_deriv_1_x` + * :c:data:`ao_dipole_x` + * :c:data:`ao_overlap` + * :c:data:`ao_spread_x` + * :c:data:`prim_normalization_factor` + * :c:data:`shell_normalization_factor` + Calls: .. hlist:: :columns: 3 - * :c:func:`dgeqr2` - * :c:func:`dorg2r` + * :c:func:`gaussian_product_x` + * :c:func:`give_explicit_poly_and_gaussian` -.. c:function:: overlap_gaussian_x: +.. c:function:: overlap_gaussian_xyz_v: File : :file:`utils/one_e_integration.irp.f` .. code:: fortran - double precision function overlap_gaussian_x(A_center,B_center,alpha,beta,power_A,power_B,dim) + subroutine overlap_gaussian_xyz_v(A_center, B_center, alpha, beta, power_A, power_B, overlap, n_points) .. math:: - \sum_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha(x-A_x)^2) exp(-beta(x-B_X)^2) dx + S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ + S = S_x S_y S_z Calls: @@ -2363,7 +3313,7 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`give_explicit_poly_and_gaussian_x` + * :c:func:`give_explicit_poly_and_gaussian_v` .. c:function:: overlap_x_abs: @@ -2373,7 +3323,7 @@ Subroutines / functions .. code:: fortran - subroutine overlap_x_abs(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,lower_exp_val,dx,nx) + subroutine overlap_x_abs(A_center, B_center, alpha, beta, power_A, power_B, overlap_x, lower_exp_val, dx, nx) .. math :: @@ -2389,225 +3339,274 @@ Subroutines / functions * :c:data:`ao_overlap_abs` -.. c:function:: print_memory_usage: +.. c:function:: pivoted_cholesky: - File : :file:`utils/memory.irp.f` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine print_memory_usage() + subroutine pivoted_cholesky( A, rank, tol, ndim, U) - Prints the memory usage in the output Called by: .. hlist:: :columns: 3 - * :c:func:`write_time` + * :c:func:`roothaan_hall_scf` Calls: .. hlist:: :columns: 3 - * :c:func:`resident_memory` - * :c:func:`total_memory` + * :c:func:`dpstrf` -.. c:function:: quick_dsort: +.. c:function:: pol_modif_center: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine quick_dsort(x, iorder, isize) + subroutine pol_modif_center(A_center, B_center, iorder, A_pol, B_pol) - Sort array x(isize) using the quicksort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + + Transform the pol centerd on A: + [ \sum_i ax_i (x-x_A)^i ] [ \sum_j ay_j (y-y_A)^j ] [ \sum_k az_k (z-z_A)^k ] + to a pol centered on B + [ \sum_i bx_i (x-x_B)^i ] [ \sum_j by_j (y-y_B)^j ] [ \sum_k bz_k (z-z_B)^k ] + - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`nproc` + * :c:func:`pol_modif_center_x` - Called by: + +.. c:function:: pol_modif_center_x: - .. hlist:: - :columns: 3 - * :c:func:`dsort` + File : :file:`utils/integration.irp.f` - Calls: + .. code:: fortran + + subroutine pol_modif_center_x(A_center, B_center, iorder, A_pol, B_pol) + + + + Transform the pol centerd on A: + [ \sum_i ax_i (x-x_A)^i ] + to a pol centered on B + [ \sum_i bx_i (x-x_B)^i ] + + bx_i = \sum_{j=i}^{iorder} ax_j (x_B - x_A)^(j-i) j! / [ i! (j-i)! ] + = \sum_{j=i}^{iorder} ax_j (x_B - x_A)^(j-i) binom_func(j,i) + + + Called by: .. hlist:: :columns: 3 - * :c:func:`rec_d_quicksort` + * :c:func:`pol_modif_center` -.. c:function:: quick_i2sort: +.. c:function:: primitive_value_explicit: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/prim_in_r.irp.f` .. code:: fortran - subroutine quick_i2sort(x, iorder, isize) + double precision function primitive_value_explicit(power_prim,center_prim,alpha,r) - Sort array x(isize) using the quicksort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Evaluates at "r" a primitive of type : + (x - center_prim(1))**power_prim(1) (y - center_prim(2))**power_prim(2) * (z - center_prim(3))**power_prim(3) + + exp(-alpha * [(x - center_prim(1))**2 + (y - center_prim(2))**2 + (z - center_prim(3))**2] ) - Needs: + +.. c:function:: print_memory_usage: - .. hlist:: - :columns: 3 - * :c:data:`nproc` + File : :file:`utils/memory.irp.f` + + .. code:: fortran + + subroutine print_memory_usage() + + + Prints the memory usage in the output Called by: .. hlist:: :columns: 3 - * :c:func:`i2sort` + * :c:func:`check_mem` + * :c:data:`cholesky_ao_num` + * :c:func:`write_time` Calls: .. hlist:: :columns: 3 - * :c:func:`rec_i2_quicksort` + * :c:func:`resident_memory` + * :c:func:`total_memory` -.. c:function:: quick_i8sort: +.. c:function:: randomized_svd: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/linear_algebra.irp.f` .. code:: fortran - subroutine quick_i8sort(x, iorder, isize) + subroutine randomized_svd(A,LDA,U,LDU,D,Vt,LDVt,m,n,q,r) - Sort array x(isize) using the quicksort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Randomized SVD: rank r, q power iterations + + 1. Sample column space of A with P: Z = A.P where P is random with r+p columns. + + 2. Power iterations : Z <- X . (Xt.Z) + + 3. Z = Q.R + + 4. Compute SVD on projected Qt.X = U' . S. Vt + + 5. U = Q U' - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`nproc` + * :c:func:`dgemm` + * :c:func:`ortho_svd` + * :c:func:`random_number` + * :c:func:`svd` + + +.. c:function:: recentered_cpoly2: + + + File : :file:`utils/cgtos_utils.irp.f` + + .. code:: fortran + + subroutine recentered_cpoly2(P_A, x_A, x_P, a, P_B, x_B, x_Q, b) - Called by: + + + write two complex polynomials (x-x_A)^a (x-x_B)^b + as P_A(x-x_P) and P_B(x-x_Q) + + + Needs: .. hlist:: :columns: 3 - * :c:func:`i8sort` + * :c:data:`binom` - Calls: + Called by: .. hlist:: :columns: 3 - * :c:func:`rec_i8_quicksort` + * :c:func:`give_explicit_cpoly_and_cgaussian` + * :c:func:`give_explicit_cpoly_and_cgaussian_x` -.. c:function:: quick_isort: +.. c:function:: recentered_poly2: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine quick_isort(x, iorder, isize) + subroutine recentered_poly2(P_new, x_A, x_P, a, Q_new, x_B, x_Q, b) - Sort array x(isize) using the quicksort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + + Recenter two polynomials: + + (x - x_A)^a -> \sum_{i=0}^{a} \binom{a}{i} (x_A - x_P)^{a-i} (x - x_P)^i + (x - x_B)^b -> \sum_{i=0}^{b} \binom{b}{i} (x_B - x_Q)^{b-i} (x - x_Q)^i + + where: + \binom{a}{i} = \binom{a}{a-i} = a! / [i! (a-i)!] + Needs: .. hlist:: :columns: 3 - * :c:data:`nproc` + * :c:data:`binom` Called by: .. hlist:: :columns: 3 - * :c:func:`isort` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`rec_i_quicksort` + * :c:func:`give_explicit_poly_and_gaussian` + * :c:func:`give_explicit_poly_and_gaussian_x` -.. c:function:: quick_sort: +.. c:function:: recentered_poly2_v: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine quick_sort(x, iorder, isize) + subroutine recentered_poly2_v(P_new, lda, x_A, LD_xA, x_P, a, P_new2, ldb, x_B, x_Q, b, n_points) - Sort array x(isize) using the quicksort algorithm. - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. + Recenter two polynomials Needs: .. hlist:: :columns: 3 - * :c:data:`nproc` + * :c:data:`binom` Called by: .. hlist:: :columns: 3 - * :c:func:`sort` - - Calls: - - .. hlist:: - :columns: 3 - - * :c:func:`rec__quicksort` + * :c:func:`give_explicit_poly_and_gaussian_v` -.. c:function:: recentered_poly2: +.. c:function:: recentered_poly2_v0: File : :file:`utils/integration.irp.f` .. code:: fortran - subroutine recentered_poly2(P_new,x_A,x_P,a,P_new2,x_B,x_Q,b) + subroutine recentered_poly2_v0(P_new, lda, x_A, LD_xA, x_P, a, n_points) - Recenter two polynomials + + Recenter two polynomials. Special case for b=(0,0,0) + + (x - A)^a (x - B)^0 = (x - P + P - A)^a (x - Q + Q - B)^0 + = (x - P + P - A)^a + Needs: @@ -2621,8 +3620,7 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`give_explicit_poly_and_gaussian` - * :c:func:`give_explicit_poly_and_gaussian_x` + * :c:func:`give_explicit_poly_and_gaussian_v` .. c:function:: resident_memory: @@ -2637,20 +3635,25 @@ Subroutines / functions Returns the current used memory in gigabytes used by the current process. - Needs: - - .. hlist:: - :columns: 3 - - * :c:data:`file_lock` - Called by: .. hlist:: :columns: 3 + * :c:data:`ao_two_e_integral_alpha_chol` * :c:func:`check_mem` + * :c:data:`cholesky_ao_num` + * :c:func:`dav_double_dressed` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_hjj` * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` * :c:func:`print_memory_usage` * :c:func:`run_slave_main` * :c:func:`zmq_pt2` @@ -2660,8 +3663,44 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:func:`omp_set_lock` - * :c:func:`omp_unset_lock` + * :c:func:`lock_io` + * :c:func:`unlock_io` + * :c:func:`usleep` + + +.. c:function:: restore_symmetry: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine restore_symmetry(m,n,A,LDA,thresh) + + + Tries to find the matrix elements that are the same, and sets them + to the average value. + If restore_symm is False, only nullify small elements + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`ao_to_mo` + * :c:func:`create_guess` + * :c:func:`huckel_guess` + * :c:func:`roothaan_hall_scf` + * :c:func:`svd_symm` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dset_order` + * :c:func:`dsort` + * :c:func:`iset_order` .. c:function:: rint: @@ -2697,8 +3736,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`inv_int` * :c:data:`fact_inv` + * :c:data:`inv_int` .. c:function:: rint_large_n: @@ -2727,106 +3766,126 @@ Subroutines / functions Needed for the calculation of two-electron integrals. -.. c:function:: rinteg: +.. c:function:: set_multiple_levels_omp: + + + File : :file:`utils/set_multiple_levels_omp.irp.f` + + .. code:: fortran + + subroutine set_multiple_levels_omp(activate) + + + If true, activate OpenMP nested parallelism. If false, deactivate. + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`add_integrals_to_map_cholesky` + * :c:data:`cholesky_ao_num` + * :c:data:`cholesky_mo` + * :c:func:`h_s2_u_0_nstates_zmq` + * :c:func:`h_u_0_nstates_zmq` + * :c:data:`mo_integrals_cache` + * :c:func:`run_slave_cipsi` + * :c:func:`run_slave_main` + * :c:func:`zmq_pt2` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`omp_set_max_active_levels` + * :c:func:`omp_set_nested` + + +.. c:function:: set_order: - File : :file:`utils/need.irp.f` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - double precision function rinteg(n,u) + subroutine set_order(x,iorder,isize) + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. -.. c:function:: rintgauss: +.. c:function:: set_order_big: - File : :file:`utils/need.irp.f` + File : :file:`utils/sort.irp.f_template_90` .. code:: fortran - double precision function rintgauss(n) + subroutine set_order_big(x,iorder,isize) + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format -.. c:function:: sabpartial: +.. c:function:: shank: - File : :file:`utils/need.irp.f` + File : :file:`utils/shank.irp.f` .. code:: fortran - double precision function SABpartial(zA,zB,A,B,nA,nB,gamA,gamB,l) + subroutine shank(array,n,nmax,shank1) - Needs: + Called by: .. hlist:: :columns: 3 - * :c:data:`binom` - - -.. c:function:: set_order: - - - File : :file:`utils/sort.irp.f_template_347` - - .. code:: fortran - - subroutine set_order(x,iorder,isize) - - - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. + * :c:func:`shank_general` -.. c:function:: set_order_big: +.. c:function:: shank_function: - File : :file:`utils/sort.irp.f_template_412` + File : :file:`utils/shank.irp.f` .. code:: fortran - subroutine set_order_big(x,iorder,isize) + double precision function shank_function(array,i,n) - array A has already been sorted, and iorder has contains the new order of - elements of A. This subroutine changes the order of x to match the new order of A. - This is a version for very large arrays where the indices need - to be in integer*8 format -.. c:function:: sort: +.. c:function:: shank_general: - File : :file:`utils/sort.irp.f_template_293` + File : :file:`utils/shank.irp.f` .. code:: fortran - subroutine sort(x,iorder,isize) + double precision function shank_general(array,n,nmax) - Sort array x(isize). - iorder in input should be (1,2,3,...,isize), and in output - contains the new order of the elements. Calls: .. hlist:: :columns: 3 - * :c:func:`insertion_sort` - * :c:func:`quick_sort` + * :c:func:`shank` .. c:function:: sorted_dnumber: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_32` .. code:: fortran @@ -2839,7 +3898,7 @@ Subroutines / functions .. c:function:: sorted_i2number: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_32` .. code:: fortran @@ -2852,7 +3911,7 @@ Subroutines / functions .. c:function:: sorted_i8number: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_32` .. code:: fortran @@ -2865,7 +3924,7 @@ Subroutines / functions .. c:function:: sorted_inumber: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_32` .. code:: fortran @@ -2878,7 +3937,7 @@ Subroutines / functions .. c:function:: sorted_number: - File : :file:`utils/sort.irp.f_template_261` + File : :file:`utils/sort.irp.f_template_32` .. code:: fortran @@ -2888,6 +3947,30 @@ Subroutines / functions Returns the number of sorted elements +.. c:function:: sub_a_at: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + subroutine sub_A_At(A, N) + + + + +.. c:function:: sum_a_at: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + subroutine sum_A_At(A, N) + + + + .. c:function:: svd: @@ -2902,7 +3985,7 @@ Subroutines / functions LDx : leftmost dimension of x - Dimsneion of A is m x n + Dimension of A is m x n Called by: @@ -2910,10 +3993,15 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:func:`eigsvd` * :c:func:`mo_as_svd_vectors_of_mo_matrix` * :c:func:`mo_as_svd_vectors_of_mo_matrix_eig` + * :c:func:`mo_coef_new_as_svd_vectors_of_mo_matrix_eig` + * :c:data:`natorbsci` * :c:func:`ortho_canonical` * :c:func:`ortho_lowdin` + * :c:func:`ortho_svd` + * :c:func:`randomized_svd` * :c:data:`s_half` * :c:data:`s_half_inv` @@ -2925,6 +4013,67 @@ Subroutines / functions * :c:func:`dgesvd` +.. c:function:: svd_complex: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine svd_complex(A,LDA,U,LDU,D,Vt,LDVt,m,n) + + + Compute A = U.D.Vt + + LDx : leftmost dimension of x + + Dimension of A is m x n + A,U,Vt are complex*16 + D is double precision + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`ortho_canonical_complex` + * :c:func:`ortho_lowdin_complex` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zgesvd` + + +.. c:function:: svd_symm: + + + File : :file:`utils/linear_algebra.irp.f` + + .. code:: fortran + + subroutine svd_symm(A,LDA,U,LDU,D,Vt,LDVt,m,n) + + + Compute A = U.D.Vt + + LDx : leftmost dimension of x + + Dimension of A is m x n + + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`dgemm` + * :c:func:`dgesvd` + * :c:func:`restore_symmetry` + + .. c:function:: total_memory: @@ -2944,6 +4093,14 @@ Subroutines / functions * :c:func:`print_memory_usage` + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`lock_io` + * :c:func:`unlock_io` + .. c:function:: u_dot_u: @@ -2971,6 +4128,48 @@ Subroutines / functions Compute +.. c:function:: v2_over_x: + + + File : :file:`utils/util.irp.f` + + .. code:: fortran + + subroutine v2_over_x(v,x,res) + + + + +.. c:function:: v_phi: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + double precision function V_phi(n, m) + + + Computes the angular $\phi$ part of the nuclear attraction integral: + + $\int_{0}^{2 \pi} \cos(\phi)^n \sin(\phi)^m d\phi$. + + +.. c:function:: v_theta: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + double precision function V_theta(n, m) + + + Computes the angular $\theta$ part of the nuclear attraction integral: + + $\int_{0}^{\pi} \cos(\theta)^n \sin(\theta)^m d\theta$ + + .. c:function:: wall_time: @@ -2988,21 +4187,53 @@ Subroutines / functions .. hlist:: :columns: 3 + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:func:`add_integrals_to_map` * :c:func:`add_integrals_to_map_erf` - * :c:func:`add_integrals_to_map_no_exit_34` - * :c:func:`add_integrals_to_map_three_indices` * :c:data:`ao_pseudo_integrals_local` * :c:data:`ao_pseudo_integrals_non_local` * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` - * :c:func:`davidson_converged` - * :c:func:`davidson_diag_hjj_sjj` + * :c:func:`apply_mo_rotation` + * :c:data:`bielecci` + * :c:data:`bielecci_no` + * :c:data:`cholesky_ao_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_2_idx_transp` + * :c:data:`cholesky_no_total_transp` + * :c:data:`cholesky_semi_mo_transp_simple` + * :c:func:`diag_hessian_list_opt` + * :c:func:`diag_hessian_opt` + * :c:func:`diagonalization_hessian` + * :c:func:`first_diag_hessian_list_opt` + * :c:func:`first_diag_hessian_opt` + * :c:func:`first_hessian_list_opt` + * :c:func:`first_hessian_opt` + * :c:func:`gradient_list_opt` + * :c:func:`gradient_opt` + * :c:func:`hessian_list_opt` + * :c:func:`hessian_opt` + * :c:data:`mo_two_e_integrals_erf_in_map` + * :c:data:`mo_two_e_integrals_in_map` * :c:data:`output_wall_time_0` * :c:func:`pt2_collector` + * :c:func:`rotation_matrix` + * :c:func:`rotation_matrix_iterative` * :c:func:`run_pt2_slave_large` * :c:func:`run_pt2_slave_small` * :c:func:`run_slave_main` + * :c:data:`state_av_act_2_rdm_aa_mo` + * :c:data:`state_av_act_2_rdm_ab_mo` + * :c:data:`state_av_act_2_rdm_bb_mo` + * :c:data:`state_av_act_2_rdm_spin_trace_mo` + * :c:func:`trust_region_expected_e` + * :c:func:`trust_region_optimal_lambda` + * :c:func:`trust_region_step` * :c:func:`write_time` Calls: @@ -3013,6 +4244,21 @@ Subroutines / functions * :c:func:`system_clock` +.. c:function:: wallis: + + + File : :file:`utils/integration.irp.f` + + .. code:: fortran + + double precision function Wallis(n) + + + Wallis integral: + + $\int_{0}^{\pi} \cos(\theta)^n d\theta$. + + .. c:function:: write_git_log: @@ -3025,3 +4271,157 @@ Subroutines / functions Write the last git commit in file iunit. + +.. c:function:: zboysfun: + + + File : :file:`utils/cpx_boys.irp.f` + + .. code:: fortran + + subroutine zboysfun(n_max, x, vals) + + + + Computes values of the Boys function for n = 0, 1, ..., n_max + for a complex valued argument + + Input: x --- argument, complex*16, Re(x) >= 0 + Output: vals --- values of the Boys function, n = 0, 1, ..., n_max + + Beylkin & Sharma, J. Chem. Phys. 155, 174117 (2021) + https://doi.org/10.1063/5.0062444 + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`crint_2` + * :c:func:`crint_2_vec` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zboysfun00_2` + + +.. c:function:: zboysfun00_1: + + + File : :file:`utils/cpx_erf.irp.f` + + .. code:: fortran + + subroutine zboysfun00_1(rho, F0) + + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`crint_1` + * :c:func:`crint_1_vec` + + +.. c:function:: zboysfun00_2: + + + File : :file:`utils/cpx_erf.irp.f` + + .. code:: fortran + + subroutine zboysfun00_2(z, val) + + + + Computes values of the Boys function for n=0 + for a complex valued argument + + Input: z --- argument, complex*16, Real(z) >= 0 + Output: val --- value of the Boys function n=0 + + Beylkin & Sharma, J. Chem. Phys. 155, 174117 (2021) + https://doi.org/10.1063/5.0062444 + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`zboysfun` + + +.. c:function:: zboysfun00nrp: + + + File : :file:`utils/cpx_erf.irp.f` + + .. code:: fortran + + subroutine zboysfun00nrp(z, val) + + + + Computes values of the exp(z) F(0,z) + (where F(0,z) is the Boys function) + for a complex valued argument with Real(z)<=0 + + Input: z --- argument, complex*16, !!! Real(z)<=0 !!! + Output: val --- value of the function !!! exp(z) F(0,z) !!!, where F(0,z) is the Boys function + + Beylkin & Sharma, J. Chem. Phys. 155, 174117 (2021) + https://doi.org/10.1063/5.0062444 + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`zboysfunnrp` + + +.. c:function:: zboysfunnrp: + + + File : :file:`utils/cpx_boys.irp.f` + + .. code:: fortran + + subroutine zboysfunnrp(n_max, x, vals) + + + + Computes values of e^z F(n,z) for n = 0, 1, ..., n_max + (where F(n,z) are the Boys functions) + for a complex valued argument WITH NEGATIVE REAL PART + + Input: x --- argument, complex *16 Re(x)<=0 + Output: vals --- values of e^z F(n,z), n = 0, 1, ..., n_max + + Beylkin & Sharma, J. Chem. Phys. 155, 174117 (2021) + https://doi.org/10.1063/5.0062444 + + + Called by: + + .. hlist:: + :columns: 3 + + * :c:func:`crint_2` + * :c:func:`crint_2_vec` + + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`zboysfun00nrp` + diff --git a/docs/source/modules/zmq.rst b/docs/source/modules/zmq.rst index 18ffb853..3d88a245 100644 --- a/docs/source/modules/zmq.rst +++ b/docs/source/modules/zmq.rst @@ -381,6 +381,13 @@ Subroutines / functions * :c:data:`zmq_state` + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`sscanf_ssds` + .. c:function:: disconnect_from_taskserver: @@ -414,12 +421,12 @@ Subroutines / functions Disconnect from the task server - Needs: + Calls: .. hlist:: :columns: 3 - * :c:data:`zmq_state` + * :c:func:`sscanf_ss` .. c:function:: end_parallel_job: @@ -439,8 +446,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`zmq_context` + * :c:data:`zmq_state` Called by: @@ -450,6 +457,7 @@ Subroutines / functions * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` * :c:func:`h_s2_u_0_nstates_zmq` + * :c:func:`h_u_0_nstates_zmq` * :c:func:`zmq_pt2` * :c:func:`zmq_selection` @@ -555,6 +563,8 @@ Subroutines / functions * :c:func:`ao_two_e_integrals_erf_in_map_slave` * :c:func:`ao_two_e_integrals_in_map_slave` + * :c:func:`davidson_csf_run_slave` + * :c:func:`davidson_nos2_run_slave` * :c:func:`davidson_run_slave` * :c:func:`run_pt2_slave_large` * :c:func:`run_pt2_slave_small` @@ -627,6 +637,8 @@ Subroutines / functions * :c:func:`ao_two_e_integrals_erf_in_map_slave` * :c:func:`ao_two_e_integrals_in_map_collector` * :c:func:`ao_two_e_integrals_in_map_slave` + * :c:func:`davidson_csf_run_slave` + * :c:func:`davidson_nos2_run_slave` * :c:func:`davidson_run_slave` * :c:func:`end_parallel_job` * :c:func:`pt2_collector` @@ -655,6 +667,13 @@ Subroutines / functions * :c:data:`zmq_state` + Calls: + + .. hlist:: + :columns: 3 + + * :c:func:`sscanf_sd` + .. c:function:: get_tasks_from_taskserver: @@ -693,9 +712,9 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` - * :c:data:`zmq_socket_pull_tcp_address` * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` + * :c:data:`zmq_state` Called by: @@ -705,6 +724,7 @@ Subroutines / functions * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` * :c:func:`h_s2_u_0_nstates_zmq` + * :c:func:`h_u_0_nstates_zmq` * :c:func:`zmq_pt2` * :c:func:`zmq_selection` @@ -735,8 +755,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_socket_pull_tcp_address` * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` Calls: @@ -765,8 +785,8 @@ Subroutines / functions :columns: 3 * :c:data:`qp_run_address` - * :c:data:`zmq_socket_pull_tcp_address` * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` Calls: @@ -795,8 +815,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_socket_pull_tcp_address` * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` Calls: @@ -824,8 +844,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_socket_pull_tcp_address` * :c:data:`zmq_context` + * :c:data:`zmq_socket_pull_tcp_address` Calls: @@ -1185,8 +1205,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get8_ivector: @@ -1206,8 +1226,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get_dmatrix: @@ -1227,8 +1247,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get_dvector: @@ -1248,8 +1268,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get_i8matrix: @@ -1269,8 +1289,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get_imatrix: @@ -1290,8 +1310,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get_int: @@ -1311,8 +1331,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_get_int_nompi: @@ -1352,8 +1372,8 @@ Subroutines / functions .. hlist:: :columns: 3 - * :c:data:`zmq_state` * :c:data:`mpi_master` + * :c:data:`zmq_state` .. c:function:: zmq_port: diff --git a/docs/source/programmers_guide/index_providers.rst b/docs/source/programmers_guide/index_providers.rst index c6fd0147..5596f1c4 100644 --- a/docs/source/programmers_guide/index_providers.rst +++ b/docs/source/programmers_guide/index_providers.rst @@ -5,21 +5,51 @@ Index of Providers * :c:data:`abs_psi_coef_max` * :c:data:`abs_psi_coef_min` + * :c:data:`absolute_eig` + * :c:data:`act_2_rdm_aa_mo` + * :c:data:`act_2_rdm_ab_mo` + * :c:data:`act_2_rdm_bb_mo` + * :c:data:`act_2_rdm_spin_trace_mo` + * :c:data:`act_2_rdm_trans_spin_trace_mo` * :c:data:`act_bitmask` + * :c:data:`act_mos_in_r_array` + * :c:data:`act_mos_in_r_array_transp` + * :c:data:`act_mos_opt` + * :c:data:`adaptive_pt2_max` + * :c:data:`aijpqcontainer` + * :c:data:`aijpqmatrixdimslist` + * :c:data:`all_shells_closed` + * :c:data:`alpha_dens_kin_in_r` * :c:data:`alpha_knowles` * :c:data:`angular_quadrature_points` + * :c:data:`angular_quadrature_points_extra` + * :c:data:`ao_2e_cgtos_schwartz` + * :c:data:`ao_2e_cosgtos_schwartz` + * :c:data:`ao_abs_int_grid` * :c:data:`ao_cart_to_sphe_coef` * :c:data:`ao_cart_to_sphe_inv` * :c:data:`ao_cart_to_sphe_num` * :c:data:`ao_cart_to_sphe_overlap` * :c:data:`ao_cartesian` + * :c:data:`ao_cholesky_threshold` * :c:data:`ao_coef` + * :c:data:`ao_coef_cgtos_norm_ord_transp` + * :c:data:`ao_coef_norm_cgtos` + * :c:data:`ao_coef_norm_cgtos_ord` + * :c:data:`ao_coef_norm_cosgtos` + * :c:data:`ao_coef_norm_ord_cosgtos` + * :c:data:`ao_coef_norm_ord_transp_cosgtos` * :c:data:`ao_coef_normalization_factor` - * :c:data:`ao_coef_normalization_libint_factor` * :c:data:`ao_coef_normalized` * :c:data:`ao_coef_normalized_ordered` * :c:data:`ao_coef_normalized_ordered_transp` * :c:data:`ao_coef_normalized_ordered_transp_per_nucl` + * :c:data:`ao_deriv2_cgtos_x` + * :c:data:`ao_deriv2_cgtos_y` + * :c:data:`ao_deriv2_cgtos_z` + * :c:data:`ao_deriv2_cosgtos_x` + * :c:data:`ao_deriv2_cosgtos_y` + * :c:data:`ao_deriv2_cosgtos_z` * :c:data:`ao_deriv2_x` * :c:data:`ao_deriv2_y` * :c:data:`ao_deriv2_z` @@ -30,32 +60,59 @@ Index of Providers * :c:data:`ao_dipole_y` * :c:data:`ao_dipole_z` * :c:data:`ao_effective_one_e_potential` + * :c:data:`ao_effective_one_e_potential_sa` * :c:data:`ao_effective_one_e_potential_without_kin` + * :c:data:`ao_effective_one_e_potential_without_kin_sa` * :c:data:`ao_expo` + * :c:data:`ao_expo_cgtos_ord` + * :c:data:`ao_expo_cgtos_ord_transp` + * :c:data:`ao_expo_im` + * :c:data:`ao_expo_ord_cosgtos` + * :c:data:`ao_expo_ord_transp_cosgtos` * :c:data:`ao_expo_ordered` * :c:data:`ao_expo_ordered_transp` * :c:data:`ao_expo_ordered_transp_per_nucl` + * :c:data:`ao_expo_phase` + * :c:data:`ao_expo_phase_ord` + * :c:data:`ao_expo_phase_ord_transp` + * :c:data:`ao_expo_pw` + * :c:data:`ao_expo_pw_ord` + * :c:data:`ao_expo_pw_ord_transp` + * :c:data:`ao_expoim_cosgtos` + * :c:data:`ao_first_of_shell` * :c:data:`ao_integrals_cache` * :c:data:`ao_integrals_cache_max` * :c:data:`ao_integrals_cache_min` + * :c:data:`ao_integrals_cache_periodic` * :c:data:`ao_integrals_erf_cache` * :c:data:`ao_integrals_erf_cache_max` * :c:data:`ao_integrals_erf_cache_min` * :c:data:`ao_integrals_erf_map` * :c:data:`ao_integrals_map` * :c:data:`ao_integrals_n_e` + * :c:data:`ao_integrals_n_e_cgtos` + * :c:data:`ao_integrals_n_e_cosgtos` + * :c:data:`ao_integrals_n_e_imag` * :c:data:`ao_integrals_n_e_per_atom` + * :c:data:`ao_integrals_pt_chrg` * :c:data:`ao_integrals_threshold` * :c:data:`ao_kinetic_integrals` + * :c:data:`ao_kinetic_integrals_cgtos` + * :c:data:`ao_kinetic_integrals_cosgtos` + * :c:data:`ao_kinetic_integrals_imag` * :c:data:`ao_l` * :c:data:`ao_l_char` * :c:data:`ao_l_char_space` * :c:data:`ao_l_max` * :c:data:`ao_md5` + * :c:data:`ao_normalized` * :c:data:`ao_nucl` * :c:data:`ao_num` * :c:data:`ao_one_e_integrals` * :c:data:`ao_one_e_integrals_diag` + * :c:data:`ao_one_e_integrals_from_mo` + * :c:data:`ao_one_e_integrals_imag` + * :c:data:`ao_one_e_integrals_threshold` * :c:data:`ao_ortho_canonical_coef` * :c:data:`ao_ortho_canonical_coef_inv` * :c:data:`ao_ortho_canonical_nucl_elec_integrals` @@ -66,6 +123,17 @@ Index of Providers * :c:data:`ao_ortho_lowdin_overlap` * :c:data:`ao_overlap` * :c:data:`ao_overlap_abs` + * :c:data:`ao_overlap_abs_grid` + * :c:data:`ao_overlap_cgtos` + * :c:data:`ao_overlap_cgtos_x` + * :c:data:`ao_overlap_cgtos_y` + * :c:data:`ao_overlap_cgtos_z` + * :c:data:`ao_overlap_complex` + * :c:data:`ao_overlap_cosgtos` + * :c:data:`ao_overlap_cosgtos_x` + * :c:data:`ao_overlap_cosgtos_y` + * :c:data:`ao_overlap_cosgtos_z` + * :c:data:`ao_overlap_imag` * :c:data:`ao_overlap_x` * :c:data:`ao_overlap_y` * :c:data:`ao_overlap_z` @@ -75,64 +143,93 @@ Index of Providers * :c:data:`ao_power_ordered_transp_per_nucl` * :c:data:`ao_prim_num` * :c:data:`ao_prim_num_max` + * :c:data:`ao_prod_abs_r` + * :c:data:`ao_prod_center` + * :c:data:`ao_prod_dist_grid` + * :c:data:`ao_prod_sigma` * :c:data:`ao_pseudo_integrals` * :c:data:`ao_pseudo_integrals_local` * :c:data:`ao_pseudo_integrals_non_local` + * :c:data:`ao_shell` * :c:data:`ao_spread_x` * :c:data:`ao_spread_y` * :c:data:`ao_spread_z` * :c:data:`ao_two_e_integral_alpha` + * :c:data:`ao_two_e_integral_alpha_chol` * :c:data:`ao_two_e_integral_beta` + * :c:data:`ao_two_e_integral_beta_chol` * :c:data:`ao_two_e_integral_erf_schwartz` * :c:data:`ao_two_e_integral_schwartz` * :c:data:`ao_two_e_integrals_erf_in_map` * :c:data:`ao_two_e_integrals_in_map` - * :c:data:`aos_dsr_vc_alpha_pbe_w` - * :c:data:`aos_dsr_vc_beta_pbe_w` - * :c:data:`aos_dsr_vx_alpha_pbe_w` - * :c:data:`aos_dsr_vx_beta_pbe_w` - * :c:data:`aos_dsr_vxc_alpha_pbe_w` - * :c:data:`aos_dsr_vxc_beta_pbe_w` - * :c:data:`aos_dvc_alpha_pbe_w` - * :c:data:`aos_dvc_beta_pbe_w` - * :c:data:`aos_dvx_alpha_pbe_w` - * :c:data:`aos_dvx_beta_pbe_w` - * :c:data:`aos_dvxc_alpha_pbe_w` - * :c:data:`aos_dvxc_beta_pbe_w` + * :c:data:`aos_d_vc_alpha_pbe_w` + * :c:data:`aos_d_vc_alpha_sr_pbe_w` + * :c:data:`aos_d_vc_beta_pbe_w` + * :c:data:`aos_d_vc_beta_sr_pbe_w` + * :c:data:`aos_d_vx_alpha_pbe_w` + * :c:data:`aos_d_vx_alpha_sr_pbe_w` + * :c:data:`aos_d_vx_beta_pbe_w` + * :c:data:`aos_d_vx_beta_sr_pbe_w` + * :c:data:`aos_d_vxc_alpha_pbe_w` + * :c:data:`aos_d_vxc_alpha_sr_pbe_w` + * :c:data:`aos_d_vxc_beta_pbe_w` + * :c:data:`aos_d_vxc_beta_sr_pbe_w` * :c:data:`aos_grad_in_r_array` + * :c:data:`aos_grad_in_r_array_extra` * :c:data:`aos_grad_in_r_array_transp` - * :c:data:`aos_grad_in_r_array_transp_xyz` + * :c:data:`aos_grad_in_r_array_transp_3` + * :c:data:`aos_grad_in_r_array_transp_bis` * :c:data:`aos_in_r_array` - * :c:data:`aos_in_r_array_per_atom` - * :c:data:`aos_in_r_array_per_atom_transp` + * :c:data:`aos_in_r_array_extra` + * :c:data:`aos_in_r_array_extra_transp` * :c:data:`aos_in_r_array_transp` * :c:data:`aos_lapl_in_r_array` * :c:data:`aos_lapl_in_r_array_transp` * :c:data:`aos_sr_vc_alpha_lda_w` - * :c:data:`aos_sr_vc_alpha_pbe_w` * :c:data:`aos_sr_vc_beta_lda_w` - * :c:data:`aos_sr_vc_beta_pbe_w` * :c:data:`aos_sr_vx_alpha_lda_w` - * :c:data:`aos_sr_vx_alpha_pbe_w` * :c:data:`aos_sr_vx_beta_lda_w` - * :c:data:`aos_sr_vx_beta_pbe_w` * :c:data:`aos_sr_vxc_alpha_lda_w` - * :c:data:`aos_sr_vxc_alpha_pbe_w` * :c:data:`aos_sr_vxc_beta_lda_w` - * :c:data:`aos_sr_vxc_beta_pbe_w` * :c:data:`aos_vc_alpha_lda_w` * :c:data:`aos_vc_alpha_pbe_w` + * :c:data:`aos_vc_alpha_sr_pbe_w` * :c:data:`aos_vc_beta_lda_w` * :c:data:`aos_vc_beta_pbe_w` + * :c:data:`aos_vc_beta_sr_pbe_w` * :c:data:`aos_vx_alpha_lda_w` * :c:data:`aos_vx_alpha_pbe_w` + * :c:data:`aos_vx_alpha_sr_pbe_w` * :c:data:`aos_vx_beta_lda_w` * :c:data:`aos_vx_beta_pbe_w` + * :c:data:`aos_vx_beta_sr_pbe_w` * :c:data:`aos_vxc_alpha_lda_w` * :c:data:`aos_vxc_alpha_pbe_w` + * :c:data:`aos_vxc_alpha_sr_pbe_w` * :c:data:`aos_vxc_beta_lda_w` * :c:data:`aos_vxc_beta_pbe_w` + * :c:data:`aos_vxc_beta_sr_pbe_w` + * :c:data:`attachment_numbers_sorted` + * :c:data:`attachment_orbitals` + * :c:data:`au_to_d` + * :c:data:`average_on_top` + * :c:data:`avoid_saddle` + * :c:data:`backend` + * :c:data:`banned_excitation` * :c:data:`barycentric_electronic_energy` + * :c:data:`basis` + * :c:data:`basis_mos_in_r_array` + * :c:data:`basis_nucleus_index` + * :c:data:`bavard` + * :c:data:`best_overlap_casscf` + * :c:data:`best_vector_ovrlp_casscf` + * :c:data:`beta_dens_kin_in_r` + * :c:data:`bielec_pqxx_array` + * :c:data:`bielec_pqxx_no_array` + * :c:data:`bielec_pxxq_array` + * :c:data:`bielec_pxxq_no_array` + * :c:data:`bielecci` + * :c:data:`bielecci_no` * :c:data:`big_array_coulomb_integrals` * :c:data:`big_array_exchange_integrals` * :c:data:`binom` @@ -140,6 +237,10 @@ Index of Providers * :c:data:`binom_int_transp` * :c:data:`binom_transp` * :c:data:`c0_weight` + * :c:data:`calc_dipole_moment` + * :c:data:`calc_energy_components` + * :c:data:`calc_osc_str` + * :c:data:`calc_tr_dipole_moment` * :c:data:`cart_to_sphe_0` * :c:data:`cart_to_sphe_1` * :c:data:`cart_to_sphe_2` @@ -150,23 +251,48 @@ Index of Providers * :c:data:`cart_to_sphe_7` * :c:data:`cart_to_sphe_8` * :c:data:`cart_to_sphe_9` - * :c:data:`cas_bitmask` * :c:data:`center_of_mass` + * :c:data:`cfg_nsomo_max` + * :c:data:`cfg_seniority_index` + * :c:data:`cholesky_ao` + * :c:data:`cholesky_ao_num` + * :c:data:`cholesky_ao_transp` + * :c:data:`cholesky_mo` + * :c:data:`cholesky_mo_num` + * :c:data:`cholesky_mo_transp` + * :c:data:`cholesky_no_1_idx_transp` + * :c:data:`cholesky_no_2_idx_transp` + * :c:data:`cholesky_no_total_transp` + * :c:data:`cholesky_semi_mo_transp_simple` * :c:data:`ci_eigenvectors` * :c:data:`ci_electronic_energy` * :c:data:`ci_energy` + * :c:data:`ci_energy_no_diag` * :c:data:`ci_s2` * :c:data:`closed_shell_ref_bitmask` * :c:data:`coef_hf_selector` + * :c:data:`colsmax` * :c:data:`core_bitmask` + * :c:data:`core_density` * :c:data:`core_energy` * :c:data:`core_energy_erf` * :c:data:`core_fock_operator` * :c:data:`core_fock_operator_erf` * :c:data:`core_inact_act_bitmask_4` + * :c:data:`core_inact_act_mos_grad_in_r_array` + * :c:data:`core_inact_act_mos_in_r_array` + * :c:data:`core_inact_act_mos_in_r_array_transp` + * :c:data:`core_inact_act_v_kl_contracted` * :c:data:`core_inact_virt_bitmask` + * :c:data:`core_mos_in_r_array` + * :c:data:`core_mos_in_r_array_transp` * :c:data:`correlation_energy_ratio_max` * :c:data:`correlation_functional` + * :c:data:`criterion_casscf` + * :c:data:`csf_based` + * :c:data:`d0tu` + * :c:data:`d0tu_alpha_ao` + * :c:data:`d0tu_beta_ao` * :c:data:`damping_for_rs_dft` * :c:data:`data_energy_proj` * :c:data:`data_energy_var` @@ -174,7 +300,6 @@ Index of Providers * :c:data:`data_one_e_dm_alpha_mo` * :c:data:`data_one_e_dm_beta_ao` * :c:data:`data_one_e_dm_beta_mo` - * :c:data:`davidson_criterion` * :c:data:`davidson_sze_max` * :c:data:`degree_max_generators` * :c:data:`degree_max_integration_lebedev` @@ -183,37 +308,64 @@ Index of Providers * :c:data:`density_for_dft` * :c:data:`det_alpha_norm` * :c:data:`det_beta_norm` - * :c:data:`det_to_occ_pattern` + * :c:data:`det_to_configuration` + * :c:data:`dettachment_numbers_sorted` + * :c:data:`dettachment_orbitals` + * :c:data:`dettocsftransformationmatrix` * :c:data:`dft_type` * :c:data:`diag_algorithm` + * :c:data:`diag_hess_cas` * :c:data:`diagonal_h_matrix_on_psi_det` + * :c:data:`difference_dm` + * :c:data:`difference_dm_eigval` + * :c:data:`difference_dm_eigvect` * :c:data:`dim_list_act_orb` + * :c:data:`dim_list_core_inact_orb` * :c:data:`dim_list_core_orb` * :c:data:`dim_list_del_orb` * :c:data:`dim_list_inact_orb` * :c:data:`dim_list_virt_orb` - * :c:data:`disk_access_nuclear_repulsion` + * :c:data:`dim_n_max_overlap` * :c:data:`disk_based_davidson` * :c:data:`distributed_davidson` + * :c:data:`do_ao_cholesky` * :c:data:`do_ddci` * :c:data:`do_direct_integrals` + * :c:data:`do_mo_cholesky` + * :c:data:`do_mom` * :c:data:`do_only_1h1p` + * :c:data:`do_only_cas` + * :c:data:`do_ormas` * :c:data:`do_pseudo` * :c:data:`do_pt2` + * :c:data:`do_signed_mono_excitation` + * :c:data:`do_spinfree_mono_excitation` + * :c:data:`dominant_cfg` + * :c:data:`dominant_det` + * :c:data:`dominant_dets_of_cfgs` * :c:data:`double_exc_bitmask` * :c:data:`double_index_selectors` + * :c:data:`dr_radial_extra_integral` * :c:data:`dr_radial_integral` * :c:data:`dressed_column_idx` * :c:data:`dressing_column_h` * :c:data:`dressing_column_s` + * :c:data:`dressing_delta` * :c:data:`dtranspose` * :c:data:`e_corr_double_only` * :c:data:`e_corr_per_selectors` * :c:data:`e_corr_second_order` * :c:data:`e_correlation_dft` * :c:data:`e_exchange_dft` + * :c:data:`ecore` + * :c:data:`ecore_bis` + * :c:data:`effective_alpha_dm` + * :c:data:`effective_beta_dm` * :c:data:`effective_one_e_potential` + * :c:data:`effective_one_e_potential_sa` * :c:data:`effective_one_e_potential_without_kin` + * :c:data:`effective_one_e_potential_without_kin_sa` + * :c:data:`effective_spin_dm` * :c:data:`eigenvalues_fock_matrix_ao` * :c:data:`eigenvectors_fock_matrix_ao` * :c:data:`eigenvectors_fock_matrix_mo` @@ -222,6 +374,7 @@ Index of Providers * :c:data:`elec_beta_num` * :c:data:`elec_beta_num_grid_becke` * :c:data:`elec_num` + * :c:data:`elec_num_grid_becke` * :c:data:`elec_num_tab` * :c:data:`element_mass` * :c:data:`element_name` @@ -231,32 +384,65 @@ Index of Providers * :c:data:`energy_c_pbe` * :c:data:`energy_c_sr_lda` * :c:data:`energy_c_sr_pbe` + * :c:data:`energy_improvement` * :c:data:`energy_iterations` - * :c:data:`energy_sr_c_lda` - * :c:data:`energy_sr_c_pbe` - * :c:data:`energy_sr_x_lda` - * :c:data:`energy_sr_x_pbe` * :c:data:`energy_x` * :c:data:`energy_x_lda` * :c:data:`energy_x_none` * :c:data:`energy_x_pbe` * :c:data:`energy_x_sr_lda` * :c:data:`energy_x_sr_pbe` + * :c:data:`eone` + * :c:data:`eone_bis` + * :c:data:`etwo` + * :c:data:`etwo_bis` + * :c:data:`etwo_ter` * :c:data:`exc_degree_per_selectors` * :c:data:`exchange_functional` + * :c:data:`excit` + * :c:data:`excit_class` + * :c:data:`excitation_alpha_max` + * :c:data:`excitation_beta_max` + * :c:data:`excitation_max` + * :c:data:`excitation_ref` * :c:data:`expected_s2` + * :c:data:`export_ao_one_e_ints` + * :c:data:`export_ao_two_e_ints` + * :c:data:`export_ao_two_e_ints_cholesky` + * :c:data:`export_basis` + * :c:data:`export_mo_one_e_ints` + * :c:data:`export_mo_two_e_ints` + * :c:data:`export_mo_two_e_ints_cholesky` + * :c:data:`export_mos` + * :c:data:`export_rdm` * :c:data:`extra_e_contrib_density` + * :c:data:`extra_grid_type_sgn` + * :c:data:`extra_rad_grid_type` * :c:data:`extrapolate_fock_matrix` * :c:data:`extrapolated_energy` * :c:data:`ezfio_filename` * :c:data:`ezfio_work_dir` + * :c:data:`ezfio_work_dir_pid` + * :c:data:`f_hf_cholesky` + * :c:data:`f_hf_cholesky_sparse` + * :c:data:`f_hf_cholesky_sparse_bis` + * :c:data:`f_psi_cas_ab` + * :c:data:`f_psi_cas_ab_old` + * :c:data:`f_psi_hf_ab` * :c:data:`fact_inv` + * :c:data:`fapq` + * :c:data:`fast_2rdm` * :c:data:`file_lock` * :c:data:`final_grid_points` + * :c:data:`final_grid_points_extra` * :c:data:`final_grid_points_per_atom` + * :c:data:`final_grid_points_transp` * :c:data:`final_weight_at_r` + * :c:data:`final_weight_at_r_extra` * :c:data:`final_weight_at_r_vector` + * :c:data:`final_weight_at_r_vector_extra` * :c:data:`final_weight_at_r_vector_per_atom` + * :c:data:`fipq` * :c:data:`fock_matrix_alpha_no_xc_ao` * :c:data:`fock_matrix_ao` * :c:data:`fock_matrix_ao_alpha` @@ -274,54 +460,101 @@ Index of Providers * :c:data:`frozen_orb_scf` * :c:data:`full_ijkl_bitmask` * :c:data:`full_ijkl_bitmask_4` + * :c:data:`full_occ_2_rdm_aa_mo` + * :c:data:`full_occ_2_rdm_ab_mo` + * :c:data:`full_occ_2_rdm_bb_mo` + * :c:data:`full_occ_2_rdm_cntrctd` + * :c:data:`full_occ_2_rdm_cntrctd_trans` + * :c:data:`full_occ_2_rdm_spin_trace_mo` + * :c:data:`full_occ_v_kl_cntrctd` * :c:data:`gauleg_t2` * :c:data:`gauleg_w` * :c:data:`general_primitive_integral` + * :c:data:`general_primitive_integral_cgtos` + * :c:data:`general_primitive_integral_cosgtos` * :c:data:`general_primitive_integral_erf` * :c:data:`generators_bitmask` - * :c:data:`generators_bitmask_restart` * :c:data:`gga_sr_type_functionals` - * :c:data:`gga_type_functionals` - * :c:data:`give_polynomial_mult_center_one_e_erf` - * :c:data:`give_polynomial_mult_center_one_e_erf_opt` + * :c:data:`give_cpolynom_mult_center_x` + * :c:data:`give_cpolynomial_mult_center_one_e` + * :c:data:`give_explicit_cpoly_and_cgaussian` + * :c:data:`give_explicit_cpoly_and_cgaussian_x` * :c:data:`global_selection_buffer` * :c:data:`global_selection_buffer_lock` + * :c:data:`grad_effective_alpha_dm` + * :c:data:`grad_effective_beta_dm` + * :c:data:`grad_effective_spin_dm` + * :c:data:`grad_total_cas_on_top_density` + * :c:data:`gradvec2` + * :c:data:`gradvec_old` * :c:data:`grid_atomic_number` + * :c:data:`grid_points_extra_per_atom` + * :c:data:`grid_points_extra_radial` * :c:data:`grid_points_per_atom` * :c:data:`grid_points_radial` * :c:data:`grid_type_sgn` * :c:data:`h0_type` * :c:data:`h_apply_buffer_allocated` * :c:data:`h_apply_buffer_lock` + * :c:data:`h_core_ri` * :c:data:`h_matrix_all_dets` * :c:data:`h_matrix_cas` + * :c:data:`h_matrix_diag_all_dets` + * :c:data:`ha_to_ev` + * :c:data:`ha_to_j` + * :c:data:`ha_to_nm` + * :c:data:`hess_cv_cv` + * :c:data:`hessdiag` + * :c:data:`hessmat` + * :c:data:`hessmat_old` + * :c:data:`hessmat_peter` * :c:data:`hf_bitmask` * :c:data:`hf_energy` * :c:data:`hf_exchange` + * :c:data:`hf_kinetic_energy` + * :c:data:`hf_n_e_energy` * :c:data:`hf_one_electron_energy` * :c:data:`hf_two_electron_energy` - * :c:data:`i2radix_sort` - * :c:data:`i8radix_sort` - * :c:data:`i8radix_sort_big` - * :c:data:`i_bitmask_gen` * :c:data:`i_h_hf_per_selectors` * :c:data:`i_x1_new` + * :c:data:`i_x1_new_cgtos` + * :c:data:`i_x1_new_cosgtos` * :c:data:`i_x1_pol_mult_a1` + * :c:data:`i_x1_pol_mult_a1_cgtos` + * :c:data:`i_x1_pol_mult_a1_cosgtos` * :c:data:`i_x1_pol_mult_a2` + * :c:data:`i_x1_pol_mult_a2_cgtos` + * :c:data:`i_x1_pol_mult_a2_cosgtos` * :c:data:`i_x1_pol_mult_one_e` + * :c:data:`i_x1_pol_mult_one_e_cgtos` + * :c:data:`i_x1_pol_mult_one_e_cosgtos` * :c:data:`i_x1_pol_mult_recurs` + * :c:data:`i_x1_pol_mult_recurs_cgtos` + * :c:data:`i_x1_pol_mult_recurs_cosgtos` * :c:data:`i_x2_new` + * :c:data:`i_x2_new_cgtos` + * :c:data:`i_x2_new_cosgtos` * :c:data:`i_x2_pol_mult` + * :c:data:`i_x2_pol_mult_cgtos` + * :c:data:`i_x2_pol_mult_cosgtos` * :c:data:`i_x2_pol_mult_one_e` + * :c:data:`i_x2_pol_mult_one_e_cgtos` + * :c:data:`i_x2_pol_mult_one_e_cosgtos` * :c:data:`idx_cas` * :c:data:`idx_non_cas` * :c:data:`inact_bitmask` + * :c:data:`inact_density` + * :c:data:`inact_mos_in_r_array` + * :c:data:`inact_mos_in_r_array_transp` * :c:data:`inact_virt_bitmask` * :c:data:`index_final_points` + * :c:data:`index_final_points_extra` + * :c:data:`index_final_points_extra_reverse` * :c:data:`index_final_points_per_atom` * :c:data:`index_final_points_per_atom_reverse` * :c:data:`index_final_points_reverse` * :c:data:`index_holes_bitmask` + * :c:data:`index_orb_swap` * :c:data:`index_particl_bitmask` * :c:data:`inertia_tensor` * :c:data:`inertia_tensor_eigenvalues` @@ -334,56 +567,124 @@ Index of Providers * :c:data:`inv_int` * :c:data:`inv_selectors_coef_hf` * :c:data:`inv_selectors_coef_hf_squared` - * :c:data:`io_ao_integrals_e_n` + * :c:data:`io_ao_cholesky` * :c:data:`io_ao_integrals_kinetic` + * :c:data:`io_ao_integrals_n_e` * :c:data:`io_ao_integrals_overlap` * :c:data:`io_ao_integrals_pseudo` * :c:data:`io_ao_one_e_integrals` * :c:data:`io_ao_two_e_integrals` * :c:data:`io_ao_two_e_integrals_erf` - * :c:data:`io_mo_integrals_e_n` + * :c:data:`io_mo_cholesky` * :c:data:`io_mo_integrals_kinetic` + * :c:data:`io_mo_integrals_n_e` * :c:data:`io_mo_integrals_pseudo` * :c:data:`io_mo_one_e_integrals` * :c:data:`io_mo_two_e_integrals` * :c:data:`io_mo_two_e_integrals_erf` - * :c:data:`iradix_sort` - * :c:data:`iradix_sort_big` + * :c:data:`io_mu_of_r` + * :c:data:`io_nuclear_repulsion` + * :c:data:`io_two_body_rdm_aa` + * :c:data:`io_two_body_rdm_ab` + * :c:data:`io_two_body_rdm_bb` + * :c:data:`io_two_body_rdm_spin_trace` + * :c:data:`is_periodic` * :c:data:`is_zmq_slave` + * :c:data:`json_array_close_fmt` + * :c:data:`json_array_close_fmtx` + * :c:data:`json_array_close_uopen_fmt` + * :c:data:`json_array_open_fmt` + * :c:data:`json_array_uopen_fmt` + * :c:data:`json_dict_close_fmt` + * :c:data:`json_dict_close_fmtx` + * :c:data:`json_dict_close_uopen_fmt` + * :c:data:`json_dict_open_fmt` + * :c:data:`json_dict_uopen_fmt` + * :c:data:`json_false_fmt` + * :c:data:`json_false_fmtx` + * :c:data:`json_filename` + * :c:data:`json_int_fmt` + * :c:data:`json_int_fmtx` + * :c:data:`json_real_fmt` + * :c:data:`json_real_fmtx` + * :c:data:`json_str_fmt` + * :c:data:`json_str_fmtx` + * :c:data:`json_true_fmt` + * :c:data:`json_true_fmtx` + * :c:data:`json_unit` + * :c:data:`kinetic_density_generalized` * :c:data:`ks_energy` * :c:data:`l_to_character` + * :c:data:`lccsd_coef` + * :c:data:`lccsd_energies` * :c:data:`level_shift` + * :c:data:`level_shift_casscf` + * :c:data:`light_speed` + * :c:data:`lin_dep_cutoff` * :c:data:`list_act` * :c:data:`list_act_reverse` + * :c:data:`list_all_but_del_orb` + * :c:data:`list_attachment` + * :c:data:`list_basis` * :c:data:`list_core` + * :c:data:`list_core_inact` * :c:data:`list_core_inact_act` * :c:data:`list_core_inact_act_reverse` + * :c:data:`list_core_inact_reverse` * :c:data:`list_core_reverse` + * :c:data:`list_couple_hf_orb_r1` + * :c:data:`list_couple_hf_orb_r2` * :c:data:`list_del` * :c:data:`list_del_reverse` + * :c:data:`list_dettachment` + * :c:data:`list_idx_a_v` + * :c:data:`list_idx_c_a` + * :c:data:`list_idx_c_v` * :c:data:`list_inact` * :c:data:`list_inact_act` + * :c:data:`list_inact_act_reverse` * :c:data:`list_inact_reverse` + * :c:data:`list_valence_orb_for_hf` * :c:data:`list_virt` * :c:data:`list_virt_reverse` + * :c:data:`lowest_super_ci_coef_mo` * :c:data:`m_knowles` + * :c:data:`mat_idx_a_v` + * :c:data:`mat_idx_c_a` + * :c:data:`mat_idx_c_v` + * :c:data:`mat_tmp_dm_super_ci` * :c:data:`max_degree_exc` * :c:data:`max_dim_diis` * :c:data:`max_exc_pert` + * :c:data:`max_overlap` + * :c:data:`maxdetdimperbf` + * :c:data:`mcscf_fock_alpha_ao` + * :c:data:`mcscf_fock_alpha_mo` + * :c:data:`mcscf_fock_beta_ao` + * :c:data:`mcscf_fock_beta_mo` + * :c:data:`mcscf_fock_diag_mo` + * :c:data:`mcscf_fock_mo` * :c:data:`mo_class` * :c:data:`mo_coef` + * :c:data:`mo_coef_aux` * :c:data:`mo_coef_begin_iteration` + * :c:data:`mo_coef_imag` * :c:data:`mo_coef_in_ao_ortho_basis` * :c:data:`mo_coef_transp` + * :c:data:`mo_deriv_1_x` + * :c:data:`mo_deriv_1_y` + * :c:data:`mo_deriv_1_z` * :c:data:`mo_dipole_x` * :c:data:`mo_dipole_y` * :c:data:`mo_dipole_z` + * :c:data:`mo_grad_ints` + * :c:data:`mo_grad_ints_transp` * :c:data:`mo_guess_type` * :c:data:`mo_integrals_cache` * :c:data:`mo_integrals_cache_max` - * :c:data:`mo_integrals_cache_max_8` * :c:data:`mo_integrals_cache_min` - * :c:data:`mo_integrals_cache_min_8` + * :c:data:`mo_integrals_cache_shift` + * :c:data:`mo_integrals_cache_size` * :c:data:`mo_integrals_erf_cache` * :c:data:`mo_integrals_erf_cache_max` * :c:data:`mo_integrals_erf_cache_min` @@ -399,6 +700,11 @@ Index of Providers * :c:data:`mo_one_e_integrals` * :c:data:`mo_overlap` * :c:data:`mo_pseudo_integrals` + * :c:data:`mo_pseudo_integrals_local` + * :c:data:`mo_pseudo_integrals_non_local` + * :c:data:`mo_spread_centered_x` + * :c:data:`mo_spread_centered_y` + * :c:data:`mo_spread_centered_z` * :c:data:`mo_spread_x` * :c:data:`mo_spread_y` * :c:data:`mo_spread_z` @@ -408,58 +714,110 @@ Index of Providers * :c:data:`mo_two_e_int_erf_jj_exchange` * :c:data:`mo_two_e_int_erf_jj_exchange_from_ao` * :c:data:`mo_two_e_int_erf_jj_from_ao` - * :c:data:`mo_two_e_integral_jj_from_ao` * :c:data:`mo_two_e_integrals_erf_in_map` * :c:data:`mo_two_e_integrals_in_map` * :c:data:`mo_two_e_integrals_jj` * :c:data:`mo_two_e_integrals_jj_anti` - * :c:data:`mo_two_e_integrals_jj_anti_from_ao` * :c:data:`mo_two_e_integrals_jj_exchange` - * :c:data:`mo_two_e_integrals_jj_exchange_from_ao` - * :c:data:`mo_two_e_integrals_vv_anti_from_ao` - * :c:data:`mo_two_e_integrals_vv_exchange_from_ao` - * :c:data:`mo_two_e_integrals_vv_from_ao` * :c:data:`mos_grad_in_r_array` + * :c:data:`mos_grad_in_r_array_tranp` + * :c:data:`mos_grad_in_r_array_transp_3` + * :c:data:`mos_grad_in_r_array_transp_bis` * :c:data:`mos_in_r_array` + * :c:data:`mos_in_r_array_omp` * :c:data:`mos_in_r_array_transp` * :c:data:`mos_lapl_in_r_array` + * :c:data:`mos_lapl_in_r_array_tranp` + * :c:data:`mos_times_cholesky_r1` + * :c:data:`mos_times_cholesky_r2` * :c:data:`mpi_bit_kind` * :c:data:`mpi_initialized` * :c:data:`mpi_master` * :c:data:`mpi_rank` * :c:data:`mpi_size` + * :c:data:`mu_average_prov` + * :c:data:`mu_dft_type` * :c:data:`mu_erf` * :c:data:`mu_erf_dft` + * :c:data:`mu_grad_rho` + * :c:data:`mu_of_r_dft` + * :c:data:`mu_of_r_dft_average` + * :c:data:`mu_of_r_hf` + * :c:data:`mu_of_r_hf_old` + * :c:data:`mu_of_r_hf_sparse` + * :c:data:`mu_of_r_potential` + * :c:data:`mu_of_r_prov` + * :c:data:`mu_of_r_psi_cas` + * :c:data:`mu_rsc_of_r` + * :c:data:`multi_s_deriv_1` + * :c:data:`multi_s_dipole_moment` + * :c:data:`multi_s_x_deriv_1` + * :c:data:`multi_s_x_dipole_moment` + * :c:data:`multi_s_x_dipole_moment_eigenval` + * :c:data:`multi_s_x_dipole_moment_eigenvec` + * :c:data:`multi_s_y_deriv_1` + * :c:data:`multi_s_y_dipole_moment` + * :c:data:`multi_s_y_dipole_moment_eigenval` + * :c:data:`multi_s_y_dipole_moment_eigenvec` + * :c:data:`multi_s_z_deriv_1` + * :c:data:`multi_s_z_dipole_moment` + * :c:data:`multi_s_z_dipole_moment_eigenval` + * :c:data:`multi_s_z_dipole_moment_eigenvec` + * :c:data:`my_extra_grid_becke` + * :c:data:`my_grid_becke` + * :c:data:`my_n_pt_a_extra_grid` + * :c:data:`my_n_pt_a_grid` + * :c:data:`my_n_pt_r_extra_grid` + * :c:data:`my_n_pt_r_grid` + * :c:data:`n_a_v_prov` * :c:data:`n_act_orb` + * :c:data:`n_all_but_del_orb` * :c:data:`n_aos_max` - * :c:data:`n_cas_bitmask` + * :c:data:`n_attachment` + * :c:data:`n_basis_orb` + * :c:data:`n_big_act_orb` + * :c:data:`n_c_a_prov` + * :c:data:`n_c_v_prov` + * :c:data:`n_configuration` * :c:data:`n_core_inact_act_orb` * :c:data:`n_core_inact_orb` * :c:data:`n_core_orb` - * :c:data:`n_core_orb_allocate` + * :c:data:`n_couple_orb_r1` + * :c:data:`n_couple_orb_r2` + * :c:data:`n_csf` * :c:data:`n_del_orb` * :c:data:`n_det` * :c:data:`n_det_alpha_unique` * :c:data:`n_det_beta_unique` * :c:data:`n_det_cas` * :c:data:`n_det_generators` - * :c:data:`n_det_iterations` * :c:data:`n_det_max` * :c:data:`n_det_max_full` + * :c:data:`n_det_max_opt` * :c:data:`n_det_non_cas` * :c:data:`n_det_print_wf` + * :c:data:`n_det_qp_edit` * :c:data:`n_det_selectors` + * :c:data:`n_dettachment` + * :c:data:`n_dominant_dets_of_cfgs` * :c:data:`n_double_exc_bitmasks` * :c:data:`n_double_selectors` - * :c:data:`n_generators_bitmask` - * :c:data:`n_generators_bitmask_restart` + * :c:data:`n_elec_alpha_for_psi_configuration` + * :c:data:`n_guess_sx_mat` * :c:data:`n_inact_act_orb` * :c:data:`n_inact_orb` - * :c:data:`n_inact_orb_allocate` * :c:data:`n_int` * :c:data:`n_it_scf_max` * :c:data:`n_iter` - * :c:data:`n_occ_pattern` + * :c:data:`n_iter_max` + * :c:data:`n_max_occ_val_orb_for_hf` + * :c:data:`n_max_overlap` + * :c:data:`n_occ_val_orb_for_hf` + * :c:data:`n_orb_swap` + * :c:data:`n_points_extra_final_grid` + * :c:data:`n_points_extra_grid_per_atom` + * :c:data:`n_points_extra_integration_angular` + * :c:data:`n_points_extra_radial_grid` * :c:data:`n_points_final_grid` * :c:data:`n_points_grid_per_atom` * :c:data:`n_points_integration_angular` @@ -467,19 +825,32 @@ Index of Providers * :c:data:`n_points_radial_grid` * :c:data:`n_pt_max_i_x` * :c:data:`n_pt_max_integrals` + * :c:data:`n_pts_charge` * :c:data:`n_pts_max_per_atom` * :c:data:`n_pts_per_atom` * :c:data:`n_single_exc_bitmasks` * :c:data:`n_states` * :c:data:`n_states_diag` * :c:data:`n_virt_orb` - * :c:data:`n_virt_orb_allocate` + * :c:data:`nai_pol_mult_cgtos` + * :c:data:`nai_pol_mult_erf_with1s` + * :c:data:`natorbsci` + * :c:data:`natorbsci_mos` + * :c:data:`natorbsfci` + * :c:data:`nb_it_max_lambda` + * :c:data:`nb_it_max_pre_search` + * :c:data:`nbfmax` + * :c:data:`ncsfmax` + * :c:data:`neworbs` + * :c:data:`nmo` + * :c:data:`nmonoex` * :c:data:`no_core_density` - * :c:data:`no_ivvv_integrals` - * :c:data:`no_vvv_integrals` - * :c:data:`no_vvvv_integrals` + * :c:data:`no_oa_or_av_opt` + * :c:data:`norm_grad_vec2` + * :c:data:`norm_grad_vec2_tab` * :c:data:`normalize_dm` * :c:data:`nproc` + * :c:data:`nsomomax` * :c:data:`nthreads_davidson` * :c:data:`nthreads_pt2` * :c:data:`nucl_aos` @@ -500,21 +871,33 @@ Index of Providers * :c:data:`nucl_num` * :c:data:`nucl_num_shell_aos` * :c:data:`nuclear_repulsion` + * :c:data:`nucleus_shell_num` + * :c:data:`occ_act` + * :c:data:`occnum` + * :c:data:`on_top_cas_mu_r` + * :c:data:`on_top_hf_grid` + * :c:data:`on_top_hf_mu_r` * :c:data:`one_body_dm_mo_alpha_one_det` * :c:data:`one_body_dm_mo_beta_one_det` + * :c:data:`one_e_act_density_alpha` + * :c:data:`one_e_act_density_beta` + * :c:data:`one_e_act_dm_alpha_mo_for_dft` + * :c:data:`one_e_act_dm_beta_mo_for_dft` + * :c:data:`one_e_cas_total_density` * :c:data:`one_e_dm_alpha_ao_for_dft` * :c:data:`one_e_dm_alpha_ao_for_dft_no_core` - * :c:data:`one_e_dm_alpha_at_r` - * :c:data:`one_e_dm_alpha_in_r` * :c:data:`one_e_dm_and_grad_alpha_in_r` * :c:data:`one_e_dm_and_grad_beta_in_r` + * :c:data:`one_e_dm_ao` * :c:data:`one_e_dm_ao_alpha` + * :c:data:`one_e_dm_ao_alpha_nstates` * :c:data:`one_e_dm_ao_beta` + * :c:data:`one_e_dm_ao_beta_nstates` + * :c:data:`one_e_dm_average_alpha_mo_for_dft` + * :c:data:`one_e_dm_average_beta_mo_for_dft` * :c:data:`one_e_dm_average_mo_for_dft` * :c:data:`one_e_dm_beta_ao_for_dft` * :c:data:`one_e_dm_beta_ao_for_dft_no_core` - * :c:data:`one_e_dm_beta_at_r` - * :c:data:`one_e_dm_beta_in_r` * :c:data:`one_e_dm_dagger_mo_spin_index` * :c:data:`one_e_dm_mo` * :c:data:`one_e_dm_mo_alpha` @@ -528,42 +911,63 @@ Index of Providers * :c:data:`one_e_dm_mo_diff` * :c:data:`one_e_dm_mo_for_dft` * :c:data:`one_e_dm_mo_spin_index` - * :c:data:`one_e_dm_no_core_and_grad_alpha_in_r` - * :c:data:`one_e_dm_no_core_and_grad_beta_in_r` * :c:data:`one_e_energy` * :c:data:`one_e_grad_2_dm_alpha_at_r` * :c:data:`one_e_grad_2_dm_beta_at_r` * :c:data:`one_e_spin_density_ao` * :c:data:`one_e_spin_density_mo` + * :c:data:`one_e_stuff_for_pbe` + * :c:data:`one_e_tr_dm_mo` + * :c:data:`one_e_tr_dm_mo_alpha` + * :c:data:`one_e_tr_dm_mo_beta` + * :c:data:`one_ints_no` * :c:data:`only_expected_s2` + * :c:data:`optimization_max_nb_iter` + * :c:data:`optimization_method` + * :c:data:`orb_swap` + * :c:data:`ormas_bitmask` + * :c:data:`ormas_list_orb` + * :c:data:`ormas_max_e` + * :c:data:`ormas_max_n_orb` + * :c:data:`ormas_min_e` + * :c:data:`ormas_mstart` + * :c:data:`ormas_n_orb` + * :c:data:`ormas_n_space` * :c:data:`output_cpu_time_0` * :c:data:`output_wall_time_0` - * :c:data:`overlap_gaussian_xyz` + * :c:data:`overlap_cgaussian_xyz` + * :c:data:`overlap_states` + * :c:data:`overlap_states_inv` + * :c:data:`p0tuvx` + * :c:data:`p0tuvx_no` + * :c:data:`p0tuvx_peter` * :c:data:`phi_angular_integration_lebedev` + * :c:data:`planck_cte` + * :c:data:`point_charges` * :c:data:`pot_grad_c_alpha_ao_pbe` + * :c:data:`pot_grad_c_alpha_ao_sr_pbe` * :c:data:`pot_grad_c_beta_ao_pbe` + * :c:data:`pot_grad_c_beta_ao_sr_pbe` * :c:data:`pot_grad_x_alpha_ao_pbe` + * :c:data:`pot_grad_x_alpha_ao_sr_pbe` * :c:data:`pot_grad_x_beta_ao_pbe` + * :c:data:`pot_grad_x_beta_ao_sr_pbe` * :c:data:`pot_grad_xc_alpha_ao_pbe` + * :c:data:`pot_grad_xc_alpha_ao_sr_pbe` * :c:data:`pot_grad_xc_beta_ao_pbe` + * :c:data:`pot_grad_xc_beta_ao_sr_pbe` * :c:data:`pot_scal_c_alpha_ao_pbe` + * :c:data:`pot_scal_c_alpha_ao_sr_pbe` * :c:data:`pot_scal_c_beta_ao_pbe` + * :c:data:`pot_scal_c_beta_ao_sr_pbe` * :c:data:`pot_scal_x_alpha_ao_pbe` + * :c:data:`pot_scal_x_alpha_ao_sr_pbe` * :c:data:`pot_scal_x_beta_ao_pbe` + * :c:data:`pot_scal_x_beta_ao_sr_pbe` * :c:data:`pot_scal_xc_alpha_ao_pbe` + * :c:data:`pot_scal_xc_alpha_ao_sr_pbe` * :c:data:`pot_scal_xc_beta_ao_pbe` - * :c:data:`pot_sr_grad_c_alpha_ao_pbe` - * :c:data:`pot_sr_grad_c_beta_ao_pbe` - * :c:data:`pot_sr_grad_x_alpha_ao_pbe` - * :c:data:`pot_sr_grad_x_beta_ao_pbe` - * :c:data:`pot_sr_grad_xc_alpha_ao_pbe` - * :c:data:`pot_sr_grad_xc_beta_ao_pbe` - * :c:data:`pot_sr_scal_c_alpha_ao_pbe` - * :c:data:`pot_sr_scal_c_beta_ao_pbe` - * :c:data:`pot_sr_scal_x_alpha_ao_pbe` - * :c:data:`pot_sr_scal_x_beta_ao_pbe` - * :c:data:`pot_sr_scal_xc_alpha_ao_pbe` - * :c:data:`pot_sr_scal_xc_beta_ao_pbe` + * :c:data:`pot_scal_xc_beta_ao_sr_pbe` * :c:data:`potential_c_alpha_ao` * :c:data:`potential_c_alpha_ao_lda` * :c:data:`potential_c_alpha_ao_none` @@ -606,6 +1010,14 @@ Index of Providers * :c:data:`potential_xc_beta_ao_sr_lda` * :c:data:`potential_xc_beta_ao_sr_pbe` * :c:data:`potential_xc_beta_mo` + * :c:data:`prim_coef` + * :c:data:`prim_expo` + * :c:data:`prim_normalization_factor` + * :c:data:`prim_num` + * :c:data:`primitives_normalized` + * :c:data:`print_all_transitions` + * :c:data:`pruned` + * :c:data:`pruning` * :c:data:`pseudo_dz_k` * :c:data:`pseudo_dz_k_transp` * :c:data:`pseudo_dz_kl` @@ -647,12 +1059,23 @@ Index of Providers * :c:data:`psi_cas_sorted_bit` * :c:data:`psi_coef` * :c:data:`psi_coef_cas_diagonalized` + * :c:data:`psi_coef_config` * :c:data:`psi_coef_generators` * :c:data:`psi_coef_max` * :c:data:`psi_coef_min` * :c:data:`psi_coef_sorted` * :c:data:`psi_coef_sorted_bit` * :c:data:`psi_coef_sorted_gen` + * :c:data:`psi_config_data` + * :c:data:`psi_configuration` + * :c:data:`psi_configuration_hii` + * :c:data:`psi_configuration_n_det` + * :c:data:`psi_configuration_sorted` + * :c:data:`psi_configuration_sorted_order` + * :c:data:`psi_configuration_sorted_order_reverse` + * :c:data:`psi_configuration_to_psi_det` + * :c:data:`psi_configuration_to_psi_det_data` + * :c:data:`psi_csf_coef` * :c:data:`psi_det` * :c:data:`psi_det_alpha` * :c:data:`psi_det_alpha_unique` @@ -672,13 +1095,12 @@ Index of Providers * :c:data:`psi_energy` * :c:data:`psi_energy_h_core` * :c:data:`psi_energy_two_e` + * :c:data:`psi_energy_two_e_trans` * :c:data:`psi_energy_with_nucl_rep` * :c:data:`psi_non_cas` * :c:data:`psi_non_cas_coef` * :c:data:`psi_non_cas_coef_sorted_bit` * :c:data:`psi_non_cas_sorted_bit` - * :c:data:`psi_occ_pattern` - * :c:data:`psi_occ_pattern_hii` * :c:data:`psi_s2` * :c:data:`psi_selectors` * :c:data:`psi_selectors_coef` @@ -692,11 +1114,14 @@ Index of Providers * :c:data:`pt2_j` * :c:data:`pt2_match_weight` * :c:data:`pt2_max` + * :c:data:`pt2_min_casscf` + * :c:data:`pt2_min_parallel_tasks` * :c:data:`pt2_mindetinfirstteeth` * :c:data:`pt2_n_0` * :c:data:`pt2_n_tasks` * :c:data:`pt2_n_tasks_max` * :c:data:`pt2_n_teeth` + * :c:data:`pt2_overlap` * :c:data:`pt2_r` * :c:data:`pt2_relative_error` * :c:data:`pt2_stoch_istate` @@ -704,45 +1129,58 @@ Index of Providers * :c:data:`pt2_u_0` * :c:data:`pt2_w` * :c:data:`pt2_w_t` + * :c:data:`pt_chrg_interaction` + * :c:data:`pt_chrg_nuclei_interaction` + * :c:data:`pts_charge_coord` + * :c:data:`pts_charge_z` * :c:data:`qp_kill_filename` * :c:data:`qp_max_mem` * :c:data:`qp_run_address` * :c:data:`qp_stop_filename` * :c:data:`qp_stop_variable` - * :c:data:`read_ao_integrals_e_n` + * :c:data:`r_gill` + * :c:data:`rad_grid_type` + * :c:data:`read_ao_cholesky` * :c:data:`read_ao_integrals_kinetic` + * :c:data:`read_ao_integrals_n_e` * :c:data:`read_ao_integrals_overlap` * :c:data:`read_ao_integrals_pseudo` * :c:data:`read_ao_one_e_integrals` * :c:data:`read_ao_two_e_integrals` * :c:data:`read_ao_two_e_integrals_erf` - * :c:data:`read_mo_integrals_e_n` + * :c:data:`read_mo_cholesky` * :c:data:`read_mo_integrals_kinetic` + * :c:data:`read_mo_integrals_n_e` * :c:data:`read_mo_integrals_pseudo` * :c:data:`read_mo_one_e_integrals` * :c:data:`read_mo_two_e_integrals` * :c:data:`read_mo_two_e_integrals_erf` + * :c:data:`read_mu_of_r` * :c:data:`read_nuclear_repulsion` + * :c:data:`read_two_body_rdm_aa` + * :c:data:`read_two_body_rdm_ab` + * :c:data:`read_two_body_rdm_bb` + * :c:data:`read_two_body_rdm_spin_trace` * :c:data:`read_wf` - * :c:data:`rec__quicksort` - * :c:data:`rec_d_quicksort` - * :c:data:`rec_i2_quicksort` - * :c:data:`rec_i8_quicksort` - * :c:data:`rec_i_quicksort` * :c:data:`ref_bitmask` - * :c:data:`ref_bitmask_e_n_energy` * :c:data:`ref_bitmask_energy` * :c:data:`ref_bitmask_energy_aa` * :c:data:`ref_bitmask_energy_ab` * :c:data:`ref_bitmask_energy_bb` * :c:data:`ref_bitmask_kinetic_energy` + * :c:data:`ref_bitmask_n_e_energy` * :c:data:`ref_bitmask_one_e_energy` * :c:data:`ref_bitmask_two_e_energy` * :c:data:`ref_closed_shell_bitmask` + * :c:data:`regular_range_hartree` + * :c:data:`regular_range_hartree_operator` + * :c:data:`restore_symm` + * :c:data:`reunion_of_act_virt_bitmask` * :c:data:`reunion_of_bitmask` - * :c:data:`reunion_of_cas_inact_bitmask` * :c:data:`reunion_of_core_inact_act_bitmask` * :c:data:`reunion_of_core_inact_bitmask` + * :c:data:`reunion_of_inact_act_bitmask` + * :c:data:`rowsmax` * :c:data:`rs_ks_energy` * :c:data:`s2_eig` * :c:data:`s2_matrix_all_dets` @@ -750,10 +1188,15 @@ Index of Providers * :c:data:`s_half` * :c:data:`s_half_inv` * :c:data:`s_inv` + * :c:data:`s_inv_complex` * :c:data:`s_mo_coef` + * :c:data:`s_values` * :c:data:`s_z` * :c:data:`s_z2_sz` * :c:data:`same_xc_func` + * :c:data:`save_threshold` + * :c:data:`save_wf_after_selection` + * :c:data:`scal_prod_grad_one_e_dm_ab` * :c:data:`scf_algorithm` * :c:data:`scf_density_matrix_ao` * :c:data:`scf_density_matrix_ao_alpha` @@ -765,14 +1208,23 @@ Index of Providers * :c:data:`selection_criterion_min` * :c:data:`selection_factor` * :c:data:`selection_weight` + * :c:data:`seniority_max` + * :c:data:`shell_ang_mom` + * :c:data:`shell_index` + * :c:data:`shell_normalization_factor` + * :c:data:`shell_num` + * :c:data:`shell_prim_num` + * :c:data:`shiftfact_op5_inv` * :c:data:`short_range_hartree` * :c:data:`short_range_hartree_operator` * :c:data:`single_exc_bitmask` * :c:data:`singles_alpha_csc` * :c:data:`singles_alpha_csc_idx` + * :c:data:`singles_alpha_csc_map` * :c:data:`singles_alpha_csc_size` * :c:data:`singles_beta_csc` * :c:data:`singles_beta_csc_idx` + * :c:data:`singles_beta_csc_map` * :c:data:`singles_beta_csc_size` * :c:data:`size_select_max` * :c:data:`slater_bragg_radii` @@ -781,52 +1233,124 @@ Index of Providers * :c:data:`slater_bragg_radii_ua` * :c:data:`slater_bragg_type_inter_distance` * :c:data:`slater_bragg_type_inter_distance_ua` + * :c:data:`small_active_space` + * :c:data:`spin_multiplicity` + * :c:data:`state_av_act_2_rdm_aa_mo` + * :c:data:`state_av_act_2_rdm_ab_mo` + * :c:data:`state_av_act_2_rdm_bb_mo` + * :c:data:`state_av_act_2_rdm_spin_trace_mo` + * :c:data:`state_av_full_occ_2_rdm_aa_mo` + * :c:data:`state_av_full_occ_2_rdm_ab_mo` + * :c:data:`state_av_full_occ_2_rdm_bb_mo` + * :c:data:`state_av_full_occ_2_rdm_spin_trace_mo` * :c:data:`state_average_weight` * :c:data:`state_following` + * :c:data:`state_following_casscf` + * :c:data:`super_ci_dm` + * :c:data:`superci_nat_occ` + * :c:data:`superci_natorb` + * :c:data:`switch_mo_coef` + * :c:data:`sxeigenval` + * :c:data:`sxeigenvec` + * :c:data:`sxmatrix` + * :c:data:`sxvector` + * :c:data:`sxvector_lowest` * :c:data:`target_energy` * :c:data:`theta_angular_integration_lebedev` + * :c:data:`thresh_casscf` + * :c:data:`thresh_cc` + * :c:data:`thresh_delta` + * :c:data:`thresh_eig` + * :c:data:`thresh_extra_grid` * :c:data:`thresh_grid` + * :c:data:`thresh_model` + * :c:data:`thresh_model_2` + * :c:data:`thresh_opt_max_elem_grad` + * :c:data:`thresh_overlap_switch` + * :c:data:`thresh_rho` + * :c:data:`thresh_rho_2` * :c:data:`thresh_scf` * :c:data:`thresh_sym` + * :c:data:`thresh_wtg` + * :c:data:`thresh_wtg2` * :c:data:`threshold_davidson` + * :c:data:`threshold_davidson_from_pt2` + * :c:data:`threshold_davidson_pt2` * :c:data:`threshold_diis` * :c:data:`threshold_diis_nonzero` * :c:data:`threshold_generators` + * :c:data:`threshold_nonsym_davidson` * :c:data:`threshold_selectors` + * :c:data:`total_cas_on_top_density` * :c:data:`trace_potential_xc` * :c:data:`trace_v_h` * :c:data:`trace_v_hxc` * :c:data:`trace_v_xc` * :c:data:`trace_v_xc_new` * :c:data:`transpose` + * :c:data:`trexio_file` + * :c:data:`trexio_filename` + * :c:data:`twice_hierarchy_max` + * :c:data:`two_e_dm_mo` * :c:data:`two_e_energy` + * :c:data:`two_e_int_aa_f` + * :c:data:`two_e_int_hf_f` + * :c:data:`two_e_int_ia_f` + * :c:data:`two_e_int_ii_f` + * :c:data:`typ` + * :c:data:`umat` * :c:data:`unpaired_alpha_electrons` - * :c:data:`used_weight` + * :c:data:`use_banned_excitation` + * :c:data:`use_cgtos` + * :c:data:`use_cosgtos` + * :c:data:`use_only_lr` + * :c:data:`use_pw` + * :c:data:`v_ne_psi_energy` * :c:data:`var_pt2_ratio` * :c:data:`variance_match_weight` * :c:data:`variance_max` + * :c:data:`version_avoid_saddle` + * :c:data:`version_lambda_search` * :c:data:`virt_bitmask` * :c:data:`virt_bitmask_4` + * :c:data:`virt_mos_in_r_array` + * :c:data:`virt_mos_in_r_array_transp` + * :c:data:`wall_time_core_inact_act_on_top_of_r` * :c:data:`weight_at_r` - * :c:data:`weight_occ_pattern` + * :c:data:`weight_at_r_extra` + * :c:data:`weight_configuration` + * :c:data:`weight_configuration_average` + * :c:data:`weight_configuration_average_sorted` * :c:data:`weight_one_e_dm` * :c:data:`weight_selection` * :c:data:`weights_angular_integration_lebedev` * :c:data:`weights_angular_points` - * :c:data:`write_ao_integrals_e_n` + * :c:data:`weights_angular_points_extra` + * :c:data:`without_diagonal` + * :c:data:`write_ao_cholesky` * :c:data:`write_ao_integrals_kinetic` + * :c:data:`write_ao_integrals_n_e` * :c:data:`write_ao_integrals_overlap` * :c:data:`write_ao_integrals_pseudo` * :c:data:`write_ao_one_e_integrals` * :c:data:`write_ao_two_e_integrals` * :c:data:`write_ao_two_e_integrals_erf` - * :c:data:`write_mo_integrals_e_n` + * :c:data:`write_mo_cholesky` * :c:data:`write_mo_integrals_kinetic` + * :c:data:`write_mo_integrals_n_e` * :c:data:`write_mo_integrals_pseudo` * :c:data:`write_mo_one_e_integrals` * :c:data:`write_mo_two_e_integrals` * :c:data:`write_mo_two_e_integrals_erf` + * :c:data:`write_mu_of_r` * :c:data:`write_nuclear_repulsion` + * :c:data:`write_two_body_rdm_aa` + * :c:data:`write_two_body_rdm_ab` + * :c:data:`write_two_body_rdm_bb` + * :c:data:`write_two_body_rdm_spin_trace` + * :c:data:`x_dipole_moment` + * :c:data:`y_dipole_moment` + * :c:data:`z_dipole_moment` * :c:data:`zmq_context` * :c:data:`zmq_lock` * :c:data:`zmq_port_start` @@ -844,27 +1368,38 @@ Index of Subroutines/Functions .. hlist:: - * :c:func:`a_coef` * :c:func:`a_operator` * :c:func:`a_operator_two_e` * :c:func:`ac_operator` * :c:func:`ac_operator_two_e` + * :c:func:`act_on_top_on_grid_pt` + * :c:func:`add_cpoly` + * :c:func:`add_cpoly_multiply` * :c:func:`add_integrals_to_map` + * :c:func:`add_integrals_to_map_cholesky` * :c:func:`add_integrals_to_map_erf` - * :c:func:`add_integrals_to_map_no_exit_34` - * :c:func:`add_integrals_to_map_three_indices` * :c:func:`add_poly` * :c:func:`add_poly_multiply` * :c:func:`add_task_to_taskserver` * :c:func:`add_to_selection_buffer` + * :c:func:`ao_2e_cgtos_schwartz_accel` + * :c:func:`ao_2e_cosgtos_schwartz_accel` + * :c:func:`ao_idx2_sq` + * :c:func:`ao_idx2_sq_rev` + * :c:func:`ao_idx2_tri_key` + * :c:func:`ao_idx2_tri_rev_key` * :c:func:`ao_l4` + * :c:func:`ao_one_e_integral_zero` * :c:func:`ao_ortho_cano_to_ao` * :c:func:`ao_power_index` * :c:func:`ao_to_mo` * :c:func:`ao_two_e_integral` + * :c:func:`ao_two_e_integral_cgtos` + * :c:func:`ao_two_e_integral_cosgtos` * :c:func:`ao_two_e_integral_erf` * :c:func:`ao_two_e_integral_schwartz_accel` * :c:func:`ao_two_e_integral_schwartz_accel_erf` + * :c:func:`ao_two_e_integral_zero` * :c:func:`ao_two_e_integrals_erf_in_map_collector` * :c:func:`ao_two_e_integrals_erf_in_map_slave` * :c:func:`ao_two_e_integrals_erf_in_map_slave_inproc` @@ -877,12 +1412,20 @@ Index of Subroutines/Functions * :c:func:`apply_excitation` * :c:func:`apply_hole` * :c:func:`apply_holes` + * :c:func:`apply_mo_rotation` * :c:func:`apply_particle` * :c:func:`apply_particles` * :c:func:`apply_rotation` * :c:func:`approx_dble` - * :c:func:`b_coef` + * :c:func:`attachement_orb` * :c:func:`berf` + * :c:func:`beta_rs` + * :c:func:`bielec_no_basis` + * :c:func:`bielec_pqxx` + * :c:func:`bielec_pqxx_no` + * :c:func:`bielec_pxxq` + * :c:func:`bielec_pxxq_no` + * :c:func:`binary_search_cfg` * :c:func:`binom_func` * :c:func:`bitstring_to_hexa` * :c:func:`bitstring_to_list` @@ -894,9 +1437,20 @@ Index of Subroutines/Functions * :c:func:`broadcast_chunks_integer` * :c:func:`broadcast_chunks_integer8` * :c:func:`build_fock_tmp` + * :c:func:`build_singly_excited_wavefunction` + * :c:func:`calc_grad_elem` + * :c:func:`calc_hess_elem` + * :c:func:`cas_based_density` + * :c:func:`cas_based_on_top` + * :c:func:`cas_based_on_top_density` + * :c:func:`cas_complete` + * :c:func:`casscf` * :c:func:`cell_function_becke` + * :c:func:`cgaussian_product` + * :c:func:`cgaussian_product_x` * :c:func:`check_coherence_functional` * :c:func:`check_mem` + * :c:func:`check_sym` * :c:func:`cis` * :c:func:`cisd` * :c:func:`clear_ao_erf_map` @@ -908,23 +1462,84 @@ Index of Subroutines/Functions * :c:func:`compute_ao_integrals_jl` * :c:func:`compute_ao_two_e_integrals` * :c:func:`compute_ao_two_e_integrals_erf` + * :c:func:`configuration_of_det` + * :c:func:`configuration_search_key` + * :c:func:`configuration_to_dets` + * :c:func:`configuration_to_dets_size` + * :c:func:`configuration_to_dets_tree_addressing` + * :c:func:`configuration_to_str` * :c:func:`connect_to_taskserver` * :c:func:`connected_to_hf` * :c:func:`connected_to_ref` * :c:func:`connected_to_ref_by_single` + * :c:func:`convertorbidstomodelspaceids` + * :c:func:`convertwffromcsftodet` + * :c:func:`convertwffromdettocsf` * :c:func:`copy_h_apply_buffer_to_wf` * :c:func:`copy_psi_bilinear_to_psi` + * :c:func:`correction_to_on_top_from_ueg` + * :c:func:`cpx_erf` + * :c:func:`cpx_erf_1` * :c:func:`create_guess` * :c:func:`create_microlist` * :c:func:`create_minilist` * :c:func:`create_minilist_find_previous` * :c:func:`create_selection_buffer` * :c:func:`create_wf_of_psi_bilinear_matrix` + * :c:func:`crint` + * :c:func:`crint_1` + * :c:func:`crint_1_vec` + * :c:func:`crint_2` + * :c:func:`crint_2_vec` + * :c:func:`crint_quad_1` + * :c:func:`crint_quad_12` + * :c:func:`crint_quad_12_vec` + * :c:func:`crint_quad_2` + * :c:func:`crint_smallz` + * :c:func:`crint_smallz_vec` + * :c:func:`crint_sum` + * :c:func:`d1_norm_inverse_trust_region` + * :c:func:`d1_norm_inverse_trust_region_omp` + * :c:func:`d1_norm_trust_region` + * :c:func:`d1_norm_trust_region_omp` + * :c:func:`d2_norm_inverse_trust_region` + * :c:func:`d2_norm_inverse_trust_region_omp` + * :c:func:`d2_norm_trust_region` + * :c:func:`d2_norm_trust_region_omp` * :c:func:`damping_scf` + * :c:func:`dav_double_dressed` * :c:func:`davidson_collector` - * :c:func:`davidson_converged` + * :c:func:`davidson_csf_collector` + * :c:func:`davidson_csf_pull_results` + * :c:func:`davidson_csf_push_results` + * :c:func:`davidson_csf_push_results_async_send` + * :c:func:`davidson_csf_run_slave` + * :c:func:`davidson_csf_slave_inproc` + * :c:func:`davidson_csf_slave_tcp` + * :c:func:`davidson_csf_slave_work` + * :c:func:`davidson_diag_csf_hjj` + * :c:func:`davidson_diag_h` + * :c:func:`davidson_diag_h_csf` + * :c:func:`davidson_diag_hjj` * :c:func:`davidson_diag_hjj_sjj` * :c:func:`davidson_diag_hs2` + * :c:func:`davidson_diag_nonsym_h` + * :c:func:`davidson_diag_nonsym_hjj` + * :c:func:`davidson_diag_sx_mat` + * :c:func:`davidson_general` + * :c:func:`davidson_general_diag_dressed_ext_rout_nonsym_b1space` + * :c:func:`davidson_general_ext_rout` + * :c:func:`davidson_general_ext_rout_diag_dressed` + * :c:func:`davidson_general_ext_rout_dressed` + * :c:func:`davidson_general_ext_rout_nonsym_b1space` + * :c:func:`davidson_nos2_collector` + * :c:func:`davidson_nos2_pull_results` + * :c:func:`davidson_nos2_push_results` + * :c:func:`davidson_nos2_push_results_async_send` + * :c:func:`davidson_nos2_run_slave` + * :c:func:`davidson_nos2_slave_inproc` + * :c:func:`davidson_nos2_slave_tcp` + * :c:func:`davidson_nos2_slave_work` * :c:func:`davidson_pull_results` * :c:func:`davidson_push_results` * :c:func:`davidson_push_results_async_recv` @@ -938,15 +1553,22 @@ Index of Subroutines/Functions * :c:func:`dble_fact_even` * :c:func:`dble_fact_odd` * :c:func:`dble_logfact` - * :c:func:`ddfact2` + * :c:func:`debug_cfg` * :c:func:`debug_det` * :c:func:`debug_spindet` * :c:func:`decode_exc` * :c:func:`decode_exc_spin` * :c:func:`delete_selection_buffer` + * :c:func:`delta_lrsr_ldaerf` * :c:func:`dens_grad_a_b_no_core_and_aos_grad_aos_at_r` + * :c:func:`density_and_grad_alpha_beta` * :c:func:`density_and_grad_alpha_beta_and_all_aos_and_grad_aos_at_r` + * :c:func:`density_and_grad_lapl_alpha_beta_and_all_aos_and_grad_aos_at_r` + * :c:func:`derf_mu_x` * :c:func:`derivative_knowles_function` + * :c:func:`det_allowed_ormas` + * :c:func:`det_copy` + * :c:func:`det_extract` * :c:func:`det_inf` * :c:func:`det_search_key` * :c:func:`detcmp` @@ -954,41 +1576,67 @@ Index of Subroutines/Functions * :c:func:`diag_h_mat_elem` * :c:func:`diag_h_mat_elem_fock` * :c:func:`diag_h_mat_elem_one_e` + * :c:func:`diag_hessian_list_opt` + * :c:func:`diag_hessian_opt` + * :c:func:`diag_mat_per_fock_degen` + * :c:func:`diag_mat_per_fock_degen_core` + * :c:func:`diag_nonsym_right` * :c:func:`diag_s_mat_elem` * :c:func:`diag_wee_mat_elem` + * :c:func:`diagonalization_hessian` * :c:func:`diagonalize_ci` * :c:func:`diagonalize_h` + * :c:func:`diagonalize_sym_matrix` * :c:func:`disconnect_from_taskserver` * :c:func:`disconnect_from_taskserver_state` * :c:func:`dm_dft_alpha_beta_and_all_aos_at_r` * :c:func:`dm_dft_alpha_beta_at_r` * :c:func:`dm_dft_alpha_beta_no_core_at_r` + * :c:func:`do_schwartz_accel` * :c:func:`do_single_excitation` + * :c:func:`do_single_excitation_cfg` + * :c:func:`do_single_excitation_cfg_with_type` * :c:func:`dpol` * :c:func:`dpold` * :c:func:`dpoldd` + * :c:func:`dress_calc` + * :c:func:`dressing_diag_uv` + * :c:func:`driver_optorb` * :c:func:`dset_order` * :c:func:`dset_order_big` - * :c:func:`dsort` - * :c:func:`dump_ao_integrals` * :c:func:`dump_ao_integrals_erf` * :c:func:`dump_mo_integrals` * :c:func:`ec_lda` * :c:func:`ec_lda_sr` + * :c:func:`ec_lyp2` + * :c:func:`ec_lyp_88` + * :c:func:`ec_md_on_top_pbe_mu_corrected` + * :c:func:`ec_md_pbe_on_top_general` * :c:func:`ec_only_lda_sr` * :c:func:`ec_pbe_only` * :c:func:`ec_pbe_sr` + * :c:func:`ec_scan` + * :c:func:`ecmd_pbe_ueg_at_r` * :c:func:`ecorrlr` * :c:func:`ecpw` + * :c:func:`eigsvd` * :c:func:`end_parallel_job` * :c:func:`end_zmq_pair_socket` * :c:func:`end_zmq_pull_socket` * :c:func:`end_zmq_push_socket` * :c:func:`end_zmq_sub_socket` * :c:func:`end_zmq_to_qp_run_socket` - * :c:func:`erf0` + * :c:func:`eps_c_md_pbe_at_grid_pt` + * :c:func:`eps_c_md_pbe_from_density` + * :c:func:`erf_e` + * :c:func:`erf_f` + * :c:func:`erf_g` + * :c:func:`erf_h` * :c:func:`eri` + * :c:func:`eri_cgtos` + * :c:func:`eri_cosgtos` * :c:func:`eri_erf` + * :c:func:`esrc_md_ldaerf` * :c:func:`ex_lda` * :c:func:`ex_lda_sr` * :c:func:`ex_pbe_sr` @@ -997,30 +1645,60 @@ Index of Subroutines/Functions * :c:func:`example_bitmask` * :c:func:`example_determinants` * :c:func:`example_determinants_psi_det` + * :c:func:`exp_matrix` + * :c:func:`exp_matrix_taylor` + * :c:func:`export_trexio` + * :c:func:`export_trexio_prog` + * :c:func:`extract_cas` * :c:func:`extrapolate_data` * :c:func:`f_function_becke` + * :c:func:`f_hf_valence_ab` * :c:func:`f_integral` + * :c:func:`f_norm_trust_region` + * :c:func:`f_norm_trust_region_omp` * :c:func:`fact` + * :c:func:`factorial` + * :c:func:`fc_integral` * :c:func:`fci` * :c:func:`fcidump` + * :c:func:`fcidump_pyscf` * :c:func:`fill_buffer_double` + * :c:func:`fill_buffer_single` * :c:func:`fill_h_apply_buffer_no_selection` * :c:func:`fill_h_apply_buffer_selection` * :c:func:`filter_connected` * :c:func:`filter_connected_i_h_psi0` * :c:func:`filter_not_connected` * :c:func:`find_rotation` + * :c:func:`first_diag_hessian_list_opt` + * :c:func:`first_diag_hessian_opt` + * :c:func:`first_gradient_list_opt` + * :c:func:`first_gradient_opt` + * :c:func:`first_hessian_list_opt` + * :c:func:`first_hessian_opt` + * :c:func:`format_w_error` + * :c:func:`four_idx_dgemm` + * :c:func:`four_idx_dgemm_erf` * :c:func:`four_idx_transform` + * :c:func:`g0_dg0` + * :c:func:`g0_dg0_d2g0` + * :c:func:`g0_ueg_mu` + * :c:func:`g0_ueg_mu_inf` * :c:func:`g0d` * :c:func:`g0dd` * :c:func:`g0f` - * :c:func:`gammln` - * :c:func:`gammp` + * :c:func:`g0s` * :c:func:`gauleg` * :c:func:`gaussian_product` + * :c:func:`gaussian_product_v` * :c:func:`gaussian_product_x` - * :c:func:`gcf` + * :c:func:`gaussian_product_x_v` * :c:func:`generate_all_alpha_beta_det_products` + * :c:func:`generate_all_singles_cfg` + * :c:func:`generate_all_singles_cfg_with_type` + * :c:func:`generate_cas_space` + * :c:func:`get_a_squared` + * :c:func:`get_ab_prod` * :c:func:`get_all_spin_doubles` * :c:func:`get_all_spin_doubles_1` * :c:func:`get_all_spin_doubles_2` @@ -1040,20 +1718,27 @@ Index of Subroutines/Functions * :c:func:`get_all_spin_singles_and_doubles_n_int` * :c:func:`get_all_spin_singles_n_int` * :c:func:`get_ao_erf_map_size` + * :c:func:`get_ao_integ_chol` * :c:func:`get_ao_map_size` * :c:func:`get_ao_two_e_integral` * :c:func:`get_ao_two_e_integral_erf` + * :c:func:`get_ao_two_e_integral_periodic` * :c:func:`get_ao_two_e_integrals` * :c:func:`get_ao_two_e_integrals_erf` * :c:func:`get_ao_two_e_integrals_erf_non_zero` * :c:func:`get_ao_two_e_integrals_non_zero` * :c:func:`get_ao_two_e_integrals_non_zero_jl` * :c:func:`get_ao_two_e_integrals_non_zero_jl_from_list` + * :c:func:`get_ao_two_e_integrals_periodic` * :c:func:`get_d0` + * :c:func:`get_d0_reference` * :c:func:`get_d1` + * :c:func:`get_d1_reference` * :c:func:`get_d2` + * :c:func:`get_d2_reference` * :c:func:`get_double_excitation` * :c:func:`get_double_excitation_spin` + * :c:func:`get_energy` * :c:func:`get_excitation` * :c:func:`get_excitation_degree` * :c:func:`get_excitation_degree_spin` @@ -1062,16 +1747,24 @@ Index of Subroutines/Functions * :c:func:`get_excitation_degree_vector_single` * :c:func:`get_excitation_degree_vector_single_or_exchange` * :c:func:`get_excitation_degree_vector_single_or_exchange_verbose` + * :c:func:`get_excitation_general` * :c:func:`get_excitation_spin` + * :c:func:`get_holes_general` * :c:func:`get_index_in_psi_det_alpha_unique` * :c:func:`get_index_in_psi_det_beta_unique` * :c:func:`get_index_in_psi_det_sorted_bit` * :c:func:`get_inverse` + * :c:func:`get_inverse_complex` + * :c:func:`get_lccsd_2` + * :c:func:`get_m0` + * :c:func:`get_m1` + * :c:func:`get_m2` * :c:func:`get_mask_phase` * :c:func:`get_mo_erf_map_size` * :c:func:`get_mo_map_size` * :c:func:`get_mo_two_e_integral_erf` * :c:func:`get_mo_two_e_integrals` + * :c:func:`get_mo_two_e_integrals_cache` * :c:func:`get_mo_two_e_integrals_coulomb_ii` * :c:func:`get_mo_two_e_integrals_erf` * :c:func:`get_mo_two_e_integrals_erf_coulomb_ii` @@ -1082,20 +1775,28 @@ Index of Subroutines/Functions * :c:func:`get_mo_two_e_integrals_i1j1` * :c:func:`get_mo_two_e_integrals_ij` * :c:func:`get_occupation_from_dets` + * :c:func:`get_particles_general` * :c:func:`get_phase` * :c:func:`get_phase_bi` + * :c:func:`get_phase_general` + * :c:func:`get_phase_qp_to_cfg` * :c:func:`get_phasemask_bit` * :c:func:`get_pseudo_inverse` + * :c:func:`get_pseudo_inverse_complex` * :c:func:`get_s2` * :c:func:`get_single_excitation` * :c:func:`get_single_excitation_from_fock` * :c:func:`get_single_excitation_spin` * :c:func:`get_task_from_taskserver` * :c:func:`get_tasks_from_taskserver` + * :c:func:`get_total_available_memory` * :c:func:`get_two_e_integral` + * :c:func:`get_two_e_integral_cache` * :c:func:`get_uj_s2_ui` * :c:func:`getmobiles` + * :c:func:`getnsomo` * :c:func:`getunitandopen` + * :c:func:`give_active_on_top_in_r_one_state` * :c:func:`give_all_aos_and_grad_and_lapl_at_r` * :c:func:`give_all_aos_and_grad_at_r` * :c:func:`give_all_aos_at_r` @@ -1103,14 +1804,40 @@ Index of Subroutines/Functions * :c:func:`give_all_mos_and_grad_and_lapl_at_r` * :c:func:`give_all_mos_and_grad_at_r` * :c:func:`give_all_mos_at_r` + * :c:func:`give_all_stuffs_in_r_for_lyp_88` + * :c:func:`give_cas_density_in_r` + * :c:func:`give_core_inact_act_density_in_r` + * :c:func:`give_degen` + * :c:func:`give_degen_full_list` + * :c:func:`give_degen_full_listcore` * :c:func:`give_explicit_poly_and_gaussian` * :c:func:`give_explicit_poly_and_gaussian_double` + * :c:func:`give_explicit_poly_and_gaussian_v` * :c:func:`give_explicit_poly_and_gaussian_x` + * :c:func:`give_f_aa_val_ab` + * :c:func:`give_f_ia_val_ab` + * :c:func:`give_f_ii_val_ab` + * :c:func:`give_mu_of_r_cas` + * :c:func:`give_n2_aa_val_ab` + * :c:func:`give_n2_cas` + * :c:func:`give_n2_ia_val_ab` + * :c:func:`give_n2_ii_val_ab` + * :c:func:`give_on_top_gradient` + * :c:func:`give_on_top_in_r_one_state` + * :c:func:`give_pol_in_r` * :c:func:`give_polynom_mult_center_x` * :c:func:`give_polynomial_mult_center_one_e` + * :c:func:`give_polynomial_mult_center_one_e_erf` + * :c:func:`give_polynomial_mult_center_one_e_erf_opt` * :c:func:`gpw` * :c:func:`grad_rho_ab_to_grad_rho_oc` - * :c:func:`gser` + * :c:func:`gradient_list_opt` + * :c:func:`gradient_opt` + * :c:func:`gradvec_ia` + * :c:func:`gradvec_it` + * :c:func:`gradvec_ta` + * :c:func:`guess_hcore` + * :c:func:`guess_huckel` * :c:func:`h_apply_cis` * :c:func:`h_apply_cis_diexc` * :c:func:`h_apply_cis_diexcorg` @@ -1131,6 +1858,17 @@ Index of Subroutines/Functions * :c:func:`h_apply_cisd_sym_diexcorg` * :c:func:`h_apply_cisd_sym_diexcp` * :c:func:`h_apply_cisd_sym_monoexc` + * :c:func:`h_apply_mp2` + * :c:func:`h_apply_mp2_diexc` + * :c:func:`h_apply_mp2_diexcorg` + * :c:func:`h_apply_mp2_diexcp` + * :c:func:`h_apply_mp2_monoexc` + * :c:func:`h_apply_mp2_selection` + * :c:func:`h_apply_mp2_selection_diexc` + * :c:func:`h_apply_mp2_selection_diexcorg` + * :c:func:`h_apply_mp2_selection_diexcp` + * :c:func:`h_apply_mp2_selection_monoexc` + * :c:func:`h_func` * :c:func:`h_s2_u_0_nstates_openmp` * :c:func:`h_s2_u_0_nstates_openmp_work` * :c:func:`h_s2_u_0_nstates_openmp_work_1` @@ -1146,25 +1884,31 @@ Index of Subroutines/Functions * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_3` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_4` * :c:func:`h_s2_u_0_two_e_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_openmp` + * :c:func:`h_u_0_nstates_openmp_work` + * :c:func:`h_u_0_nstates_openmp_work_1` + * :c:func:`h_u_0_nstates_openmp_work_2` + * :c:func:`h_u_0_nstates_openmp_work_3` + * :c:func:`h_u_0_nstates_openmp_work_4` + * :c:func:`h_u_0_nstates_openmp_work_n_int` + * :c:func:`h_u_0_nstates_zmq` + * :c:func:`hcalc_template` * :c:func:`hcore_guess` - * :c:func:`heap_dsort` - * :c:func:`heap_dsort_big` - * :c:func:`heap_i2sort` - * :c:func:`heap_i2sort_big` - * :c:func:`heap_i8sort` - * :c:func:`heap_i8sort_big` - * :c:func:`heap_isort` - * :c:func:`heap_isort_big` - * :c:func:`heap_sort` - * :c:func:`heap_sort_big` * :c:func:`hermite` + * :c:func:`hessian_list_opt` + * :c:func:`hessian_opt` + * :c:func:`hessmat_iajb` + * :c:func:`hessmat_iatb` + * :c:func:`hessmat_itja` + * :c:func:`hessmat_itju` + * :c:func:`hessmat_itua` + * :c:func:`hessmat_taub` + * :c:func:`hpsi` * :c:func:`huckel_guess` * :c:func:`i2set_order` * :c:func:`i2set_order_big` - * :c:func:`i2sort` * :c:func:`i8set_order` * :c:func:`i8set_order_big` - * :c:func:`i8sort` * :c:func:`i_h_j` * :c:func:`i_h_j_double_alpha_beta` * :c:func:`i_h_j_double_spin` @@ -1179,22 +1923,22 @@ Index of Subroutines/Functions * :c:func:`i_s2_psi_minilist` * :c:func:`i_wee_j_single` * :c:func:`i_x1_pol_mult` - * :c:func:`initialize_bitmask_to_restart_ones` + * :c:func:`i_x1_pol_mult_cgtos` + * :c:func:`i_x1_pol_mult_cosgtos` + * :c:func:`idx2_tri_int` + * :c:func:`idx2_tri_rev_int` + * :c:func:`import_integrals_ao` + * :c:func:`import_trexio_determinants` + * :c:func:`import_trexio_integrals` + * :c:func:`increment_n_iter` * :c:func:`initialize_mo_coef_begin_iteration` * :c:func:`insert_into_ao_integrals_erf_map` * :c:func:`insert_into_ao_integrals_map` - * :c:func:`insertion_dsort` - * :c:func:`insertion_dsort_big` - * :c:func:`insertion_i2sort` - * :c:func:`insertion_i2sort_big` - * :c:func:`insertion_i8sort` - * :c:func:`insertion_i8sort_big` - * :c:func:`insertion_isort` - * :c:func:`insertion_isort_big` - * :c:func:`insertion_sort` - * :c:func:`insertion_sort_big` * :c:func:`int_gaus_pol` + * :c:func:`integral_f_hf_valence_ab` * :c:func:`integrale_new` + * :c:func:`integrale_new_cgtos` + * :c:func:`integrale_new_cosgtos` * :c:func:`integrale_new_erf` * :c:func:`is_a_1h` * :c:func:`is_a_1h1p` @@ -1208,34 +1952,49 @@ Index of Subroutines/Functions * :c:func:`is_connected_to_by_single` * :c:func:`is_i_in_virtual` * :c:func:`is_in_wavefunction` + * :c:func:`is_integer_in_string` + * :c:func:`is_same_spin` * :c:func:`is_spin_flip_possible` * :c:func:`is_the_hole_in_det` * :c:func:`is_the_particl_in_det` * :c:func:`iset_order` * :c:func:`iset_order_big` - * :c:func:`isort` + * :c:func:`json_close` * :c:func:`knowles_function` + * :c:func:`kronecker_delta` * :c:func:`ks_scf` * :c:func:`lapack_diag` + * :c:func:`lapack_diag_complex` * :c:func:`lapack_diagd` + * :c:func:`lapack_diagd_complex` + * :c:func:`lapack_diagd_diag_complex` + * :c:func:`lapack_diagd_diag_in_place_complex` + * :c:func:`lccsd` * :c:func:`list_to_bitstring` - * :c:func:`load_ao_integrals` * :c:func:`load_ao_integrals_erf` * :c:func:`load_mo_integrals` * :c:func:`load_mo_integrals_erf` + * :c:func:`lock_io` + * :c:func:`logabsgamma` * :c:func:`logfact` * :c:func:`lowercase` + * :c:func:`main` * :c:func:`make_s2_eigenfunction` * :c:func:`make_selection_buffer_s2` * :c:func:`map_load_from_disk` * :c:func:`map_save_to_disk` + * :c:func:`mat_to_vec_index` + * :c:func:`matrix_vector_product_complex` * :c:func:`memory_of_double` + * :c:func:`memory_of_double8` * :c:func:`memory_of_int` + * :c:func:`memory_of_int8` * :c:func:`merge_selection_buffers` * :c:func:`mix_mo_jk` * :c:func:`mo_as_eigvectors_of_mo_matrix` * :c:func:`mo_as_svd_vectors_of_mo_matrix` * :c:func:`mo_as_svd_vectors_of_mo_matrix_eig` + * :c:func:`mo_coef_new_as_svd_vectors_of_mo_matrix_eig` * :c:func:`mo_to_ao` * :c:func:`mo_to_ao_no_overlap` * :c:func:`mo_two_e_integral` @@ -1245,13 +2004,33 @@ Index of Subroutines/Functions * :c:func:`modify_bitmasks_for_hole` * :c:func:`modify_bitmasks_for_hole_in_out` * :c:func:`modify_bitmasks_for_particl` + * :c:func:`mol_properties` * :c:func:`molden` + * :c:func:`molden_attachment` + * :c:func:`mp2` * :c:func:`mpi_print` + * :c:func:`mu_correction_of_on_top` + * :c:func:`mu_grad_rho_func` + * :c:func:`mu_rs_c` + * :c:func:`multiply_cpoly` * :c:func:`multiply_poly` + * :c:func:`multiply_poly_b0` + * :c:func:`multiply_poly_b1` + * :c:func:`multiply_poly_b2` + * :c:func:`multiply_poly_c0` + * :c:func:`multiply_poly_c1` + * :c:func:`multiply_poly_c2` + * :c:func:`multiply_poly_c2_inline_2e` + * :c:func:`multiply_poly_local` + * :c:func:`multiply_poly_v` * :c:func:`n_pt_sup` * :c:func:`nai_pol_mult` + * :c:func:`nai_pol_mult_cosgtos` * :c:func:`nai_pol_mult_erf` * :c:func:`nai_pol_mult_erf_ao` + * :c:func:`nai_pol_mult_erf_ao_with1s` + * :c:func:`nai_pol_mult_erf_v` + * :c:func:`nai_pol_mult_erf_with1s_v` * :c:func:`new_parallel_job` * :c:func:`new_zmq_pair_socket` * :c:func:`new_zmq_pull_socket` @@ -1259,27 +2038,73 @@ Index of Subroutines/Functions * :c:func:`new_zmq_sub_socket` * :c:func:`new_zmq_to_qp_run_socket` * :c:func:`normalize` + * :c:func:`nullify_small_elements` * :c:func:`number_of_holes` * :c:func:`number_of_holes_verbose` * :c:func:`number_of_particles` * :c:func:`number_of_particles_verbose` - * :c:func:`occ_pattern_of_det` - * :c:func:`occ_pattern_search_key` - * :c:func:`occ_pattern_to_dets` - * :c:func:`occ_pattern_to_dets_size` + * :c:func:`orb_range_2_rdm_openmp` + * :c:func:`orb_range_2_rdm_openmp_work` + * :c:func:`orb_range_2_rdm_openmp_work_1` + * :c:func:`orb_range_2_rdm_openmp_work_2` + * :c:func:`orb_range_2_rdm_openmp_work_3` + * :c:func:`orb_range_2_rdm_openmp_work_4` + * :c:func:`orb_range_2_rdm_openmp_work_n_int` + * :c:func:`orb_range_2_rdm_state_av_openmp` + * :c:func:`orb_range_2_rdm_state_av_openmp_work` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_1` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_2` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_3` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_4` + * :c:func:`orb_range_2_rdm_state_av_openmp_work_n_int` + * :c:func:`orb_range_2_trans_rdm_openmp` + * :c:func:`orb_range_2_trans_rdm_openmp_work` + * :c:func:`orb_range_2_trans_rdm_openmp_work_1` + * :c:func:`orb_range_2_trans_rdm_openmp_work_2` + * :c:func:`orb_range_2_trans_rdm_openmp_work_3` + * :c:func:`orb_range_2_trans_rdm_openmp_work_4` + * :c:func:`orb_range_2_trans_rdm_openmp_work_n_int` + * :c:func:`orb_range_diag_to_all_2_rdm_dm_buffer` + * :c:func:`orb_range_diag_to_all_states_2_rdm_dm_buffer` + * :c:func:`orb_range_diag_to_all_states_2_rdm_trans_buffer` + * :c:func:`orb_range_off_diag_double_to_2_rdm_aa_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_2_rdm_ab_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_2_rdm_bb_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_aa_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_aa_trans_rdm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_ab_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_ab_trans_rdm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_bb_dm_buffer` + * :c:func:`orb_range_off_diag_double_to_all_states_trans_rdm_bb_buffer` + * :c:func:`orb_range_off_diag_single_to_2_rdm_aa_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_2_rdm_ab_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_2_rdm_bb_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_aa_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_aa_trans_rdm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_ab_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_ab_trans_rdm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_bb_dm_buffer` + * :c:func:`orb_range_off_diag_single_to_all_states_bb_trans_rdm_buffer` + * :c:func:`ormas_occ` * :c:func:`ortho_canonical` + * :c:func:`ortho_canonical_complex` * :c:func:`ortho_lowdin` + * :c:func:`ortho_lowdin_complex` * :c:func:`ortho_qr` + * :c:func:`ortho_qr_complex` * :c:func:`ortho_qr_unblocked` + * :c:func:`ortho_qr_unblocked_complex` + * :c:func:`ortho_svd` * :c:func:`orthonormalize_mos` * :c:func:`overlap_bourrin_deriv_x` * :c:func:`overlap_bourrin_dipole` * :c:func:`overlap_bourrin_spread` * :c:func:`overlap_bourrin_x` + * :c:func:`overlap_cgaussian_x` * :c:func:`overlap_gaussian_x` + * :c:func:`overlap_gaussian_xyz` + * :c:func:`overlap_gaussian_xyz_v` * :c:func:`overlap_x_abs` - * :c:func:`past_d1` - * :c:func:`past_d2` * :c:func:`perturb_buffer_by_mono_dummy` * :c:func:`perturb_buffer_by_mono_epstein_nesbet` * :c:func:`perturb_buffer_by_mono_epstein_nesbet_2x2` @@ -1292,24 +2117,53 @@ Index of Subroutines/Functions * :c:func:`perturb_buffer_epstein_nesbet_2x2_no_ci_diag` * :c:func:`perturb_buffer_moller_plesset` * :c:func:`perturb_buffer_qdpt` + * :c:func:`pivoted_cholesky` + * :c:func:`pol_modif_center` + * :c:func:`pol_modif_center_x` * :c:func:`primitive_value` + * :c:func:`primitive_value_explicit` + * :c:func:`print_2rdm` * :c:func:`print_ci_vectors` * :c:func:`print_det` - * :c:func:`print_e_conv` + * :c:func:`print_det_one_dimension` + * :c:func:`print_detweights` + * :c:func:`print_dipole` + * :c:func:`print_dipole_moment` + * :c:func:`print_dipole_moments` + * :c:func:`print_energy` * :c:func:`print_energy_components` + * :c:func:`print_exc` * :c:func:`print_extrapolated_energy` + * :c:func:`print_fock_diag` * :c:func:`print_generators_bitmasks_holes` - * :c:func:`print_generators_bitmasks_holes_for_one_generator` * :c:func:`print_generators_bitmasks_particles` - * :c:func:`print_generators_bitmasks_particles_for_one_generator` + * :c:func:`print_grad` + * :c:func:`print_hamiltonian` * :c:func:`print_memory_usage` + * :c:func:`print_mol_properties` + * :c:func:`print_mos` + * :c:func:`print_oscillator_strength` + * :c:func:`print_pseudo_overlap` + * :c:func:`print_scf_int` + * :c:func:`print_sorted_wf_coef` * :c:func:`print_spindet` * :c:func:`print_summary` + * :c:func:`print_summary_tc` + * :c:func:`print_transition_dipole_moment` + * :c:func:`print_var_energy` * :c:func:`print_wf` + * :c:func:`projected_operators` * :c:func:`provide_all_mo_integrals_erf` * :c:func:`provide_everything` + * :c:func:`provide_for_selection_slave` + * :c:func:`provide_for_zmq_pt2` * :c:func:`pt2` + * :c:func:`pt2_add` + * :c:func:`pt2_add2` + * :c:func:`pt2_alloc` * :c:func:`pt2_collector` + * :c:func:`pt2_dealloc` + * :c:func:`pt2_deserialize` * :c:func:`pt2_dummy` * :c:func:`pt2_epstein_nesbet` * :c:func:`pt2_epstein_nesbet_2x2` @@ -1318,12 +2172,11 @@ Index of Subroutines/Functions * :c:func:`pt2_find_sample_lr` * :c:func:`pt2_moller_plesset` * :c:func:`pt2_qdpt` + * :c:func:`pt2_serialize` * :c:func:`pt2_slave_inproc` - * :c:func:`pull_pt2` * :c:func:`pull_pt2_results` * :c:func:`pull_selection_results` * :c:func:`push_integrals` - * :c:func:`push_pt2` * :c:func:`push_pt2_results` * :c:func:`push_pt2_results_async_recv` * :c:func:`push_pt2_results_async_send` @@ -1332,37 +2185,52 @@ Index of Subroutines/Functions * :c:func:`qrpa` * :c:func:`qrpad` * :c:func:`qrpadd` - * :c:func:`quick_dsort` - * :c:func:`quick_i2sort` - * :c:func:`quick_i8sort` - * :c:func:`quick_isort` - * :c:func:`quick_sort` + * :c:func:`randomized_svd` + * :c:func:`read_array_two_rdm` + * :c:func:`read_array_two_trans_rdm` * :c:func:`read_dets` + * :c:func:`read_spindeterminants` + * :c:func:`recentered_cpoly2` * :c:func:`recentered_poly2` + * :c:func:`recentered_poly2_v` + * :c:func:`recentered_poly2_v0` * :c:func:`remove_duplicates_in_psi_det` * :c:func:`remove_duplicates_in_selection_buffer` * :c:func:`remove_small_contributions` * :c:func:`reorder_core_orb` + * :c:func:`reorder_mo_max_overlap` + * :c:func:`reorder_orbitals_for_casscf` + * :c:func:`replace_wf` * :c:func:`reset_zmq_addresses` * :c:func:`resident_memory` * :c:func:`resize_h_apply_buffer` + * :c:func:`restore_symmetry` * :c:func:`rho_ab_to_rho_oc` * :c:func:`rho_oc_to_rho_ab` * :c:func:`rint` * :c:func:`rint1` * :c:func:`rint_large_n` * :c:func:`rint_sum` - * :c:func:`rinteg` - * :c:func:`rintgauss` * :c:func:`roothaan_hall_scf` * :c:func:`rotate_mos` + * :c:func:`rotation_matrix` + * :c:func:`rotation_matrix_iterative` * :c:func:`routine` - * :c:func:`routine_e_conv` + * :c:func:`routine_active_only` + * :c:func:`routine_active_only_trans` + * :c:func:`routine_bielec_pqxx_no` + * :c:func:`routine_bielec_pxxq_no_array` * :c:func:`routine_example_psi_det` + * :c:func:`routine_full_mos` + * :c:func:`routine_s2` * :c:func:`routine_save_one_e_dm` + * :c:func:`routine_test_cas_based_density` * :c:func:`rs_ks_scf` * :c:func:`run` * :c:func:`run_cipsi` + * :c:func:`run_cisd` + * :c:func:`run_optimization_mos_cipsi` + * :c:func:`run_orb_opt_trust_v2` * :c:func:`run_pt2_slave` * :c:func:`run_pt2_slave_large` * :c:func:`run_pt2_slave_small` @@ -1372,91 +2240,158 @@ Index of Subroutines/Functions * :c:func:`run_stochastic_cipsi` * :c:func:`s2_u_0` * :c:func:`s2_u_0_nstates` - * :c:func:`sabpartial` * :c:func:`save_energy` * :c:func:`save_erf_two_e_integrals_ao` * :c:func:`save_erf_two_e_integrals_mo` * :c:func:`save_erf_two_e_ints_ao_into_ints_ao` * :c:func:`save_erf_two_e_ints_mo_into_ints_mo` - * :c:func:`save_iterations` * :c:func:`save_mos` + * :c:func:`save_mos_no_occ` * :c:func:`save_mos_truncated` * :c:func:`save_natorb` + * :c:func:`save_natorb_no_ov_rot` + * :c:func:`save_natorb_no_ref` * :c:func:`save_natural_mos` + * :c:func:`save_natural_mos_canon_label` + * :c:func:`save_natural_mos_no_ov_rot` * :c:func:`save_one_e_dm` * :c:func:`save_ortho_mos` * :c:func:`save_ref_determinant` * :c:func:`save_wavefunction` * :c:func:`save_wavefunction_general` + * :c:func:`save_wavefunction_general_unormalized` * :c:func:`save_wavefunction_specified` * :c:func:`save_wavefunction_truncated` * :c:func:`save_wavefunction_unsorted` * :c:func:`scf` * :c:func:`select_connected` + * :c:func:`select_singles` * :c:func:`select_singles_and_doubles` * :c:func:`selection_collector` * :c:func:`selection_slave_inproc` * :c:func:`set_bit_to_integer` * :c:func:`set_bitmask_hole_as_input` * :c:func:`set_bitmask_particl_as_input` + * :c:func:`set_multiple_levels_omp` + * :c:func:`set_natorb_no_ov_rot` * :c:func:`set_natural_mos` + * :c:func:`set_natural_mos_canon_label` * :c:func:`set_order` * :c:func:`set_order_big` + * :c:func:`shank` + * :c:func:`shank_function` + * :c:func:`shank_general` * :c:func:`single_excitation_wee` - * :c:func:`sort` * :c:func:`sort_by_fock_energies` * :c:func:`sort_dets_ab` * :c:func:`sort_dets_ab_v` * :c:func:`sort_dets_ba_v` * :c:func:`sort_dets_by_det_search_key` * :c:func:`sort_selection_buffer` + * :c:func:`sort_wf` * :c:func:`sorted_dnumber` * :c:func:`sorted_i2number` * :c:func:`sorted_i8number` * :c:func:`sorted_inumber` * :c:func:`sorted_number` * :c:func:`spin_det_search_key` + * :c:func:`splash_p` * :c:func:`splash_pq` + * :c:func:`spot_hasbeen` * :c:func:`spot_isinwf` + * :c:func:`state_average_energy` + * :c:func:`state_weight_normalization` + * :c:func:`step_f` * :c:func:`step_function_becke` + * :c:func:`sub_a_at` + * :c:func:`sub_to_full_rotation_matrix` + * :c:func:`sum_a_at` * :c:func:`svd` + * :c:func:`svd_complex` + * :c:func:`svd_symm` * :c:func:`swap_mos` * :c:func:`switch_qp_run_to_master` * :c:func:`tamiser` * :c:func:`task_done_to_taskserver` * :c:func:`tasks_done_to_taskserver` * :c:func:`test` + * :c:func:`test_2_rdm` + * :c:func:`test_bielec_pqxx` + * :c:func:`test_bielec_pxxq_chol` + * :c:func:`test_chol` + * :c:func:`test_dav` + * :c:func:`test_dav_dress` + * :c:func:`test_f_hf_valence_ab` + * :c:func:`test_f_ia_valence_ab` + * :c:func:`test_f_ii_ia_aa_valence_ab` + * :c:func:`test_f_ii_valence_ab` + * :c:func:`test_proj_op` * :c:func:`testteethbuilding` * :c:func:`total_memory` + * :c:func:`truncate_wf` + * :c:func:`trust_region_expected_e` + * :c:func:`trust_region_is_step_cancelled` + * :c:func:`trust_region_optimal_lambda` + * :c:func:`trust_region_rho` + * :c:func:`trust_region_step` + * :c:func:`trust_region_step_w_expected_e` * :c:func:`two_e_integrals_index` + * :c:func:`two_e_integrals_index_2fold` * :c:func:`two_e_integrals_index_reverse` + * :c:func:`two_e_integrals_index_reverse_2fold` * :c:func:`u_0_h_u_0` * :c:func:`u_0_h_u_0_two_e` + * :c:func:`u_0_hs2_u_0` * :c:func:`u_0_s2_u_0` * :c:func:`u_dot_u` * :c:func:`u_dot_v` + * :c:func:`unlock_io` + * :c:func:`update_keys_values` + * :c:func:`update_keys_values_n_states` + * :c:func:`update_keys_values_n_states_trans` + * :c:func:`update_parameters` * :c:func:`update_pt2_and_variance_weights` - * :c:func:`v_e_n` + * :c:func:`update_st_av_ci_energy` + * :c:func:`update_wf_of_psi_bilinear_matrix` + * :c:func:`v2_over_x` + * :c:func:`v_grad_rho_ab_to_v_grad_rho_oc` * :c:func:`v_grad_rho_oc_to_v_grad_rho_ab` + * :c:func:`v_n_e` + * :c:func:`v_n_e_cgtos` + * :c:func:`v_n_e_cosgtos` * :c:func:`v_phi` * :c:func:`v_r` + * :c:func:`v_r_cgtos` + * :c:func:`v_r_cosgtos` * :c:func:`v_rho_ab_to_v_rho_oc` * :c:func:`v_rho_oc_to_v_rho_ab` * :c:func:`v_theta` * :c:func:`vcorrlr` + * :c:func:`vec_to_mat_index` + * :c:func:`vec_to_mat_v2` * :c:func:`wait_for_next_state` * :c:func:`wait_for_state` * :c:func:`wait_for_states` * :c:func:`wall_time` * :c:func:`wallis` * :c:func:`wf_of_psi_bilinear_matrix` + * :c:func:`write_array_two_rdm` + * :c:func:`write_array_two_trans_rdm` * :c:func:`write_bool` + * :c:func:`write_c_ij_ab` + * :c:func:`write_cipsi_json` * :c:func:`write_double` * :c:func:`write_git_log` * :c:func:`write_int` * :c:func:`write_integrals_erf` + * :c:func:`write_on_top_in_real_space` * :c:func:`write_spindeterminants` * :c:func:`write_time` + * :c:func:`zboysfun` + * :c:func:`zboysfun00_1` + * :c:func:`zboysfun00_2` + * :c:func:`zboysfun00nrp` + * :c:func:`zboysfunnrp` * :c:func:`zmq_abort` * :c:func:`zmq_delete_task` * :c:func:`zmq_delete_task_async_recv` diff --git a/docs/source/programs/cisd.rst b/docs/source/programs/cisd.rst index 1a61760d..760ce50c 100644 --- a/docs/source/programs/cisd.rst +++ b/docs/source/programs/cisd.rst @@ -72,9 +72,13 @@ cisd .. hlist:: :columns: 3 - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`fock_matrix_ao_alpha` - * :c:data:`mo_coef` - * :c:data:`level_shift` - * :c:data:`mo_coef` + * :c:data:`psi_configuration` + * :c:data:`n_det` + * :c:data:`c0_weight` + * :c:data:`psi_coef` + * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` + * :c:data:`psi_det` + * :c:data:`psi_det_size` + * :c:data:`psi_det_sorted_bit` * :c:data:`read_wf` diff --git a/docs/source/programs/fci.rst b/docs/source/programs/fci.rst index daccc0d1..00c39960 100644 --- a/docs/source/programs/fci.rst +++ b/docs/source/programs/fci.rst @@ -50,15 +50,20 @@ fci * :c:data:`do_pt2` * :c:data:`is_zmq_slave` + * :c:data:`json_int_fmt` + * :c:data:`json_unit` * :c:data:`mo_two_e_integrals_in_map` + * :c:data:`n_states` * :c:data:`psi_coef` * :c:data:`psi_det` + * :c:data:`pt2_min_parallel_tasks` Calls: .. hlist:: :columns: 3 + * :c:func:`json_close` * :c:func:`run_cipsi` * :c:func:`run_slave_cipsi` * :c:func:`run_stochastic_cipsi` @@ -72,18 +77,19 @@ fci * :c:data:`ci_electronic_energy` * :c:data:`ci_energy` * :c:data:`ci_electronic_energy` + * :c:data:`psi_configuration` * :c:data:`n_det` - * :c:data:`n_iter` - * :c:data:`psi_occ_pattern` + * :c:data:`n_det_generators` + * :c:data:`n_det_selectors` * :c:data:`c0_weight` * :c:data:`distributed_davidson` * :c:data:`psi_coef` * :c:data:`psi_det_sorted_bit` + * :c:data:`psi_configuration` * :c:data:`psi_det` * :c:data:`psi_det_size` * :c:data:`psi_det_sorted_bit` * :c:data:`psi_energy` - * :c:data:`psi_occ_pattern` * :c:data:`psi_energy` * :c:data:`pt2_e0_denominator` * :c:data:`pt2_match_weight` diff --git a/docs/source/programs/four_idx_transform.rst b/docs/source/programs/four_idx_transform.rst index 220433e1..5a649722 100644 --- a/docs/source/programs/four_idx_transform.rst +++ b/docs/source/programs/four_idx_transform.rst @@ -24,6 +24,7 @@ four_idx_transform .. hlist:: :columns: 3 + * :c:data:`do_mo_cholesky` * :c:data:`io_mo_two_e_integrals` * :c:data:`mo_two_e_integrals_in_map` diff --git a/docs/source/programs/pt2.rst b/docs/source/programs/pt2.rst index 2df4377d..5da8e90e 100644 --- a/docs/source/programs/pt2.rst +++ b/docs/source/programs/pt2.rst @@ -46,10 +46,18 @@ pt2 .. hlist:: :columns: 3 + * :c:data:`n_det_generators` + * :c:data:`n_det_selectors` * :c:data:`distributed_davidson` + * :c:data:`psi_coef` + * :c:data:`psi_det` * :c:data:`pt2_e0_denominator` + * :c:data:`pt2_match_weight` + * :c:data:`pt2_overlap` * :c:data:`pt2_stoch_istate` * :c:data:`read_wf` * :c:data:`selection_weight` * :c:data:`state_average_weight` + * :c:data:`threshold_davidson_pt2` * :c:data:`threshold_generators` + * :c:data:`variance_match_weight` diff --git a/docs/source/programs/rs_ks_scf.rst b/docs/source/programs/rs_ks_scf.rst index 597a92b8..1d6a32b7 100644 --- a/docs/source/programs/rs_ks_scf.rst +++ b/docs/source/programs/rs_ks_scf.rst @@ -30,7 +30,6 @@ rs_ks_scf .. hlist:: :columns: 3 - * :c:func:`check_coherence_functional` * :c:func:`create_guess` * :c:func:`orthonormalize_mos` * :c:func:`run` diff --git a/docs/source/programs/save_natorb.rst b/docs/source/programs/save_natorb.rst index 87dce047..e79f96cf 100644 --- a/docs/source/programs/save_natorb.rst +++ b/docs/source/programs/save_natorb.rst @@ -25,6 +25,7 @@ save_natorb .. hlist:: :columns: 3 + * :c:data:`nucl_coord` * :c:data:`read_wf` Calls: diff --git a/docs/source/programs/scf.rst b/docs/source/programs/scf.rst index 3b8035f7..0c70d00a 100644 --- a/docs/source/programs/scf.rst +++ b/docs/source/programs/scf.rst @@ -58,5 +58,9 @@ scf * :c:data:`fock_matrix_ao_alpha` * :c:data:`fock_matrix_ao_alpha` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`fock_matrix_ao_alpha` + * :c:data:`mo_coef` + * :c:data:`level_shift` * :c:data:`mo_coef` * :c:data:`mo_label` diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg new file mode 100644 index 00000000..bddf4d37 --- /dev/null +++ b/plugins/local/ao_extra_basis/EZFIO.cfg @@ -0,0 +1,87 @@ +[ao_extra_basis] +type: character*(256) +doc: Name of the |ao_extra| basis set +interface: ezfio + +[ao_extra_num] +type: integer +doc: Number of |ao_extras| +interface: ezfio, provider + +[ao_extra_prim_num] +type: integer +doc: Number of primitives per |ao_extra| +size: (extra_basis.ao_extra_num) +interface: ezfio, provider + +[ao_extra_prim_num_max] +type: integer +doc: Maximum number of primitives +default: =maxval(extra_basis.ao_extra_prim_num) +interface: ezfio + +[ao_extra_nucl] +type: integer +doc: Index of the nucleus on which the |ao_extra| is centered +size: (extra_basis.ao_extra_num) +interface: ezfio, provider + +[ao_extra_power] +type: integer +doc: Powers of x, y and z for each |ao_extra| +size: (extra_basis.ao_extra_num,3) +interface: ezfio, provider + +[ao_extra_coef] +type: double precision +doc: Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** ao_extras. +size: (extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_expo] +type: double precision +doc: Exponents for each primitive of each |ao_extra| +size: (extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_md5] +type: character*(32) +doc: MD5 key, specific of the |ao_extra| basis +interface: ezfio, provider + +[ao_extra_cartesian] +type: logical +doc: If |true|, use |ao_extras| in Cartesian coordinates (6d,10f,...) +interface: ezfio, provider +default: false + +[ao_extra_normalized] +type: logical +doc: Use normalized basis functions +interface: ezfio, provider +default: true + +[primitives_normalized_extra] +type: logical +doc: Use normalized primitive functions +interface: ezfio, provider +default: true + +[ao_extra_expo_im] +type: double precision +doc: imag part for Exponents for each primitive of each cGTOs |ao_extra| +size: (extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_expo_pw] +type: double precision +doc: plane wave part for each primitive GTOs |ao_extra| +size: (3,extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_expo_phase] +type: double precision +doc: phase shift for each primitive GTOs |ao_extra| +size: (3,extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + diff --git a/plugins/local/ao_extra_basis/NEED b/plugins/local/ao_extra_basis/NEED new file mode 100644 index 00000000..c4e8c3cf --- /dev/null +++ b/plugins/local/ao_extra_basis/NEED @@ -0,0 +1,3 @@ +extra_nuclei +basis +ao_basis diff --git a/plugins/local/ao_extra_basis/README.rst b/plugins/local/ao_extra_basis/README.rst new file mode 100644 index 00000000..3d1dc813 --- /dev/null +++ b/plugins/local/ao_extra_basis/README.rst @@ -0,0 +1,4 @@ +=========== +extra_basis +=========== + diff --git a/plugins/local/ao_extra_basis/aos.irp.f b/plugins/local/ao_extra_basis/aos.irp.f new file mode 100644 index 00000000..56d6fb04 --- /dev/null +++ b/plugins/local/ao_extra_basis/aos.irp.f @@ -0,0 +1,325 @@ +BEGIN_PROVIDER [ integer, ao_extra_prim_num_max ] + implicit none + BEGIN_DOC + ! Max number of primitives. + END_DOC + ao_extra_prim_num_max = maxval(ao_extra_prim_num) +END_PROVIDER + +BEGIN_PROVIDER [ integer, ao_extra_shell, (ao_extra_num) ] + implicit none + BEGIN_DOC + ! Index of the shell to which the ao_extra corresponds + END_DOC + integer :: i, j, k, n + k=0 + do i=1,shell_num + n = shell_ang_mom(i)+1 + do j=1,(n*(n+1))/2 + k = k+1 + ao_extra_shell(k) = i + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ integer, ao_extra_first_of_shell, (shell_num) ] + implicit none + BEGIN_DOC + ! Index of the shell to which the ao_extra corresponds + END_DOC + integer :: i, j, k, n + k=1 + do i=1,shell_num + ao_extra_first_of_shell(i) = k + n = shell_ang_mom(i)+1 + k = k+(n*(n+1))/2 + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized, (ao_extra_num,ao_extra_prim_num_max) ] +&BEGIN_PROVIDER [ double precision, ao_extra_coef_normalization_factor, (ao_extra_num) ] + implicit none + BEGIN_DOC + ! Coefficients including the |ao_extra| normalization + END_DOC + double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c + integer :: l, powA(3), nz + integer :: i,j,k + nz=100 + C_A(1) = 0.d0 + C_A(2) = 0.d0 + C_A(3) = 0.d0 + ao_extra_coef_normalized = 0.d0 + + do i=1,ao_extra_num + +! powA(1) = ao_extra_power(i,1) + ao_extra_power(i,2) + ao_extra_power(i,3) +! powA(2) = 0 +! powA(3) = 0 + powA(1) = ao_extra_power(i,1) + powA(2) = ao_extra_power(i,2) + powA(3) = ao_extra_power(i,3) + + ! Normalization of the primitives + if (primitives_normalized_extra) then + do j=1,ao_extra_prim_num(i) + call overlap_gaussian_xyz(C_A,C_A,ao_extra_expo(i,j),ao_extra_expo(i,j), & + powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) + ao_extra_coef_normalized(i,j) = ao_extra_coef(i,j)/dsqrt(norm) + enddo + else + do j=1,ao_extra_prim_num(i) + ao_extra_coef_normalized(i,j) = ao_extra_coef(i,j) + enddo + endif + + ! Normalization of the contracted basis functions + if (ao_extra_normalized) then + norm = 0.d0 + do j=1,ao_extra_prim_num(i) + do k=1,ao_extra_prim_num(i) + call overlap_gaussian_xyz(C_A,C_A,ao_extra_expo(i,j),ao_extra_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) + norm = norm+c*ao_extra_coef_normalized(i,j)*ao_extra_coef_normalized(i,k) + enddo + enddo + ao_extra_coef_normalization_factor(i) = 1.d0/dsqrt(norm) + else + ao_extra_coef_normalization_factor(i) = 1.d0 + endif + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered, (ao_extra_num,ao_extra_prim_num_max) ] +&BEGIN_PROVIDER [ double precision, ao_extra_expo_ordered, (ao_extra_num,ao_extra_prim_num_max) ] + implicit none + BEGIN_DOC + ! Sorted primitives to accelerate 4 index |MO| transformation + END_DOC + + integer :: iorder(ao_extra_prim_num_max) + double precision :: d(ao_extra_prim_num_max,2) + integer :: i,j + do i=1,ao_extra_num + do j=1,ao_extra_prim_num(i) + iorder(j) = j + d(j,1) = ao_extra_expo(i,j) + d(j,2) = ao_extra_coef_normalized(i,j) + enddo + call dsort(d(1,1),iorder,ao_extra_prim_num(i)) + call dset_order(d(1,2),iorder,ao_extra_prim_num(i)) + do j=1,ao_extra_prim_num(i) + ao_extra_expo_ordered(i,j) = d(j,1) + ao_extra_coef_normalized_ordered(i,j) = d(j,2) + enddo + enddo +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered_transp, (ao_extra_prim_num_max,ao_extra_num) ] + implicit none + BEGIN_DOC + ! Transposed :c:data:`ao_extra_coef_normalized_ordered` + END_DOC + integer :: i,j + do j=1, ao_extra_num + do i=1, ao_extra_prim_num_max + ao_extra_coef_normalized_ordered_transp(i,j) = ao_extra_coef_normalized_ordered(j,i) + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_expo_ordered_transp, (ao_extra_prim_num_max,ao_extra_num) ] + implicit none + BEGIN_DOC + ! Transposed :c:data:`ao_extra_expo_ordered` + END_DOC + integer :: i,j + do j=1, ao_extra_num + do i=1, ao_extra_prim_num_max + ao_extra_expo_ordered_transp(i,j) = ao_extra_expo_ordered(j,i) + enddo + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ integer, ao_extra_l, (ao_extra_num) ] +&BEGIN_PROVIDER [ integer, ao_extra_l_max ] +&BEGIN_PROVIDER [ character*(128), ao_extra_l_char, (ao_extra_num) ] + implicit none + BEGIN_DOC +! :math:`l` value of the |ao_extra|: :math`a+b+c` in :math:`x^a y^b z^c` + END_DOC + integer :: i + do i=1,ao_extra_num + ao_extra_l(i) = ao_extra_power(i,1) + ao_extra_power(i,2) + ao_extra_power(i,3) + ao_extra_l_char(i) = l_to_character(ao_extra_l(i)) + enddo + ao_extra_l_max = maxval(ao_extra_l) +END_PROVIDER + +integer function ao_extra_power_index(nx,ny,nz) + implicit none + integer, intent(in) :: nx, ny, nz + BEGIN_DOC + ! Unique index given to a triplet of powers: + ! + ! :math:`\frac{1}{2} (l-n_x) (l-n_x+1) + n_z + 1` + END_DOC + integer :: l + l = nx + ny + nz + ao_extra_power_index = ((l-nx)*(l-nx+1))/2 + nz + 1 +end + + + BEGIN_PROVIDER [ integer, Nucl_N_ao_extras, (extra_nucl_num)] +&BEGIN_PROVIDER [ integer, N_ao_extras_max ] + implicit none + BEGIN_DOC + ! Number of |ao_extras| per atom + END_DOC + integer :: i + Nucl_N_ao_extras = 0 + do i = 1, ao_extra_num + Nucl_N_ao_extras(ao_extra_nucl(i)) +=1 + enddo + N_ao_extras_max = maxval(Nucl_N_ao_extras) +END_PROVIDER + + BEGIN_PROVIDER [ integer, Nucl_ao_extras, (extra_nucl_num,N_ao_extras_max)] + implicit none + BEGIN_DOC + ! List of |ao_extras| centered on each atom + END_DOC + integer :: i + integer, allocatable :: nucl_tmp(:) + allocate(nucl_tmp(nucl_num)) + nucl_tmp = 0 + Nucl_ao_extras = 0 + do i = 1, ao_extra_num + nucl_tmp(ao_extra_nucl(i))+=1 + Nucl_ao_extras(ao_extra_nucl(i),nucl_tmp(ao_extra_nucl(i))) = i + enddo + deallocate(nucl_tmp) +END_PROVIDER + + + BEGIN_PROVIDER [ integer, Nucl_list_shell_ao_extras, (extra_nucl_num,N_ao_extras_max)] +&BEGIN_PROVIDER [ integer, Nucl_num_shell_ao_extras, (nucl_num)] + implicit none + integer :: i,j,k + BEGIN_DOC + ! Index of the shell type |ao_extras| and of the corresponding |ao_extras| + ! By convention, for p,d,f and g |ao_extras|, we take the index + ! of the |ao_extra| with the the corresponding power in the x axis + END_DOC + do i = 1, extra_nucl_num + Nucl_num_shell_ao_extras(i) = 0 + do j = 1, Nucl_N_ao_extras(i) + if (ao_extra_power(Nucl_ao_extras(i,j),1) == ao_extra_l(Nucl_ao_extras(i,j))) then + Nucl_num_shell_ao_extras(i)+=1 + Nucl_list_shell_ao_extras(i,Nucl_num_shell_ao_extras(i))=Nucl_ao_extras(i,j) + endif + enddo + enddo + +END_PROVIDER + + +BEGIN_PROVIDER [ character*(4), ao_extra_l_char_space, (ao_extra_num) ] + implicit none + BEGIN_DOC +! Converts an l value to a string + END_DOC + integer :: i + character*(4) :: give_ao_extra_character_space + do i=1,ao_extra_num + + if(ao_extra_l(i)==0)then + ! S type ao_extra + give_ao_extra_character_space = 'S ' + elseif(ao_extra_l(i) == 1)then + ! P type ao_extra + if(ao_extra_power(i,1)==1)then + give_ao_extra_character_space = 'X ' + elseif(ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'Y ' + else + give_ao_extra_character_space = 'Z ' + endif + elseif(ao_extra_l(i) == 2)then + ! D type ao_extra + if(ao_extra_power(i,1)==2)then + give_ao_extra_character_space = 'XX ' + elseif(ao_extra_power(i,2) == 2)then + give_ao_extra_character_space = 'YY ' + elseif(ao_extra_power(i,3) == 2)then + give_ao_extra_character_space = 'ZZ ' + elseif(ao_extra_power(i,1) == 1 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'XY ' + elseif(ao_extra_power(i,1) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XZ ' + else + give_ao_extra_character_space = 'YZ ' + endif + elseif(ao_extra_l(i) == 3)then + ! F type ao_extra + if(ao_extra_power(i,1)==3)then + give_ao_extra_character_space = 'XXX ' + elseif(ao_extra_power(i,2) == 3)then + give_ao_extra_character_space = 'YYY ' + elseif(ao_extra_power(i,3) == 3)then + give_ao_extra_character_space = 'ZZZ ' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'XXY ' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XXZ ' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'YYX ' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'YYZ ' + elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'ZZX ' + elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'ZZY ' + elseif(ao_extra_power(i,3) == 1 .and. ao_extra_power(i,2) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XYZ ' + endif + elseif(ao_extra_l(i) == 4)then + ! G type ao_extra + if(ao_extra_power(i,1)==4)then + give_ao_extra_character_space = 'XXXX' + elseif(ao_extra_power(i,2) == 4)then + give_ao_extra_character_space = 'YYYY' + elseif(ao_extra_power(i,3) == 4)then + give_ao_extra_character_space = 'ZZZZ' + elseif(ao_extra_power(i,1) == 3 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'XXXY' + elseif(ao_extra_power(i,1) == 3 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XXXZ' + elseif(ao_extra_power(i,2) == 3 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'YYYX' + elseif(ao_extra_power(i,2) == 3 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'YYYZ' + elseif(ao_extra_power(i,3) == 3 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'ZZZX' + elseif(ao_extra_power(i,3) == 3 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'ZZZY' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 2)then + give_ao_extra_character_space = 'XXYY' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,3) == 2)then + give_ao_extra_character_space = 'YYZZ' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XXYZ' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,1) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'YYXZ' + elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,1) == 1 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'ZZXY' + endif + endif + ao_extra_l_char_space(i) = give_ao_extra_character_space + enddo +END_PROVIDER diff --git a/plugins/local/ao_extra_basis/dimensions_integrals.irp.f b/plugins/local/ao_extra_basis/dimensions_integrals.irp.f new file mode 100644 index 00000000..80dcda18 --- /dev/null +++ b/plugins/local/ao_extra_basis/dimensions_integrals.irp.f @@ -0,0 +1,19 @@ + BEGIN_PROVIDER [ integer, n_pt_max_extra_basis_integrals ] +&BEGIN_PROVIDER [ integer, n_pt_max_extra_basis_i_x] + implicit none + BEGIN_DOC +! Number of points used in the numerical integrations. + END_DOC + integer :: n_pt_sup + integer :: prim_power_l_max + include 'utils/constants.include.F' + prim_power_l_max = maxval(ao_extra_power) + n_pt_max_extra_basis_integrals = 24 * prim_power_l_max + 4 + n_pt_max_extra_basis_i_x = 8 * prim_power_l_max + ASSERT (n_pt_max_extra_basis_i_x-1 <= max_dim) + if (n_pt_max_extra_basis_i_x-1 > max_dim) then + print *, 'Increase max_dim in utils/constants.include.F to ', n_pt_max_extra_basis_i_x-1 + stop 1 + endif +END_PROVIDER + diff --git a/plugins/local/ao_extra_basis/extra_basis.irp.f b/plugins/local/ao_extra_basis/extra_basis.irp.f new file mode 100644 index 00000000..19b36349 --- /dev/null +++ b/plugins/local/ao_extra_basis/extra_basis.irp.f @@ -0,0 +1,15 @@ +program extra_basis + implicit none + BEGIN_DOC +! TODO : Put the documentation of the program here + END_DOC + integer :: i + print*,'extra_nucl_num = ',extra_nucl_num + do i = 1, extra_nucl_num + print*,'i = ',i + print*,'extra_nucl_label = ',extra_nucl_label(i) + print*,'extra_nucl_charge = ',extra_nucl_charge(i) + print*,'extra_nucl_coord = ' + print*,extra_nucl_coord(i,1:3) + enddo +end diff --git a/plugins/local/ao_extra_basis/install b/plugins/local/ao_extra_basis/install new file mode 100755 index 00000000..ca4a1643 --- /dev/null +++ b/plugins/local/ao_extra_basis/install @@ -0,0 +1,23 @@ +#!/bin/bash + +# Check if the QP_ROOT environment variable is set. +if [[ -z ${QP_ROOT} ]] +then + print "The QP_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + +# Get the absolute path of the current directory. +currdir=${PWD} + +# list of the scripts to be used by the module +scripts_list="qp_copy_extra_basis" + +# Make a symbolic link for all scripts to be used in the ${QP_ROOT}/scripts/ +# directory. + for i in $scripts_list + do + ln --symbolic ${currdir}/$i ${QP_ROOT}/scripts/ + done + diff --git a/plugins/local/ao_extra_basis/qp_copy_extra_basis b/plugins/local/ao_extra_basis/qp_copy_extra_basis new file mode 100755 index 00000000..551bbe1f --- /dev/null +++ b/plugins/local/ao_extra_basis/qp_copy_extra_basis @@ -0,0 +1,59 @@ +#!/bin/bash +# specify the QP folder +QP=$QP_ROOT +dir=${QP} +# sourcing the quantum_package.rc file +. ${QP}/quantum_package.rc +EZFIO_extra=${1%/} +EZFIO_target=${2%/} + + + +echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" +echo "Extracting data from "$EZFIO_extra +echo "and Copying data to "$EZFIO_target + +### COPYING ALL DATA FROM $EZFIO_extra/nuclei/ to ${EZFIO_target}/extra_nuclei/ +echo "COPYING ALL DATA FROM "$EZFIO_extra"/nuclei/ to "${EZFIO_target}"/extra_nuclei/" +direxists=false +if [ -d ${EZFIO_target}/extra_nuclei/ ] ; then + direxists=true + echo "The directory extra_nuclei exists" + else + echo "Creating the directory extra_nuclei " + direxists=false + mkdir ${EZFIO_target}/extra_nuclei/ +fi +data=`\ls $EZFIO_extra/nuclei/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/nucl/extra_nucl/g' ` + echo $newfile + cp ${EZFIO_extra}/nuclei/$i ${EZFIO_target}/extra_nuclei/$newfile +done + +### COPYING ALL DATA FROM $EZFIO_extra/ao_basis/ to ${EZFIO_target}/ao_extra_basis/ +direxists=false +if [ -d ${EZFIO_target}/ao_extra_basis/ ] ; then + direxists=true + echo "The directory exists ao_extra_basis" + else + echo "Creating the directory ao_extra_basis" + direxists=false + mkdir ${EZFIO_target}/ao_extra_basis/ +fi +echo "COPYING ALL DATA FROM "$EZFIO_extra"/ao_basis/ to "${EZFIO_target}"/ao_extra_basis/" +data=`\ls $EZFIO_extra/ao_basis/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/ao/ao_extra/g' ` + echo $newfile + cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile +done +i=primitives_normalized +newfile=primitives_normalized_extra +cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile + + diff --git a/plugins/local/ao_extra_basis/uninstall b/plugins/local/ao_extra_basis/uninstall new file mode 100755 index 00000000..ff7f8c6a --- /dev/null +++ b/plugins/local/ao_extra_basis/uninstall @@ -0,0 +1,20 @@ +#!/bin/bash + +# Check if the QP_ROOT environment variable is set. +if [[ -z ${QP_ROOT} ]] +then + print "The QP_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + +# list of the scripts to be used by the module +scripts_list="qp_copy_extra_basis" + +# Destroy ONLY the symbolic link for the scripts to be used in the +# ${QP_ROOT}/scripts/ directory. + for i in $scripts_list + do + find ${QP_ROOT}/scripts/$i -type l -delete + done + diff --git a/plugins/local/extra_basis_int/NEED b/plugins/local/extra_basis_int/NEED new file mode 100644 index 00000000..1dc12e7b --- /dev/null +++ b/plugins/local/extra_basis_int/NEED @@ -0,0 +1,2 @@ +extra_basis +ao_one_e_ints diff --git a/plugins/local/extra_basis_int/README.rst b/plugins/local/extra_basis_int/README.rst new file mode 100644 index 00000000..994274f9 --- /dev/null +++ b/plugins/local/extra_basis_int/README.rst @@ -0,0 +1,4 @@ +=============== +extra_basis_int +=============== + diff --git a/plugins/local/extra_basis_int/ao_overlap.irp.f b/plugins/local/extra_basis_int/ao_overlap.irp.f new file mode 100644 index 00000000..a821e161 --- /dev/null +++ b/plugins/local/extra_basis_int/ao_overlap.irp.f @@ -0,0 +1,136 @@ + +! --- + + BEGIN_PROVIDER [double precision, ao_extra_overlap , (ao_extra_num, ao_extra_num)] + + BEGIN_DOC + ! Overlap between atomic basis functions: + ! + ! :math:`\int \chi_i(r) \chi_j(r) dr` + END_DOC + + implicit none + integer :: i, j, n, l, dim1, power_A(3), power_B(3) + double precision :: overlap, overlap_x, overlap_y, overlap_z + double precision :: alpha, beta, c + double precision :: A_center(3), B_center(3) + + ao_extra_overlap = 0.d0 + + dim1=100 + !$OMP PARALLEL DO SCHEDULE(GUIDED) & + !$OMP DEFAULT(NONE) & + !$OMP PRIVATE(A_center,B_center,power_A,power_B,& + !$OMP overlap_x,overlap_y, overlap_z, overlap, & + !$OMP alpha, beta,i,j,n,l,c) & + !$OMP SHARED(extra_nucl_coord,ao_extra_power,ao_extra_prim_num, & + !$OMP ao_extra_overlap,ao_extra_num,ao_extra_coef_normalized_ordered_transp,ao_extra_nucl, & + !$OMP ao_extra_expo_ordered_transp,dim1) + do j=1,ao_extra_num + A_center(1) = extra_nucl_coord( ao_extra_nucl(j), 1 ) + A_center(2) = extra_nucl_coord( ao_extra_nucl(j), 2 ) + A_center(3) = extra_nucl_coord( ao_extra_nucl(j), 3 ) + power_A(1) = ao_extra_power( j, 1 ) + power_A(2) = ao_extra_power( j, 2 ) + power_A(3) = ao_extra_power( j, 3 ) + do i= 1,ao_extra_num + B_center(1) = extra_nucl_coord( ao_extra_nucl(i), 1 ) + B_center(2) = extra_nucl_coord( ao_extra_nucl(i), 2 ) + B_center(3) = extra_nucl_coord( ao_extra_nucl(i), 3 ) + power_B(1) = ao_extra_power( i, 1 ) + power_B(2) = ao_extra_power( i, 2 ) + power_B(3) = ao_extra_power( i, 3 ) + do n = 1,ao_extra_prim_num(j) + alpha = ao_extra_expo_ordered_transp(n,j) + do l = 1, ao_extra_prim_num(i) + beta = ao_extra_expo_ordered_transp(l,i) + call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1) + c = ao_extra_coef_normalized_ordered_transp(n,j) * ao_extra_coef_normalized_ordered_transp(l,i) + ao_extra_overlap(i,j) += c * overlap + if(isnan(ao_extra_overlap(i,j)))then + print*,'i,j',i,j + print*,'l,n',l,n + print*,'c,overlap',c,overlap + print*,overlap_x,overlap_y,overlap_z + stop + endif + enddo + enddo + enddo + enddo + !$OMP END PARALLEL DO + + + +END_PROVIDER + +! --- + + BEGIN_PROVIDER [double precision, ao_extra_overlap_mixed , (ao_num, ao_extra_num)] + + BEGIN_DOC + ! Overlap between atomic basis functions: + ! + ! + END_DOC + + implicit none + integer :: i, j, n, l, dim1, power_A(3), power_B(3) + double precision :: overlap, overlap_x, overlap_y, overlap_z + double precision :: alpha, beta, c + double precision :: A_center(3), B_center(3) + + ao_extra_overlap_mixed = 0.d0 + + dim1=100 + !$OMP PARALLEL DO SCHEDULE(GUIDED) & + !$OMP DEFAULT(NONE) & + !$OMP PRIVATE(A_center,B_center,power_A,power_B,& + !$OMP overlap_x,overlap_y, overlap_z, overlap, & + !$OMP alpha, beta,i,j,n,l,c) & + !$OMP SHARED(extra_nucl_coord,ao_extra_power,ao_extra_prim_num, & + !$OMP ao_extra_overlap_mixed,ao_extra_num,ao_extra_coef_normalized_ordered_transp,ao_extra_nucl, & + !$OMP ao_extra_expo_ordered_transp,dim1, & + !$OMP nucl_coord,ao_power,ao_prim_num, & + !$OMP ao_num,ao_coef_normalized_ordered_transp,ao_nucl, & + !$OMP ao_expo_ordered_transp) + + do j=1,ao_extra_num + A_center(1) = extra_nucl_coord( ao_extra_nucl(j), 1 ) + A_center(2) = extra_nucl_coord( ao_extra_nucl(j), 2 ) + A_center(3) = extra_nucl_coord( ao_extra_nucl(j), 3 ) + power_A(1) = ao_extra_power( j, 1 ) + power_A(2) = ao_extra_power( j, 2 ) + power_A(3) = ao_extra_power( j, 3 ) + do i= 1,ao_num + B_center(1) = nucl_coord( ao_nucl(i), 1 ) + B_center(2) = nucl_coord( ao_nucl(i), 2 ) + B_center(3) = nucl_coord( ao_nucl(i), 3 ) + power_B(1) = ao_power( i, 1 ) + power_B(2) = ao_power( i, 2 ) + power_B(3) = ao_power( i, 3 ) + do n = 1,ao_extra_prim_num(j) + alpha = ao_extra_expo_ordered_transp(n,j) + do l = 1, ao_prim_num(i) + beta = ao_expo_ordered_transp(l,i) + call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1) + c = ao_extra_coef_normalized_ordered_transp(n,j) * ao_coef_normalized_ordered_transp(l,i) + ao_extra_overlap_mixed(i,j) += c * overlap + if(isnan(ao_extra_overlap_mixed(i,j)))then + print*,'i,j',i,j + print*,'l,n',l,n + print*,'c,overlap',c,overlap + print*,overlap_x,overlap_y,overlap_z + stop + endif + enddo + enddo + enddo + enddo + !$OMP END PARALLEL DO + + +END_PROVIDER + +! --- + diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f new file mode 100644 index 00000000..9c1cf351 --- /dev/null +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -0,0 +1,7 @@ +program extra_basis_int + implicit none + BEGIN_DOC +! TODO : Put the documentation of the program here + END_DOC + print *, 'Hello world' +end diff --git a/plugins/local/extra_nuclei/EZFIO.cfg b/plugins/local/extra_nuclei/EZFIO.cfg new file mode 100644 index 00000000..e09a7dfd --- /dev/null +++ b/plugins/local/extra_nuclei/EZFIO.cfg @@ -0,0 +1,23 @@ +[extra_nucl_num] +doc: Number of nuclei +type: integer +interface: ezfio, provider + +[extra_nucl_label] +doc: Nuclear labels +type: character*(32) +size: (extra_nuclei.extra_nucl_num) +interface: ezfio, provider + +[extra_nucl_charge] +doc: Nuclear charges +type:double precision +size: (extra_nuclei.extra_nucl_num) +interface: ezfio, provider + +[extra_nucl_coord] +doc: Nuclear coordinates in the format (:, {x,y,z}) +type: double precision +size: (extra_nuclei.extra_nucl_num,3) +interface: ezfio + diff --git a/plugins/local/extra_nuclei/NEED b/plugins/local/extra_nuclei/NEED new file mode 100644 index 00000000..0dc19a80 --- /dev/null +++ b/plugins/local/extra_nuclei/NEED @@ -0,0 +1,3 @@ +ezfio_files +utils +nuclei diff --git a/plugins/local/extra_nuclei/README.rst b/plugins/local/extra_nuclei/README.rst new file mode 100644 index 00000000..6bb260a0 --- /dev/null +++ b/plugins/local/extra_nuclei/README.rst @@ -0,0 +1,4 @@ +============ +extra_nuclei +============ + diff --git a/plugins/local/extra_nuclei/extra_nuclei.irp.f b/plugins/local/extra_nuclei/extra_nuclei.irp.f new file mode 100644 index 00000000..53653e8d --- /dev/null +++ b/plugins/local/extra_nuclei/extra_nuclei.irp.f @@ -0,0 +1,7 @@ +program extra_nuclei + implicit none + BEGIN_DOC +! TODO : Put the documentation of the program here + END_DOC + print *, 'Hello world' +end diff --git a/plugins/local/extra_nuclei/nuclei.irp.f b/plugins/local/extra_nuclei/nuclei.irp.f new file mode 100644 index 00000000..386d15b8 --- /dev/null +++ b/plugins/local/extra_nuclei/nuclei.irp.f @@ -0,0 +1,122 @@ +BEGIN_PROVIDER [ double precision, extra_nucl_coord, (extra_nucl_num,3) ] + implicit none + + BEGIN_DOC + ! Nuclear coordinates in the format (:, {x,y,z}) + END_DOC + PROVIDE ezfio_filename extra_nucl_label extra_nucl_charge + + if (mpi_master) then + double precision, allocatable :: buffer(:,:) + extra_nucl_coord = 0.d0 + allocate (buffer(extra_nucl_num,3)) + buffer = 0.d0 + logical :: has + call ezfio_has_extra_nuclei_extra_nucl_coord(has) + if (.not.has) then + print *, irp_here + stop 1 + endif + call ezfio_get_extra_nuclei_extra_nucl_coord(buffer) + integer :: i,j + + do i=1,3 + do j=1,extra_nucl_num + extra_nucl_coord(j,i) = buffer(j,i) + enddo + enddo + deallocate(buffer) + + character*(64), parameter :: f = '(A16, 4(1X,F12.6))' + character*(64), parameter :: ft= '(A16, 4(1X,A12 ))' + double precision, parameter :: a0= 0.529177249d0 + + call write_time(6) + write(6,'(A)') '' + write(6,'(A)') 'Extra Nuclear Coordinates (Angstroms)' + write(6,'(A)') '=====================================' + write(6,'(A)') '' + write(6,ft) & + '================','============','============','============','============' + write(6,*) & + ' Atom Charge X Y Z ' + write(6,ft) & + '================','============','============','============','============' + + do i=1,extra_nucl_num + write(6,f) extra_nucl_label(i), extra_nucl_charge(i), & + extra_nucl_coord(i,1)*a0, & + extra_nucl_coord(i,2)*a0, & + extra_nucl_coord(i,3)*a0 + enddo + write(6,ft) & + '================','============','============','============','============' + write(6,'(A)') '' + + if (extra_nucl_num > 1) then + double precision :: dist_min, x, y, z + dist_min = huge(1.d0) + do i=1,extra_nucl_num + do j=i+1,extra_nucl_num + x = extra_nucl_coord(i,1)-extra_nucl_coord(j,1) + y = extra_nucl_coord(i,2)-extra_nucl_coord(j,2) + z = extra_nucl_coord(i,3)-extra_nucl_coord(j,3) + dist_min = min(x*x + y*y + z*z, dist_min) + enddo + enddo + write(6,'(A,F12.4,A)') 'Minimal interatomic distance found: ', & + dsqrt(dist_min)*a0,' Angstrom' + endif + + 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' + integer :: ierr + call MPI_BCAST( extra_nucl_coord, 3*extra_nucl_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + stop 'Unable to read nucl_coord with MPI' + endif + IRP_ENDIF + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, extra_nucl_coord_transp, (3,extra_nucl_num) ] + implicit none + BEGIN_DOC + ! Transposed array of extra_nucl_coord + END_DOC + integer :: i, k + extra_nucl_coord_transp = 0.d0 + + do i=1,extra_nucl_num + extra_nucl_coord_transp(1,i) = extra_nucl_coord(i,1) + extra_nucl_coord_transp(2,i) = extra_nucl_coord(i,2) + extra_nucl_coord_transp(3,i) = extra_nucl_coord(i,3) + enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, extra_center_of_mass, (3) ] + implicit none + BEGIN_DOC + ! Center of mass of the molecule + END_DOC + integer :: i,j + double precision :: s + extra_center_of_mass(:) = 0.d0 + s = 0.d0 + do i=1,extra_nucl_num + do j=1,3 + extra_center_of_mass(j) += extra_nucl_coord(i,j)* element_mass(int(extra_nucl_charge(i))) + enddo + s += element_mass(int(extra_nucl_charge(i))) + enddo + s = 1.d0/s + extra_center_of_mass(:) = extra_center_of_mass(:)*s +END_PROVIDER + diff --git a/plugins/local/tuto_plugins/tuto_I/tuto_I.rst b/plugins/local/tuto_plugins/tuto_I/tuto_I.rst index 43b4af0b..e4d47af4 100644 --- a/plugins/local/tuto_plugins/tuto_I/tuto_I.rst +++ b/plugins/local/tuto_plugins/tuto_I/tuto_I.rst @@ -17,7 +17,7 @@ Our goals: We want to create a plugin to do the following things: 1) print out one- and two-electron integrals on the AO/MO basis, - 2) creates two providers which manipulate these objects, + 2) create two providers which manipulate these objects, 3) print out these providers. diff --git a/src/cas_based_on_top/cas_based_on_top.irp.f b/src/cas_based_on_top/cas_based_on_top.irp.f index 7d9090ce..49ca7b9d 100644 --- a/src/cas_based_on_top/cas_based_on_top.irp.f +++ b/src/cas_based_on_top/cas_based_on_top.irp.f @@ -1,4 +1,4 @@ -program cas_based_on_top_density +program cas_based_on_top implicit none BEGIN_DOC ! TODO : Small example to use the different quantities in this plugin diff --git a/src/casscf_cipsi/get_energy.irp.f b/src/casscf_cipsi/get_energy.irp.f index cfb26b59..a34fb0ca 100644 --- a/src/casscf_cipsi/get_energy.irp.f +++ b/src/casscf_cipsi/get_energy.irp.f @@ -1,4 +1,4 @@ -program print_2rdm +program get_energy implicit none BEGIN_DOC ! get the active part of the bielectronic energy on a given wave function. diff --git a/src/mu_of_r/test_proj_op.irp.f b/src/mu_of_r/test_proj_op.irp.f index 94052b18..759835e3 100644 --- a/src/mu_of_r/test_proj_op.irp.f +++ b/src/mu_of_r/test_proj_op.irp.f @@ -1,4 +1,4 @@ -program projected_operators +program test_proj_op implicit none BEGIN_DOC ! TODO diff --git a/src/tools/attachement_orb.irp.f b/src/tools/attachement_orb.irp.f index 92a51ca8..f5627a36 100644 --- a/src/tools/attachement_orb.irp.f +++ b/src/tools/attachement_orb.irp.f @@ -1,4 +1,4 @@ -program molden_detachment_attachment +program attachement_orb implicit none read_wf=.True. touch read_wf diff --git a/src/tools/fcidump_pyscf.irp.f b/src/tools/fcidump_pyscf.irp.f index 9cbf733a..aaa552b4 100644 --- a/src/tools/fcidump_pyscf.irp.f +++ b/src/tools/fcidump_pyscf.irp.f @@ -1,4 +1,4 @@ -program fcidump +program fcidump_pyscf implicit none BEGIN_DOC ! Produce a regular `FCIDUMP` file from the |MOs| stored in the |EZFIO| diff --git a/src/tools/hcore_guess.irp.f b/src/tools/hcore_guess.irp.f deleted file mode 100644 index 87d0cb7d..00000000 --- a/src/tools/hcore_guess.irp.f +++ /dev/null @@ -1,3 +0,0 @@ -program hcore_guess_prog - call hcore_guess -end diff --git a/src/tools/huckel_guess.irp.f b/src/tools/huckel_guess.irp.f deleted file mode 100644 index 5ec37df4..00000000 --- a/src/tools/huckel_guess.irp.f +++ /dev/null @@ -1,5 +0,0 @@ -program pouet - implicit none - call huckel_guess - -end diff --git a/src/tools/print_sorted_wf_coef.irp.f b/src/tools/print_sorted_wf_coef.irp.f index b3c0cb34..3051be02 100644 --- a/src/tools/print_sorted_wf_coef.irp.f +++ b/src/tools/print_sorted_wf_coef.irp.f @@ -1,4 +1,4 @@ -program sort_wf +program print_sorted_wf_coef implicit none read_wf =.True. call routine diff --git a/src/tools/save_natorb_no_ov_rot.irp.f b/src/tools/save_natorb_no_ov_rot.irp.f index e5b69fbf..fb6d11e8 100644 --- a/src/tools/save_natorb_no_ov_rot.irp.f +++ b/src/tools/save_natorb_no_ov_rot.irp.f @@ -1,4 +1,4 @@ -program save_natorb +program save_natorb_no_ov_rot implicit none BEGIN_DOC ! Save natural |MOs| into the |EZFIO|. diff --git a/src/tools/save_natorb_no_ref.irp.f b/src/tools/save_natorb_no_ref.irp.f index 9d253fa0..71d5c821 100644 --- a/src/tools/save_natorb_no_ref.irp.f +++ b/src/tools/save_natorb_no_ref.irp.f @@ -1,4 +1,4 @@ -program save_natorb +program save_natorb_no_ref implicit none BEGIN_DOC ! Save natural |MOs| into the |EZFIO|. diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index dc342197..699437d1 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -1,4 +1,4 @@ -program import_integrals_ao +program import_trexio_integrals use trexio implicit none integer(trexio_t) :: f ! TREXIO file handle From 1931b80fc5bcb193867fb85c05bfdd5926161e9d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 5 Dec 2024 16:05:22 +0100 Subject: [PATCH 026/175] Fixing trexio import --- scripts/qp_import_trexio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 4c153a29..d75d0074 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -253,7 +253,7 @@ def write_ezfio(trexio_filename, filename): print(basis_type) except: - raise + basis_type = "None" print("None") ezfio.set_ao_basis_ao_cartesian(True) From 210179e8a04454c6a458e2b3bd114c82ce7215ce Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 6 Dec 2024 14:55:44 +0100 Subject: [PATCH 027/175] pot_ao_extra ints work --- plugins/local/ao_extra_basis/EZFIO.cfg | 18 ++-- .../local/ao_extra_basis/extra_basis.irp.f | 1 + plugins/local/extra_basis_int/NEED | 2 +- .../local/extra_basis_int/ao_overlap.irp.f | 53 +++++++++++ .../extra_basis_int/extra_basis_int.irp.f | 45 ++++++++- .../local/extra_basis_int/pot_ao_ints.irp.f | 93 +++++++++++++++++++ .../extra_basis_int/ref_extra_basis.irp.f | 35 +++++++ 7 files changed, 236 insertions(+), 11 deletions(-) create mode 100644 plugins/local/extra_basis_int/pot_ao_ints.irp.f create mode 100644 plugins/local/extra_basis_int/ref_extra_basis.irp.f diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg index bddf4d37..8b3a8667 100644 --- a/plugins/local/ao_extra_basis/EZFIO.cfg +++ b/plugins/local/ao_extra_basis/EZFIO.cfg @@ -11,37 +11,37 @@ interface: ezfio, provider [ao_extra_prim_num] type: integer doc: Number of primitives per |ao_extra| -size: (extra_basis.ao_extra_num) +size: (ao_extra_basis.ao_extra_num) interface: ezfio, provider [ao_extra_prim_num_max] type: integer doc: Maximum number of primitives -default: =maxval(extra_basis.ao_extra_prim_num) +default: =maxval(ao_extra_basis.ao_extra_prim_num) interface: ezfio [ao_extra_nucl] type: integer doc: Index of the nucleus on which the |ao_extra| is centered -size: (extra_basis.ao_extra_num) +size: (ao_extra_basis.ao_extra_num) interface: ezfio, provider [ao_extra_power] type: integer doc: Powers of x, y and z for each |ao_extra| -size: (extra_basis.ao_extra_num,3) +size: (ao_extra_basis.ao_extra_num,3) interface: ezfio, provider [ao_extra_coef] type: double precision doc: Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** ao_extras. -size: (extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) interface: ezfio, provider [ao_extra_expo] type: double precision doc: Exponents for each primitive of each |ao_extra| -size: (extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) interface: ezfio, provider [ao_extra_md5] @@ -70,18 +70,18 @@ default: true [ao_extra_expo_im] type: double precision doc: imag part for Exponents for each primitive of each cGTOs |ao_extra| -size: (extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) interface: ezfio, provider [ao_extra_expo_pw] type: double precision doc: plane wave part for each primitive GTOs |ao_extra| -size: (3,extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) interface: ezfio, provider [ao_extra_expo_phase] type: double precision doc: phase shift for each primitive GTOs |ao_extra| -size: (3,extra_basis.ao_extra_num,extra_basis.ao_extra_prim_num_max) +size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) interface: ezfio, provider diff --git a/plugins/local/ao_extra_basis/extra_basis.irp.f b/plugins/local/ao_extra_basis/extra_basis.irp.f index 19b36349..9773af2f 100644 --- a/plugins/local/ao_extra_basis/extra_basis.irp.f +++ b/plugins/local/ao_extra_basis/extra_basis.irp.f @@ -12,4 +12,5 @@ program extra_basis print*,'extra_nucl_coord = ' print*,extra_nucl_coord(i,1:3) enddo + print*,ao_extra_num end diff --git a/plugins/local/extra_basis_int/NEED b/plugins/local/extra_basis_int/NEED index 1dc12e7b..7f39af7c 100644 --- a/plugins/local/extra_basis_int/NEED +++ b/plugins/local/extra_basis_int/NEED @@ -1,2 +1,2 @@ -extra_basis +ao_extra_basis ao_one_e_ints diff --git a/plugins/local/extra_basis_int/ao_overlap.irp.f b/plugins/local/extra_basis_int/ao_overlap.irp.f index a821e161..4f8debb6 100644 --- a/plugins/local/extra_basis_int/ao_overlap.irp.f +++ b/plugins/local/extra_basis_int/ao_overlap.irp.f @@ -134,3 +134,56 @@ ! --- +subroutine get_ao_mixed_overlap(r_nucl,ao_mixed_overlap) + implicit none + BEGIN_DOC +! returns the overlap integrals between the AOs and the extra_AOs located at r_nucl + END_DOC + double precision, intent(in) :: r_nucl(extra_nucl_num,3) + double precision, intent(out):: ao_mixed_overlap(ao_extra_num,ao_num) + integer :: j,i,l,n, power_A(3), power_B(3), dim1 + double precision :: A_center(3), B_center(3), alpha, beta + double precision :: overlap_x,overlap_y,overlap_z,overlap,c + dim1=100 + ao_mixed_overlap = 0.d0 + +!$OMP PARALLEL DO SCHEDULE(GUIDED) & +!$OMP DEFAULT(NONE) & +!$OMP PRIVATE(A_center,B_center,power_A,power_B,& +!$OMP overlap_x,overlap_y, overlap_z, overlap, & +!$OMP alpha, beta,i,j,n,l,c) & +!$OMP SHARED(r_nucl,ao_extra_power,ao_extra_prim_num, & +!$OMP ao_mixed_overlap,ao_extra_num,ao_extra_coef_normalized_ordered_transp,ao_extra_nucl, & +!$OMP ao_extra_expo_ordered_transp,dim1, & +!$OMP nucl_coord,ao_power,ao_prim_num, & +!$OMP ao_num,ao_coef_normalized_ordered_transp,ao_nucl, & +!$OMP ao_expo_ordered_transp) + do i = 1, ao_num + B_center(1) = nucl_coord( ao_nucl(i), 1 ) + B_center(2) = nucl_coord( ao_nucl(i), 2 ) + B_center(3) = nucl_coord( ao_nucl(i), 3 ) + power_B(1) = ao_power( i, 1 ) + power_B(2) = ao_power( i, 2 ) + power_B(3) = ao_power( i, 3 ) + do l = 1, ao_prim_num(i) + beta = ao_expo_ordered_transp(l,i) + do j=1,ao_extra_num + A_center(1) = r_nucl( ao_extra_nucl(j), 1 ) + A_center(2) = r_nucl( ao_extra_nucl(j), 2 ) + A_center(3) = r_nucl( ao_extra_nucl(j), 3 ) + power_A(1) = ao_extra_power( j, 1 ) + power_A(2) = ao_extra_power( j, 2 ) + power_A(3) = ao_extra_power( j, 3 ) + do n = 1,ao_extra_prim_num(j) + alpha = ao_extra_expo_ordered_transp(n,j) + call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1) + c = ao_extra_coef_normalized_ordered_transp(n,j) * ao_coef_normalized_ordered_transp(l,i) + ao_mixed_overlap(j,i) += c * overlap + enddo + enddo + enddo + enddo +!$OMP END PARALLEL DO + + +end diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 9c1cf351..09838c4e 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -3,5 +3,48 @@ program extra_basis_int BEGIN_DOC ! TODO : Put the documentation of the program here END_DOC - print *, 'Hello world' +! call test_overlap + call routine_test_pot_ne +end + +subroutine test_overlap + implicit none + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + write(33,*)ao_extra_overlap(j,i) + enddo + enddo +end + +subroutine test_overlap_mixed + implicit none + integer :: i,j + double precision, allocatable :: ao_mixed_overlap(:,:) + allocate(ao_mixed_overlap(ao_extra_num,ao_num)) + call get_ao_mixed_overlap(extra_nucl_coord,ao_mixed_overlap) + do i = 1, ao_extra_num + do j = 1, ao_num + write(33,*)dabs(ao_extra_overlap_mixed(j,i)-ao_mixed_overlap(i,j)) + write(*,*)ao_extra_overlap_mixed(j,i),ao_mixed_overlap(i,j),dabs(ao_extra_overlap_mixed(j,i)-ao_mixed_overlap(i,j)) + enddo + enddo +end + +subroutine routine_test_pot_ne + implicit none + integer :: i,j + double precision :: integral, C_center(3), mu_in + double precision :: NAI_pol_mult_erf_ao_extra + C_center(1) = 0.1d0 + C_center(2) = -0.3d0 + C_center(3) = 0.8d0 + mu_in = 1.d10 + do i = 1, ao_extra_num + do j = 1, ao_extra_num + integral = NAI_pol_mult_erf_ao_extra(i, j, mu_in, C_center) + write(33,*)j,i,integral + enddo + enddo + end diff --git a/plugins/local/extra_basis_int/pot_ao_ints.irp.f b/plugins/local/extra_basis_int/pot_ao_ints.irp.f new file mode 100644 index 00000000..5f3af244 --- /dev/null +++ b/plugins/local/extra_basis_int/pot_ao_ints.irp.f @@ -0,0 +1,93 @@ + +double precision function NAI_pol_mult_erf_ao_extra(i_ao, j_ao, mu_in, C_center) + + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$. + ! + ! + ! where $\chi_i(r)$ AND $\chi_j(r)$ belongs to the extra basis + END_DOC + + implicit none + integer, intent(in) :: i_ao, j_ao + double precision, intent(in) :: mu_in, C_center(3) + + integer :: i, j, num_A, num_B, power_A(3), power_B(3), n_pt_in + double precision :: A_center(3), B_center(3), integral, alpha, beta + + double precision :: NAI_pol_mult_erf + + num_A = ao_extra_nucl(i_ao) + power_A(1:3) = ao_extra_power(i_ao,1:3) + A_center(1:3) = extra_nucl_coord(num_A,1:3) + num_B = ao_extra_nucl(j_ao) + power_B(1:3) = ao_extra_power(j_ao,1:3) + B_center(1:3) = extra_nucl_coord(num_B,1:3) + + n_pt_in = n_pt_max_extra_basis_integrals + + NAI_pol_mult_erf_ao_extra = 0.d0 + do i = 1, ao_extra_prim_num(i_ao) + alpha = ao_extra_expo_ordered_transp(i,i_ao) + do j = 1, ao_extra_prim_num(j_ao) + beta = ao_extra_expo_ordered_transp(j,j_ao) + + integral = NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in,mu_in) + + NAI_pol_mult_erf_ao_extra += integral * ao_extra_coef_normalized_ordered_transp(j,j_ao) * ao_extra_coef_normalized_ordered_transp(i,i_ao) + enddo + enddo + +end function NAI_pol_mult_erf_ao_extra + +! --- + +double precision function NAI_pol_mult_erf_ao_extra_mixed(i_ao, j_ao, mu_in, C_center) + + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$. + ! + ! + ! where $\chi_i(r)$ belongs to the extra basis and $\chi_j(r)$ to the regular basis + END_DOC + + implicit none + integer, intent(in) :: i_ao, j_ao + double precision, intent(in) :: mu_in, C_center(3) + + integer :: i, j, num_A, num_B, power_A(3), power_B(3), n_pt_in + double precision :: A_center(3), B_center(3), integral, alpha, beta + + double precision :: NAI_pol_mult_erf + + ! A = chi_i == extra basis + num_A = ao_extra_nucl(i_ao) + power_A(1:3) = ao_extra_power(i_ao,1:3) + A_center(1:3) = extra_nucl_coord(num_A,1:3) + ! B = chi_j == regular basis + num_B = ao_nucl(j_ao) + power_B(1:3) = ao_power(j_ao,1:3) + B_center(1:3) = nucl_coord(num_B,1:3) + + n_pt_in = max(n_pt_max_integrals,n_pt_max_extra_basis_integrals) + + NAI_pol_mult_erf_ao_extra_mixed = 0.d0 + do i = 1, ao_extra_prim_num(i_ao) + alpha = ao_extra_expo_ordered_transp(i,i_ao) + do j = 1, ao_prim_num(j_ao) + beta = ao_expo_ordered_transp(j,j_ao) + + integral = NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in,mu_in) + + NAI_pol_mult_erf_ao_extra_mixed += integral * ao_coef_normalized_ordered_transp(j,j_ao) * ao_extra_coef_normalized_ordered_transp(i,i_ao) + enddo + enddo + +end + +! --- + diff --git a/plugins/local/extra_basis_int/ref_extra_basis.irp.f b/plugins/local/extra_basis_int/ref_extra_basis.irp.f new file mode 100644 index 00000000..8a50be2c --- /dev/null +++ b/plugins/local/extra_basis_int/ref_extra_basis.irp.f @@ -0,0 +1,35 @@ +program pouet + implicit none +! call ref_overlap + call ref_pot + +end + +subroutine ref_overlap + implicit none + integer :: i,j + do i = 1, ao_num + do j = 1, ao_num + write(34,*)ao_overlap(j,i) + enddo + enddo + +end + +subroutine ref_pot + implicit none + integer :: i,j + double precision :: integral, C_center(3), mu_in + double precision :: NAI_pol_mult_erf_ao + C_center(1) = 0.1d0 + C_center(2) = -0.3d0 + C_center(3) = 0.8d0 + mu_in = 1.d10 + do i = 1, ao_num + do j = 1, ao_num + integral = NAI_pol_mult_erf_ao(i, j, mu_in, C_center) + write(34,*)j,i,integral + enddo + enddo + +end From 7bce3135aafa7bad0485317091c631906927f8e8 Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 6 Dec 2024 15:05:47 +0100 Subject: [PATCH 028/175] mixed one-e integrals work --- .../extra_basis_int/extra_basis_int.irp.f | 21 ++++++++++++++++++- .../extra_basis_int/ref_extra_basis.irp.f | 20 +++++++++++++++++- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 09838c4e..243eb00e 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -4,7 +4,8 @@ program extra_basis_int ! TODO : Put the documentation of the program here END_DOC ! call test_overlap - call routine_test_pot_ne +! call routine_test_pot_ne + call routine_test_pot_ne_mixed end subroutine test_overlap @@ -48,3 +49,21 @@ subroutine routine_test_pot_ne enddo end + +subroutine routine_test_pot_ne_mixed + implicit none + integer :: i,j + double precision :: integral, C_center(3), mu_in + double precision :: NAI_pol_mult_erf_ao_extra_mixed + C_center(1) = 0.1d0 + C_center(2) = -0.3d0 + C_center(3) = 0.8d0 + mu_in = 1.d10 + do j = 1, ao_num + do i = 1, ao_extra_num + integral = NAI_pol_mult_erf_ao_extra_mixed(i, j, mu_in, C_center) + write(33,*)integral + enddo + enddo + +end diff --git a/plugins/local/extra_basis_int/ref_extra_basis.irp.f b/plugins/local/extra_basis_int/ref_extra_basis.irp.f index 8a50be2c..eb2cfd11 100644 --- a/plugins/local/extra_basis_int/ref_extra_basis.irp.f +++ b/plugins/local/extra_basis_int/ref_extra_basis.irp.f @@ -1,7 +1,8 @@ program pouet implicit none ! call ref_overlap - call ref_pot +! call ref_pot + call ref_pot_mixed end @@ -31,5 +32,22 @@ subroutine ref_pot write(34,*)j,i,integral enddo enddo +end + +subroutine ref_pot_mixed + implicit none + integer ::i,j + double precision :: integral, C_center(3), mu_in + double precision :: NAI_pol_mult_erf_ao + C_center(1) = 0.1d0 + C_center(2) = -0.3d0 + C_center(3) = 0.8d0 + mu_in = 1.d10 + do i=1, 5 + do j = 6, ao_num + integral = NAI_pol_mult_erf_ao(i, j, mu_in, C_center) + write(34,*)integral + enddo + enddo end From bb8ecd90e83147525bf57357526dc5bc9508eafb Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 6 Dec 2024 15:47:48 +0100 Subject: [PATCH 029/175] all one-body potentials are OK --- .../extra_basis_int/extra_basis_int.irp.f | 59 +++++++++- .../extra_basis_int/ref_extra_basis.irp.f | 64 ++++++++++- .../local/extra_basis_int/v_mixed_extra.irp.f | 102 ++++++++++++++++++ 3 files changed, 222 insertions(+), 3 deletions(-) create mode 100644 plugins/local/extra_basis_int/v_mixed_extra.irp.f diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 243eb00e..6423cedd 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -5,7 +5,12 @@ program extra_basis_int END_DOC ! call test_overlap ! call routine_test_pot_ne - call routine_test_pot_ne_mixed +! call routine_test_pot_ne_mixed +! call routine_pot_ne_extra +! call routine_test_pot_ne_mixed +! call routine_pot_ne + call routine_test_pot_ne_extra_mixed + end subroutine test_overlap @@ -50,7 +55,7 @@ subroutine routine_test_pot_ne end -subroutine routine_test_pot_ne_mixed +subroutine routine_test_pot_mixed implicit none integer :: i,j double precision :: integral, C_center(3), mu_in @@ -67,3 +72,53 @@ subroutine routine_test_pot_ne_mixed enddo end + +subroutine routine_pot_ne_extra + implicit none + integer :: i,j + double precision :: v_extra_nucl_extra_ao + do i = 1, ao_extra_num + do j = 1, ao_extra_num + write(33,*)v_extra_nucl_extra_ao(i,j) + enddo + enddo +end + + +subroutine routine_pot_ne + implicit none + integer :: i,j + double precision :: v_nucl_extra_ao + do i = 1, ao_extra_num + do j = 1, ao_extra_num + write(33,*)v_nucl_extra_ao(i,j) + enddo + enddo +end + + +subroutine routine_test_pot_ne_mixed + implicit none + integer :: i,j + double precision :: integral,v_extra_nucl_mixed_ao + do j = 1, ao_num + do i = 1, ao_extra_num + integral = v_extra_nucl_mixed_ao(i,j) + write(33,*)integral + enddo + enddo + +end + +subroutine routine_test_pot_ne_extra_mixed + implicit none + integer :: i,j + double precision :: integral,v_nucl_mixed_ao + do j = 1, ao_num + do i = 1, ao_extra_num + integral = v_nucl_mixed_ao(i,j) + write(33,*)integral + enddo + enddo + +end diff --git a/plugins/local/extra_basis_int/ref_extra_basis.irp.f b/plugins/local/extra_basis_int/ref_extra_basis.irp.f index eb2cfd11..39055fd0 100644 --- a/plugins/local/extra_basis_int/ref_extra_basis.irp.f +++ b/plugins/local/extra_basis_int/ref_extra_basis.irp.f @@ -2,7 +2,11 @@ program pouet implicit none ! call ref_overlap ! call ref_pot - call ref_pot_mixed +! call ref_pot_mixed +! call routine_pot_ne_extra +! call ref_pot_ne_mixed +! call ref_pot_ne + call ref_pot_ne_extra_mixed end @@ -51,3 +55,61 @@ subroutine ref_pot_mixed enddo end + +subroutine routine_pot_ne_extra + implicit none + integer :: i,j + double precision :: v_extra_nucl_extra_ao + do i = 1, ao_num + do j = 1, ao_num + write(34,*)ao_integrals_n_e(i,j) + enddo + enddo +end + + +subroutine ref_pot_ne_mixed + implicit none + integer ::i,j,k + double precision :: integral + do i=1, 5 + do j = 6, ao_num + integral = 0.d0 + do k = 2,2 + integral += ao_integrals_n_e_per_atom(i,j,k) * nucl_charge(k) + enddo + write(34,*)integral + enddo + enddo +end + +subroutine ref_pot_ne + implicit none + integer ::i,j,k + double precision :: integral + do i=6,ao_num + do j = 6, ao_num + integral = 0.d0 + do k = 1,1 + integral += ao_integrals_n_e_per_atom(i,j,k) * nucl_charge(k) + enddo + write(34,*)integral + enddo + enddo + +end + +subroutine ref_pot_ne_extra_mixed + implicit none + integer ::i,j,k + double precision :: integral + do i=1, 5 + do j = 6, ao_num + integral = 0.d0 + do k = 1,1 + integral += ao_integrals_n_e_per_atom(i,j,k) * nucl_charge(k) + enddo + write(34,*)integral + enddo + enddo +end diff --git a/plugins/local/extra_basis_int/v_mixed_extra.irp.f b/plugins/local/extra_basis_int/v_mixed_extra.irp.f new file mode 100644 index 00000000..ac856692 --- /dev/null +++ b/plugins/local/extra_basis_int/v_mixed_extra.irp.f @@ -0,0 +1,102 @@ +double precision function v_extra_nucl_extra_ao(i_ao,j_ao) + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne^{extra}(r)$. + ! + ! + ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis + ! + ! and v_ne^{extra}(r) is the Coulomb potential coming from the EXTRA nuclei + END_DOC + integer, intent(in) ::i_ao,j_ao + double precision :: mu_in,charge,coord(3) + double precision :: NAI_pol_mult_erf_ao_extra + mu_in = 1.d10 + integer :: i + v_extra_nucl_extra_ao = 0.d0 + do i = 1, extra_nucl_num + charge = extra_nucl_charge(i) + coord(1:3) = extra_nucl_coord_transp(1:3,i) + v_extra_nucl_extra_ao -= charge * NAI_pol_mult_erf_ao_extra(i_ao, j_ao, mu_in, coord) + enddo +end + + +double precision function v_nucl_extra_ao(i_ao,j_ao) + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne(r)$. + ! + ! + ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis + ! + ! and v_ne(r) is the Coulomb potential coming from the REGULAR nuclei + END_DOC + integer, intent(in) ::i_ao,j_ao + double precision :: mu_in,charge,coord(3) + double precision :: NAI_pol_mult_erf_ao_extra + mu_in = 1.d10 + integer :: i + v_nucl_extra_ao = 0.d0 + do i = 1, nucl_num + charge = nucl_charge(i) + coord(1:3) = nucl_coord_transp(1:3,i) + v_nucl_extra_ao -= charge * NAI_pol_mult_erf_ao_extra(i_ao, j_ao, mu_in, coord) + enddo +end + + +double precision function v_extra_nucl_mixed_ao(i_ao,j_ao) + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne^{extra}(r)$. + ! + ! + ! where $\chi_i(r)$ belongs to the EXTRA basis and $\chi_j(r)$ to the REGULAR basis + ! + ! and v_ne^{extra}(r) is the Coulomb potential coming from the EXTRA nuclei + END_DOC + integer, intent(in) ::i_ao,j_ao + double precision :: mu_in,charge,coord(3) + double precision :: NAI_pol_mult_erf_ao_extra_mixed + mu_in = 1.d10 + integer :: i + v_extra_nucl_mixed_ao = 0.d0 + do i = 1, extra_nucl_num + charge = extra_nucl_charge(i) + coord(1:3) = extra_nucl_coord_transp(1:3,i) + v_extra_nucl_mixed_ao -= charge * NAI_pol_mult_erf_ao_extra_mixed(i_ao, j_ao, mu_in, coord) + enddo +end + +double precision function v_nucl_mixed_ao(i_ao,j_ao) + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne(r)$. + ! + ! + ! where $\chi_i(r)$ belongs to the EXTRA basis and $\chi_j(r)$ to the REGULAR basis + ! + ! and v_ne(r) is the Coulomb potential coming from the REGULAR nuclei + END_DOC + integer, intent(in) ::i_ao,j_ao + double precision :: mu_in,charge,coord(3) + double precision :: NAI_pol_mult_erf_ao_extra_mixed + mu_in = 1.d10 + integer :: i + v_nucl_mixed_ao = 0.d0 + do i = 1, nucl_num + charge = nucl_charge(i) + coord(1:3) = nucl_coord_transp(1:3,i) + v_nucl_mixed_ao -= charge * NAI_pol_mult_erf_ao_extra_mixed(i_ao, j_ao, mu_in, coord) + enddo +end + From 67d2301fde87edbba1e803a7057e5bd1d9d01cb4 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 11 Dec 2024 14:30:42 +0100 Subject: [PATCH 030/175] beginning the fit on 1s functions --- plugins/local/ao_extra_basis/EZFIO.cfg | 6 + plugins/local/ao_extra_basis/aos_transp.irp.f | 68 ++++++++ .../local/ao_extra_basis/fit_1s_basis.irp.f | 8 + .../local/ao_extra_basis/prov_fit_1s.irp.f | 159 ++++++++++++++++++ plugins/local/extra_basis_int/NEED | 1 + 5 files changed, 242 insertions(+) create mode 100644 plugins/local/ao_extra_basis/aos_transp.irp.f create mode 100644 plugins/local/ao_extra_basis/fit_1s_basis.irp.f create mode 100644 plugins/local/ao_extra_basis/prov_fit_1s.irp.f diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg index 8b3a8667..9a73f078 100644 --- a/plugins/local/ao_extra_basis/EZFIO.cfg +++ b/plugins/local/ao_extra_basis/EZFIO.cfg @@ -1,3 +1,9 @@ +[ao_extra_center] +type: double precision +doc: parameter for off-centering s functions to mimick p functions +interface: ezfio, provider +default:0.01 + [ao_extra_basis] type: character*(256) doc: Name of the |ao_extra| basis set diff --git a/plugins/local/ao_extra_basis/aos_transp.irp.f b/plugins/local/ao_extra_basis/aos_transp.irp.f new file mode 100644 index 00000000..ed34835b --- /dev/null +++ b/plugins/local/ao_extra_basis/aos_transp.irp.f @@ -0,0 +1,68 @@ + +! --- + +BEGIN_PROVIDER [ integer, Nucl_ao_extras_transposed, (N_ao_extras_max,nucl_num)] + + BEGIN_DOC + ! List of ao_extras attached on each atom + END_DOC + + implicit none + integer :: i + integer, allocatable :: nucl_tmp(:) + + allocate(nucl_tmp(nucl_num)) + nucl_tmp = 0 + do i = 1, ao_extra_num + nucl_tmp(ao_extra_nucl(i)) += 1 + Nucl_ao_extras_transposed(nucl_tmp(ao_extra_nucl(i)),ao_extra_nucl(i)) = i + enddo + deallocate(nucl_tmp) + +END_PROVIDER + +! --- + +BEGIN_PROVIDER [double precision, ao_extra_expo_ordered_transp_per_nucl, (ao_extra_prim_num_max,N_ao_extras_max,nucl_num) ] + implicit none + integer :: i,j,k,l + do i = 1, nucl_num + do j = 1,Nucl_N_ao_extras(i) + k = Nucl_ao_extras_transposed(j,i) + do l = 1, ao_extra_prim_num(k) + ao_extra_expo_ordered_transp_per_nucl(l,j,i) = ao_extra_expo_ordered_transp(l,k) + enddo + enddo + enddo + +END_PROVIDER + + +BEGIN_PROVIDER [ integer, ao_extra_power_ordered_transp_per_nucl, (3,N_ao_extras_max,nucl_num) ] + implicit none + integer :: i,j,k,l + do i = 1, nucl_num + do j = 1,Nucl_N_ao_extras(i) + k = Nucl_ao_extras_transposed(j,i) + do l = 1, 3 + ao_extra_power_ordered_transp_per_nucl(l,j,i) = ao_extra_power(k,l) + enddo + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered_transp_per_nucl, (ao_extra_prim_num_max,N_ao_extras_max,nucl_num) ] + implicit none + integer :: i,j,k,l + do i = 1, nucl_num + do j = 1,Nucl_N_ao_extras(i) + k = Nucl_ao_extras_transposed(j,i) + do l = 1, ao_extra_prim_num(k) + ao_extra_coef_normalized_ordered_transp_per_nucl(l,j,i) = ao_extra_coef_normalized_ordered_transp(l,k) + enddo + enddo + enddo + +END_PROVIDER + diff --git a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f new file mode 100644 index 00000000..f544ad83 --- /dev/null +++ b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f @@ -0,0 +1,8 @@ +program fit_1s_basis + implicit none + provide lmax_too_big + integer :: i +! print*,'n_func_tot', n_func_tot + provide new_nucl_coord + +end diff --git a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f new file mode 100644 index 00000000..cba0bb05 --- /dev/null +++ b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f @@ -0,0 +1,159 @@ + BEGIN_PROVIDER [ integer, n_func_tot] + implicit none + BEGIN_DOC + ! n_func_tot :: total number of functions in the fitted basis set + ! + ! returned in an uncontracted way + END_DOC + integer :: i,prefact + n_func_tot = 0 + print*,'n_func_tot ' + do i = 1, ao_num + if(ao_l(i) == 0)then + prefact = 1 ! s functions + else + ! p functions are fitted with 2 functions + ! d functions are fitted with 4 functions etc ... + prefact=2*ao_l(i) + endif + n_func_tot += prefact * ao_prim_num(i) + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, n_prim_tot_orig] + implicit none + integer :: i + n_prim_tot_orig = 0 + do i = 1, ao_num + n_prim_tot_orig += ao_prim_num(i) + enddo +END_PROVIDER + + +BEGIN_PROVIDER [ logical, lmax_too_big] + implicit none + if (ao_l_max.gt.1)then + lmax_too_big = .True. + else + lmax_too_big = .False. + endif + if(lmax_too_big)then + print*,'STOPPING !! lmax is larger than 1 !' + print*,'Cannot yet fit with 1s functions ...' + stop + endif +END_PROVIDER + + BEGIN_PROVIDER [ integer, n_2p_func_orig] +&BEGIN_PROVIDER [ integer, n_2p_func_tot] + implicit none + integer :: i + BEGIN_DOC + ! n_2p_func_orig :: number of 2p functions in the original basis + ! + ! n_2p_func_tot :: total number of p functions in the fitted basis + END_DOC + n_2p_func_orig= 0 + n_2p_func_tot = 0 + do i = 1, ao_num + if(ao_l(i)==1)then + n_2p_func_orig+= 1 + n_2p_func_tot += ao_prim_num(i) * 2 + endif + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, list_2p_functions, (n_2p_func_orig)] + implicit none + BEGIN_DOC + ! list of 2p functions in the original basis + END_DOC + integer :: i,j + j=0 + do i = 1, ao_num + if(ao_l(i)==1)then + j+=1 + list_2p_functions(j) = i + endif + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, new_nucl_num] + implicit none + new_nucl_num = n_func_tot +END_PROVIDER + +BEGIN_PROVIDER [ double precision, new_ao_expo_1s , (n_func_tot) ] + implicit none + integer :: i,j,ii,i_ao,k + k = 0 + do i = 1, nucl_num + do ii = 1, Nucl_N_Aos(i) + i_ao = nucl_aos_transposed(ii,i) + if(ao_l(i_ao)==0)then + do j = 1, ao_prim_num(i_ao) + k+=1 + new_ao_expo_1s(k)= ao_expo(i_ao,j) + enddo + else if(ao_l(i_ao)==1)then + ! for 'p' functions + ! you replace the function by 2 functions 's' + do j = 1, ao_prim_num(i_ao) + k+=1 + new_ao_expo_1s(k)= ao_expo(i_ao,j) + k+=1 + new_ao_expo_1s(k)= ao_expo(i_ao,j) + enddo + else + print*,'WARNING ! Lmax value not implemented yet !' + print*,'stopping ...' + stop + endif + enddo + enddo + if(k.ne.n_func_tot)then + print*,'pb !!! k NE n_func_tot !!' + print*,k,n_func_tot + stop + endif + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, new_nucl_coord, (3,new_nucl_num)] + implicit none + integer :: i,ii,j,i_ao,k + k = 0 + do i = 1, nucl_num + do ii = 1, Nucl_N_Aos(i) + i_ao = nucl_aos_transposed(ii,i) + if(ao_l(i_ao)==0)then + do j = 1, ao_prim_num(i_ao) + k+=1 + new_nucl_coord(1:3,k)=nucl_coord_transp(1:3,i) + enddo + else if(ao_l(i_ao)==1)then + ! split the function into 2 s functions + ! one is centered in R_x + d + do j = 1, ao_prim_num(i_ao) + k+=1 + new_nucl_coord(2:3,k)= nucl_coord_transp(2:3,i) + new_nucl_coord(1,k)= nucl_coord_transp(1,i)+ao_extra_center + k+=1 + ! one is centered in R_x - d + new_nucl_coord(2:3,k)= nucl_coord_transp(2:3,i) + new_nucl_coord(1,k)= nucl_coord_transp(1,i)-ao_extra_center + enddo + else + print*,'WARNING ! Lmax value not implemented yet !' + print*,'stopping ...' + stop + endif + enddo + enddo + if(k.ne.n_func_tot)then + print*,'pb !!! k NE n_func_tot !!' + print*,k,n_func_tot + stop + endif + +END_PROVIDER diff --git a/plugins/local/extra_basis_int/NEED b/plugins/local/extra_basis_int/NEED index 7f39af7c..6214e5cd 100644 --- a/plugins/local/extra_basis_int/NEED +++ b/plugins/local/extra_basis_int/NEED @@ -1,2 +1,3 @@ ao_extra_basis ao_one_e_ints +ao_two_e_ints From e4b9e4a901aa895b37c92809232715cd6f05a4d6 Mon Sep 17 00:00:00 2001 From: eginer Date: Thu, 12 Dec 2024 12:32:41 +0100 Subject: [PATCH 031/175] fitting ok --- ocaml/Input.ml | 1 + plugins/local/ao_extra_basis/EZFIO.cfg | 6 - .../local/ao_extra_basis/fit_1s_basis.irp.f | 24 ++- .../local/ao_extra_basis/prov_fit_1s.irp.f | 181 +++++++++++++----- .../qp_copy_extra_basis_to_usual_basis | 59 ++++++ scripts/ezfio_interface/qp_edit_template | 23 +++ src/nuclei/nuclei.irp.f | 3 + 7 files changed, 243 insertions(+), 54 deletions(-) create mode 100755 plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis diff --git a/ocaml/Input.ml b/ocaml/Input.ml index f5b5a97f..4639c220 100644 --- a/ocaml/Input.ml +++ b/ocaml/Input.ml @@ -2,6 +2,7 @@ open Qputils;; open Qptypes;; include Input_ao_basis;; +include Input_ao_extra_basis;; include Input_bitmasks;; include Input_determinants_by_hand;; include Input_electrons;; diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg index 9a73f078..8b3a8667 100644 --- a/plugins/local/ao_extra_basis/EZFIO.cfg +++ b/plugins/local/ao_extra_basis/EZFIO.cfg @@ -1,9 +1,3 @@ -[ao_extra_center] -type: double precision -doc: parameter for off-centering s functions to mimick p functions -interface: ezfio, provider -default:0.01 - [ao_extra_basis] type: character*(256) doc: Name of the |ao_extra| basis set diff --git a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f index f544ad83..3be2dbff 100644 --- a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f +++ b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f @@ -1,8 +1,24 @@ program fit_1s_basis implicit none provide lmax_too_big - integer :: i -! print*,'n_func_tot', n_func_tot - provide new_nucl_coord - + integer :: i,j + print*,'////////////////////////////////////////////////////' + print*,'////////////////////////////////////////////////////' + print*,'Fitting the original basis set on uncontracted s only functions ' + print*,'WARNING :: works for now with only P functions at most !!' + print*,'WARNING :: otherwise it will stop ' + print*,'Writting the results in the extra_nuclei and ao_extra_basis folders of EZFIO' + print*,'New number of atomic functions : ' + print*,'n_func_tot = ',n_func_tot + call ezfio_set_extra_nuclei_extra_nucl_num(new_nucl_num) + call ezfio_set_extra_nuclei_extra_nucl_charge(new_nucl_charge_1s) + call ezfio_set_extra_nuclei_extra_nucl_coord(new_nucl_coord_1s) + call ezfio_set_extra_nuclei_extra_nucl_label(new_nucl_label_1s) + call ezfio_set_ao_extra_basis_ao_extra_num(n_func_tot) + call ezfio_set_ao_extra_basis_ao_extra_nucl(new_ao_nucl_1s) + call ezfio_set_ao_extra_basis_ao_extra_prim_num(new_ao_prim_num_1s) + call ezfio_set_ao_extra_basis_ao_extra_coef(new_ao_coef_1s) + call ezfio_set_ao_extra_basis_ao_extra_expo(new_ao_expo_1s) + call ezfio_set_ao_extra_basis_ao_extra_power(new_ao_power_1s) end + diff --git a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f index cba0bb05..4d6f07ae 100644 --- a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f +++ b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f @@ -1,3 +1,8 @@ +BEGIN_PROVIDER [ double precision, ao_extra_center] + implicit none + ao_extra_center = 0.01d0 +END_PROVIDER + BEGIN_PROVIDER [ integer, n_func_tot] implicit none BEGIN_DOC @@ -61,6 +66,7 @@ n_2p_func_tot += ao_prim_num(i) * 2 endif enddo + print*,'n_2p_func_tot = ',n_2p_func_tot END_PROVIDER BEGIN_PROVIDER [ integer, list_2p_functions, (n_2p_func_orig)] @@ -80,80 +86,167 @@ BEGIN_PROVIDER [ integer, new_nucl_num] implicit none - new_nucl_num = n_func_tot + new_nucl_num = nucl_num + n_2p_func_tot + print*,'new_nucl_num = ',new_nucl_num +END_PROVIDER + +BEGIN_PROVIDER [ character*(32), new_nucl_label_1s , (new_nucl_num) ] + implicit none + integer :: i + do i = 1, nucl_num + new_nucl_label_1s(i) = nucl_label(i) + enddo + do i = nucl_num+1,new_nucl_num + new_nucl_label_1s(i) = "X" + enddo END_PROVIDER + + BEGIN_PROVIDER [ double precision, new_nucl_coord_1s, (new_nucl_num,3)] + implicit none + integer :: i,j + do i = 1, new_nucl_num + new_nucl_coord_1s(i,1:3) = new_nucl_coord_1s_transp(1:3,i) + enddo + END_PROVIDER -BEGIN_PROVIDER [ double precision, new_ao_expo_1s , (n_func_tot) ] + BEGIN_PROVIDER [ double precision, new_nucl_coord_1s_transp, (3,new_nucl_num)] +&BEGIN_PROVIDER [ double precision, new_nucl_charge_1s, (new_nucl_num)] implicit none - integer :: i,j,ii,i_ao,k - k = 0 + BEGIN_DOC +! the real atoms are located in the first nucl_num entries +! +! then the fictious atoms are located after + END_DOC + integer :: i,ii,j,i_ao,k,n_ao + integer :: return_xyz_int,power(3),good_i + new_nucl_charge_1s = 0.d0 + do i = 1, nucl_num + new_nucl_coord_1s_transp(1:3,i) = nucl_coord_transp(1:3,i) + new_nucl_charge_1s(i) = nucl_charge(i) + enddo + k = nucl_num do i = 1, nucl_num do ii = 1, Nucl_N_Aos(i) i_ao = nucl_aos_transposed(ii,i) - if(ao_l(i_ao)==0)then - do j = 1, ao_prim_num(i_ao) - k+=1 - new_ao_expo_1s(k)= ao_expo(i_ao,j) - enddo - else if(ao_l(i_ao)==1)then - ! for 'p' functions - ! you replace the function by 2 functions 's' + if(ao_l(i_ao)==1)then + ! split the function into 2 s functions + ! one is centered in R_x + d + power(1:3) = ao_power(i_ao,1:3) + good_i = return_xyz_int(power) do j = 1, ao_prim_num(i_ao) k+=1 - new_ao_expo_1s(k)= ao_expo(i_ao,j) + new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) + new_nucl_coord_1s_transp(good_i,k)+= ao_extra_center + new_nucl_charge_1s(k) = 0.d0 k+=1 - new_ao_expo_1s(k)= ao_expo(i_ao,j) + ! one is centered in R_x - d + new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) + new_nucl_coord_1s_transp(good_i,k)-= ao_extra_center + new_nucl_charge_1s(k) = 0.d0 enddo - else + else if(ao_l(i_ao).gt.1)then print*,'WARNING ! Lmax value not implemented yet !' print*,'stopping ...' stop endif enddo enddo - if(k.ne.n_func_tot)then - print*,'pb !!! k NE n_func_tot !!' - print*,k,n_func_tot - stop - endif END_PROVIDER -BEGIN_PROVIDER [ double precision, new_nucl_coord, (3,new_nucl_num)] + BEGIN_PROVIDER [ integer, new_n_AOs_max] + implicit none + new_n_AOs_max = ao_prim_num_max * n_AOs_max + + END_PROVIDER + + + BEGIN_PROVIDER [ integer, new_Nucl_N_Aos, (new_nucl_num)] +&BEGIN_PROVIDER [ integer, new_nucl_aos_transposed, (new_n_AOs_max,new_nucl_num) ] +&BEGIN_PROVIDER [ double precision, new_ao_expo_1s , (n_func_tot) ] +&BEGIN_PROVIDER [ integer, new_ao_nucl_1s, (n_func_tot)] implicit none - integer :: i,ii,j,i_ao,k - k = 0 + integer :: i,j,ii,i_ao,n_func,n_func_total,n_nucl + double precision :: coef + n_func_total = 0 do i = 1, nucl_num + n_func = 0 do ii = 1, Nucl_N_Aos(i) i_ao = nucl_aos_transposed(ii,i) if(ao_l(i_ao)==0)then do j = 1, ao_prim_num(i_ao) - k+=1 - new_nucl_coord(1:3,k)=nucl_coord_transp(1:3,i) + coef= ao_expo(i_ao,j) + n_func_total += 1 + n_func +=1 + new_nucl_aos_transposed(n_func,i) = n_func_total + new_ao_expo_1s(n_func_total) = coef + new_ao_nucl_1s(n_func_total) = i enddo - else if(ao_l(i_ao)==1)then - ! split the function into 2 s functions - ! one is centered in R_x + d + endif + enddo + new_Nucl_N_Aos(i) = n_func + enddo + n_nucl=nucl_num + do i = 1, nucl_num + do ii = 1, Nucl_N_Aos(i) + i_ao = nucl_aos_transposed(ii,i) + if(ao_l(i_ao)==1)then do j = 1, ao_prim_num(i_ao) - k+=1 - new_nucl_coord(2:3,k)= nucl_coord_transp(2:3,i) - new_nucl_coord(1,k)= nucl_coord_transp(1,i)+ao_extra_center - k+=1 - ! one is centered in R_x - d - new_nucl_coord(2:3,k)= nucl_coord_transp(2:3,i) - new_nucl_coord(1,k)= nucl_coord_transp(1,i)-ao_extra_center + coef= ao_expo(i_ao,j) + n_func_total+=1 + n_nucl +=1 + new_nucl_aos_transposed(1,n_nucl) = n_func_total + new_ao_expo_1s(n_func_total) = coef + new_Nucl_N_Aos(n_nucl)=1 + new_ao_nucl_1s(n_func_total) = n_nucl + + n_func_total+=1 + n_nucl +=1 + new_nucl_aos_transposed(1,n_nucl) = n_func_total + new_ao_expo_1s(n_func_total) = coef + new_Nucl_N_Aos(n_nucl)=1 + new_ao_nucl_1s(n_func_total) = n_nucl enddo - else - print*,'WARNING ! Lmax value not implemented yet !' - print*,'stopping ...' - stop endif enddo enddo - if(k.ne.n_func_tot)then - print*,'pb !!! k NE n_func_tot !!' - print*,k,n_func_tot - stop - endif END_PROVIDER + +BEGIN_PROVIDER [ double precision, new_ao_coef_1s , (n_func_tot) ] + implicit none + integer :: i + BEGIN_DOC +! Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** AOs. + END_DOC + do i = 1, n_func_tot + new_ao_coef_1s(i) = 1.d0 + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, new_ao_prim_num_1s, (n_func_tot)] + implicit none + integer :: i + do i = 1, n_func_tot + new_ao_prim_num_1s(i) = 1 + enddo +END_PROVIDER + +BEGIN_PROVIDER [integer, new_ao_power_1s, (n_func_tot,3)] + implicit none + new_ao_power_1s = 0 +END_PROVIDER + +integer function return_xyz_int(power) + implicit none + integer,intent(in) :: power(3) + if(power(1) == 1 .and. power(2) ==0 .and. power(3) ==0)then + return_xyz_int = 1 + else if (power(2) == 1 .and. power(1) ==0 .and. power(3) ==0)then + return_xyz_int = 2 + else if (power(3) == 1 .and. power(1) ==0 .and. power(1) ==0)then + return_xyz_int = 3 + else + return_xyz_int = -1000 + endif +end diff --git a/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis b/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis new file mode 100755 index 00000000..59be0ee2 --- /dev/null +++ b/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis @@ -0,0 +1,59 @@ +#!/bin/bash +# specify the QP folder +QP=$QP_ROOT +dir=${QP} +# sourcing the quantum_package.rc file +. ${QP}/quantum_package.rc +EZFIO_extra=${1%/} +EZFIO_target=${2%/} + + + +echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" +echo "Extracting data from "$EZFIO_extra +echo "and Copying data to "$EZFIO_target + +### COPYING ALL DATA FROM $EZFIO_extra/nuclei/ to ${EZFIO_target}/extra_nuclei/ +echo "COPYING ALL DATA FROM "$EZFIO_extra"/extra_nuclei/ to "${EZFIO_target}"/nuclei/" +direxists=false +if [ -d ${EZFIO_target}/extra_nuclei/ ] ; then + direxists=true + echo "The directory extra_nuclei exists" + else + echo "PB !!" + direxists=false + mkdir ${EZFIO_target}/extra_nuclei/ +fi +data=`\ls $EZFIO_extra/extra_nuclei/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/extra_nucl/nucl/g' ` + echo $newfile + cp ${EZFIO_extra}/extra_nuclei/$i ${EZFIO_target}/nuclei/$newfile +done + +### COPYING ALL DATA FROM $EZFIO_extra/ao_basis/ to ${EZFIO_target}/ao_extra_basis/ +direxists=false +if [ -d ${EZFIO_target}/ao_extra_basis/ ] ; then + direxists=true + echo "The directory exists ao_extra_basis" + else + echo "PB !!" + direxists=false + mkdir ${EZFIO_target}/ao_extra_basis/ +fi +echo "COPYING ALL DATA FROM "$EZFIO_extra"/ao_basis/ to "${EZFIO_target}"/ao_extra_basis/" +data=`\ls $EZFIO_extra/ao_extra_basis/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/ao_extra/ao/g' ` + echo $newfile + cp ${EZFIO_extra}/ao_extra_basis/$i ${EZFIO_target}/ao_basis/$newfile +done +#i=primitives_normalized +#newfile=primitives_normalized_extra +#cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile + + diff --git a/scripts/ezfio_interface/qp_edit_template b/scripts/ezfio_interface/qp_edit_template index 2380660e..0afd3aed 100644 --- a/scripts/ezfio_interface/qp_edit_template +++ b/scripts/ezfio_interface/qp_edit_template @@ -17,6 +17,7 @@ This file is automatically generated by (** Keywords used to define input sections *) type keyword = | Ao_basis +| Ao_extra_basis | Determinants_by_hand | Electrons | Mo_basis @@ -27,6 +28,7 @@ type keyword = let keyword_to_string = function | Ao_basis -> "AO basis" +| Ao_extra_basis -> "AO extra_basis" | Determinants_by_hand -> "Determinants_by_hand" | Electrons -> "Electrons" | Mo_basis -> "MO basis" @@ -76,6 +78,8 @@ let get s = f Electrons.(read, to_rst) | Nuclei_by_hand -> f Nuclei_by_hand.(read, to_rst) + | Ao_extra_basis -> + f Ao_extra_basis.(read, to_rst) | Ao_basis -> f Ao_basis.(read, to_rst) | Determinants_by_hand -> @@ -123,6 +127,7 @@ let set str s = | Determinants_by_hand -> write Determinants_by_hand.(of_rst, write ~force:false) s | Nuclei_by_hand -> write Nuclei_by_hand.(of_rst, write) s | Ao_basis -> () (* TODO *) + | Ao_extra_basis -> () (* TODO *) | Mo_basis -> () (* TODO *) end @@ -199,6 +204,22 @@ let run check_only ?ndet ?state ?read ?write ezfio_filename = | _ -> () end; + (* Reorder extra basis set *) + begin + match Input.Ao_extra_basis.read() with + | Some aos -> + let ordering = Input.Ao_extra_basis.ordering aos in + let test = Array.copy ordering in + Array.sort compare test ; + if test <> ordering then + begin + Printf.eprintf "Warning: Basis set is not properly ordered. Redordering.\n"; + let new_aos = Input.Ao_extra_basis.reorder aos in + Input.Ao_extra_basis.write new_aos; + end + | _ -> () + end; + begin match ndet with | None -> () @@ -219,6 +240,7 @@ let run check_only ?ndet ?state ?read ?write ezfio_filename = let output = (file_header ezfio_filename) :: ( List.map get [ Ao_basis ; + Ao_extra_basis ; Mo_basis ; ]) in @@ -229,6 +251,7 @@ let run check_only ?ndet ?state ?read ?write ezfio_filename = let tasks = [ Nuclei_by_hand ; Ao_basis; + Ao_extra_basis; Electrons ; {tasks} Mo_basis; diff --git a/src/nuclei/nuclei.irp.f b/src/nuclei/nuclei.irp.f index bb8cc782..9250f33a 100644 --- a/src/nuclei/nuclei.irp.f +++ b/src/nuclei/nuclei.irp.f @@ -201,6 +201,9 @@ x(2) = nucl_coord(k,2) - nucl_coord(l,2) x(3) = nucl_coord(k,3) - nucl_coord(l,3) r2 = x(1)*x(1) + x(2)*x(2) + x(3)*x(3) + if(r2.lt.1.d-6)then + r2 = 1.d-6 + endif nuclear_repulsion += Z12/dsqrt(r2) enddo enddo From 3465065264c69de70ff09dd759ca5bf61cf87980 Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 13 Dec 2024 17:35:24 +0100 Subject: [PATCH 032/175] added transform basis --- plugins/local/ao_extra_basis/EZFIO.cfg | 17 +++++++ plugins/local/ao_extra_basis/LiH.xyz | 4 ++ plugins/local/ao_extra_basis/README.rst | 11 +++++ .../local/ao_extra_basis/fit_1s_basis.irp.f | 17 +++++++ plugins/local/ao_extra_basis/h2o.xyz | 7 +++ plugins/local/ao_extra_basis/install | 2 +- .../local/ao_extra_basis/prov_fit_1s.irp.f | 18 ++++++- .../ao_extra_basis/qp_add_extra_fit_system | 19 +++++++ .../local/ao_extra_basis/qp_copy_extra_basis | 8 +++ .../qp_copy_extra_basis_to_usual_basis | 4 +- plugins/local/ao_extra_basis/qp_fit_1s_basis | 12 +++++ .../ao_extra_basis/transform_basis.irp.f | 49 +++++++++++++++++++ plugins/local/ao_extra_basis/uninstall | 2 +- plugins/local/extra_nuclei/EZFIO.cfg | 33 +++++++++++++ src/aux_quantities/EZFIO.cfg | 7 +++ src/kohn_sham/print_mos.irp.f | 49 +++++++++++++------ src/tools/save_one_e_dm.irp.f | 1 + 17 files changed, 237 insertions(+), 23 deletions(-) create mode 100644 plugins/local/ao_extra_basis/LiH.xyz create mode 100644 plugins/local/ao_extra_basis/h2o.xyz create mode 100755 plugins/local/ao_extra_basis/qp_add_extra_fit_system create mode 100755 plugins/local/ao_extra_basis/qp_fit_1s_basis create mode 100644 plugins/local/ao_extra_basis/transform_basis.irp.f diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg index 8b3a8667..8841c194 100644 --- a/plugins/local/ao_extra_basis/EZFIO.cfg +++ b/plugins/local/ao_extra_basis/EZFIO.cfg @@ -3,6 +3,12 @@ type: character*(256) doc: Name of the |ao_extra| basis set interface: ezfio +[ao_extra_only_1s] +type: logical +doc: If |true|, you know that the additional AO basis is built only with 1s functions +interface: ezfio, provider +default: true + [ao_extra_num] type: integer doc: Number of |ao_extras| @@ -85,3 +91,14 @@ doc: phase shift for each primitive GTOs |ao_extra| size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) interface: ezfio, provider +[ao_extra_one_e_dm] +type: double precision +doc: reduced density matrix on the ao extra basis +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num) +interface: ezfio, provider + +[ao_extra_center] +type: double precision +doc: shift with which the atoms are shifted to mimick p functions +interface: ezfio + diff --git a/plugins/local/ao_extra_basis/LiH.xyz b/plugins/local/ao_extra_basis/LiH.xyz new file mode 100644 index 00000000..03431803 --- /dev/null +++ b/plugins/local/ao_extra_basis/LiH.xyz @@ -0,0 +1,4 @@ +2 + +H 0. 0. 0. +Li 0. 0. 1.0 diff --git a/plugins/local/ao_extra_basis/README.rst b/plugins/local/ao_extra_basis/README.rst index 3d1dc813..f60d71c0 100644 --- a/plugins/local/ao_extra_basis/README.rst +++ b/plugins/local/ao_extra_basis/README.rst @@ -2,3 +2,14 @@ extra_basis =========== +Plugin to handle an extra basis, which is attached to the extra_nuclei. +It is essentially a duplication of all important quantities (coefficients, exponents and so on) of the usual |AO| basis. + +An interesting feature is the possibility to fit any basis made at most with "p" functions onto a purely "s" basis. +This is done with the various scripts here: + + - qp_fit_1s_basis : script that creates an |EZFIO| folder corresponding to an .xyz file and a basis fitted with only "s" functions + - qp_add_extra_fit_system : script that takes as input an |EZFIO| folder and an .xyz file and add an extra_basis and extra_nuclei with a 1s fitted basis + +Ex: +qp_add_extra_fit_system LiH.ezfio/ h2o.xyz # takes the EZFIO folder "LiH.ezfio" and creates all necessary additional basis and nuclei based on h2o.xyz, but only with 1s functions. diff --git a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f index 3be2dbff..ef09d5b2 100644 --- a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f +++ b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f @@ -10,11 +10,28 @@ program fit_1s_basis print*,'Writting the results in the extra_nuclei and ao_extra_basis folders of EZFIO' print*,'New number of atomic functions : ' print*,'n_func_tot = ',n_func_tot + + print*,'extra_fictious_nucl = ',extra_fictious_nucl + do i = 1, extra_fictious_nucl + print*,list_fict_nucl(i) + enddo + print*,'' + print*,'' + do i = 1, nucl_num + print*,list_real_nucl(i) + enddo call ezfio_set_extra_nuclei_extra_nucl_num(new_nucl_num) + call ezfio_set_extra_nuclei_extra_nucl_fictious_num(extra_fictious_nucl) + call ezfio_set_extra_nuclei_extra_nucl_real_num(nucl_num) + call ezfio_set_extra_nuclei_extra_nucl_fictious_list(list_fict_nucl) + call ezfio_set_extra_nuclei_extra_nucl_real_list(list_real_nucl) + call ezfio_set_extra_nuclei_extra_nucl_real_fictious_list(extra_nucl_real_fictious_list_prov) call ezfio_set_extra_nuclei_extra_nucl_charge(new_nucl_charge_1s) call ezfio_set_extra_nuclei_extra_nucl_coord(new_nucl_coord_1s) call ezfio_set_extra_nuclei_extra_nucl_label(new_nucl_label_1s) +! call ezfio_set_ao_extra_basis_ao_extra_num(n_func_tot) + call ezfio_set_ao_extra_basis_ao_extra_center(ao_extra_center) call ezfio_set_ao_extra_basis_ao_extra_nucl(new_ao_nucl_1s) call ezfio_set_ao_extra_basis_ao_extra_prim_num(new_ao_prim_num_1s) call ezfio_set_ao_extra_basis_ao_extra_coef(new_ao_coef_1s) diff --git a/plugins/local/ao_extra_basis/h2o.xyz b/plugins/local/ao_extra_basis/h2o.xyz new file mode 100644 index 00000000..d3928214 --- /dev/null +++ b/plugins/local/ao_extra_basis/h2o.xyz @@ -0,0 +1,7 @@ +3 + +O 0.000000 -0.399441 3.000000 +H 0.761232 0.199721 3.000000 +H -0.761232 0.199721 3.000000 + + diff --git a/plugins/local/ao_extra_basis/install b/plugins/local/ao_extra_basis/install index ca4a1643..e7e668e1 100755 --- a/plugins/local/ao_extra_basis/install +++ b/plugins/local/ao_extra_basis/install @@ -12,7 +12,7 @@ fi currdir=${PWD} # list of the scripts to be used by the module -scripts_list="qp_copy_extra_basis" +scripts_list="qp_copy_extra_basis qp_add_extra_fit_system qp_copy_extra_basis_to_usual_basis qp_fit_1s_basis" # Make a symbolic link for all scripts to be used in the ${QP_ROOT}/scripts/ # directory. diff --git a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f index 4d6f07ae..99a18a6b 100644 --- a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f +++ b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f @@ -84,20 +84,31 @@ enddo END_PROVIDER +BEGIN_PROVIDER [ integer, extra_fictious_nucl] + implicit none + extra_fictious_nucl = n_2p_func_tot +END_PROVIDER + BEGIN_PROVIDER [ integer, new_nucl_num] implicit none new_nucl_num = nucl_num + n_2p_func_tot print*,'new_nucl_num = ',new_nucl_num END_PROVIDER -BEGIN_PROVIDER [ character*(32), new_nucl_label_1s , (new_nucl_num) ] + BEGIN_PROVIDER [ character*(32), new_nucl_label_1s , (new_nucl_num) ] +&BEGIN_PROVIDER [ integer, list_real_nucl, (nucl_num) ] +&BEGIN_PROVIDER [ integer, list_fict_nucl, (extra_fictious_nucl) ] implicit none - integer :: i + integer :: i,j do i = 1, nucl_num new_nucl_label_1s(i) = nucl_label(i) + list_real_nucl(i) = i enddo + j=0 do i = nucl_num+1,new_nucl_num + j+=1 new_nucl_label_1s(i) = "X" + list_fict_nucl(j) = i enddo END_PROVIDER @@ -111,6 +122,7 @@ BEGIN_PROVIDER [ double precision, new_nucl_coord_1s_transp, (3,new_nucl_num)] &BEGIN_PROVIDER [ double precision, new_nucl_charge_1s, (new_nucl_num)] +&BEGIN_PROVIDER [ integer, extra_nucl_real_fictious_list_prov, (extra_fictious_nucl)] implicit none BEGIN_DOC ! the real atoms are located in the first nucl_num entries @@ -138,11 +150,13 @@ new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) new_nucl_coord_1s_transp(good_i,k)+= ao_extra_center new_nucl_charge_1s(k) = 0.d0 + extra_nucl_real_fictious_list_prov(k-nucl_num)=i k+=1 ! one is centered in R_x - d new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) new_nucl_coord_1s_transp(good_i,k)-= ao_extra_center new_nucl_charge_1s(k) = 0.d0 + extra_nucl_real_fictious_list_prov(k-nucl_num)=i enddo else if(ao_l(i_ao).gt.1)then print*,'WARNING ! Lmax value not implemented yet !' diff --git a/plugins/local/ao_extra_basis/qp_add_extra_fit_system b/plugins/local/ao_extra_basis/qp_add_extra_fit_system new file mode 100755 index 00000000..dae95062 --- /dev/null +++ b/plugins/local/ao_extra_basis/qp_add_extra_fit_system @@ -0,0 +1,19 @@ +#!/bin/bash +# specify the QP folder +QP=$QP_ROOT +dir=${QP} +# sourcing the quantum_package.rc file +. ${QP}/quantum_package.rc +# The main EZFIO folder +main=${1%/} +# The XYZ file containing the geometry of the additional system you want to add +extra=${2%.xyz} +basis_extra=sto-3g +ezfio_extra=${extra}_${basis_extra}_1s +echo $ezfio_extra +qp_fit_1s_basis $extra $basis_extra +qp set_file $ezfio_extra +qp run scf | tee ${ezfio_extra}.scf.out +qp run save_one_e_dm | tee ${ezfio_extra}.one_rdm.out +qp_copy_extra_basis ${ezfio_extra} $main + diff --git a/plugins/local/ao_extra_basis/qp_copy_extra_basis b/plugins/local/ao_extra_basis/qp_copy_extra_basis index 551bbe1f..cb435e18 100755 --- a/plugins/local/ao_extra_basis/qp_copy_extra_basis +++ b/plugins/local/ao_extra_basis/qp_copy_extra_basis @@ -4,7 +4,11 @@ QP=$QP_ROOT dir=${QP} # sourcing the quantum_package.rc file . ${QP}/quantum_package.rc +# script that copy all data from |AO| basis and nuclei of EZFIO_extra to the ao_extra_basis and extra_nuclei of EZFIO_target +# use: +# qp_copy_extra_basis EZFIO_extra EZFIO_target EZFIO_extra=${1%/} +EZFIO_extra=${EZFIO_extra%.xyz} EZFIO_target=${2%/} @@ -56,4 +60,8 @@ i=primitives_normalized newfile=primitives_normalized_extra cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile +echo "COPYING ALL DATA FROM "$EZFIO_extra"/aux_quantities/ to "${EZFIO_target}"/ao_extra_basis/" +i=data_one_e_dm_tot_ao.gz +newfile=ao_extra_one_e_dm.gz +cp ${EZFIO_extra}/aux_quantities/$i ${EZFIO_target}/ao_extra_basis/$newfile diff --git a/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis b/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis index 59be0ee2..ba7e6a71 100755 --- a/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis +++ b/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis @@ -1,5 +1,6 @@ #!/bin/bash # specify the QP folder +# script that copy all data in ao_extra_basis and extra_nuclei and copy it to ao_basis and ao_nuclei QP=$QP_ROOT dir=${QP} # sourcing the quantum_package.rc file @@ -52,8 +53,5 @@ do echo $newfile cp ${EZFIO_extra}/ao_extra_basis/$i ${EZFIO_target}/ao_basis/$newfile done -#i=primitives_normalized -#newfile=primitives_normalized_extra -#cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile diff --git a/plugins/local/ao_extra_basis/qp_fit_1s_basis b/plugins/local/ao_extra_basis/qp_fit_1s_basis new file mode 100755 index 00000000..366e478a --- /dev/null +++ b/plugins/local/ao_extra_basis/qp_fit_1s_basis @@ -0,0 +1,12 @@ +#!/bin/bash +## Takes as an argument an xyz file and a basis, and fit the AO basis onto an "s" basis only +## use: +# qp_fit_1s_basis my_xyz_file.xyz basis +source ~/qp2/quantum_package.rc +input=${1%.xyz} +basis=$2 +ezfio_fit=${input}_${basis}_1s +qp create_ezfio -b $basis $input.xyz -o $ezfio_fit +# Fitting the original basis on 1s only basis functions +qp run fit_1s_basis |tee ${ezfio_fit}.fit_1s.out +qp_copy_extra_basis_to_usual_basis $ezfio_fit $ezfio_fit diff --git a/plugins/local/ao_extra_basis/transform_basis.irp.f b/plugins/local/ao_extra_basis/transform_basis.irp.f new file mode 100644 index 00000000..374d2dfc --- /dev/null +++ b/plugins/local/ao_extra_basis/transform_basis.irp.f @@ -0,0 +1,49 @@ +subroutine rotate_nuclei(phi,theta,psi,nucl_centers,n_nucl,nucl_centers_after) + implicit none + BEGIN_DOC + ! routine that rotates a set of nuclei according to three axis corresponding to angles phi, theta, psi. + END_DOC + double precision, intent(in) :: phi,theta,psi + double precision, intent(in) :: nucl_centers(3,n_nucl) + integer, intent(in) :: n_nucl + double precision, intent(out):: nucl_centers_after(3,n_nucl) + double precision :: r_mat(3,3) + call r_phi_theta_psi_matrix(phi,theta,psi,r_mat) + call get_AB_prod(r_mat,3,3,nucl_centers,n_nucl,nucl_centers_after) + +end + + +subroutine r_phi_theta_psi_matrix(phi,theta,psi,r_mat) + implicit none + BEGIN_DOC + ! routine that creates the rotation matrix corresponding to phi,theta,psi + ! + ! according to conventions in MDFT code + END_DOC + double precision, intent(in) :: phi,theta,psi + double precision, intent(out):: r_mat(3,3) + double precision :: ctheta, stheta + double precision :: cphi , sphi + double precision :: cpsi , spsi + ctheta = dcos(theta) + cphi = dcos(phi) + cpsi = dcos(psi) + + stheta = dsin(theta) + sphi = dsin(phi) + spsi = dsin(psi) + + r_mat(1,1) = ctheta*cphi*cpsi-sphi*spsi + r_mat(1,2) = -ctheta*cphi*spsi-sphi*cpsi + r_mat(1,3) = stheta*cphi + + r_mat(2,1) = ctheta*sphi*cpsi+cphi*spsi + r_mat(2,2) = -ctheta*sphi*spsi+cphi*cpsi + r_mat(2,3) = stheta*sphi + + r_mat(3,1) = -stheta*cpsi + r_mat(3,2) = stheta*spsi + r_mat(3,3) = ctheta + +end diff --git a/plugins/local/ao_extra_basis/uninstall b/plugins/local/ao_extra_basis/uninstall index ff7f8c6a..0e4cd253 100755 --- a/plugins/local/ao_extra_basis/uninstall +++ b/plugins/local/ao_extra_basis/uninstall @@ -9,7 +9,7 @@ then fi # list of the scripts to be used by the module -scripts_list="qp_copy_extra_basis" +scripts_list="qp_copy_extra_basis qp_add_extra_fit_system qp_copy_extra_basis_to_usual_basis qp_fit_1s_basis" # Destroy ONLY the symbolic link for the scripts to be used in the # ${QP_ROOT}/scripts/ directory. diff --git a/plugins/local/extra_nuclei/EZFIO.cfg b/plugins/local/extra_nuclei/EZFIO.cfg index e09a7dfd..8c04b4c7 100644 --- a/plugins/local/extra_nuclei/EZFIO.cfg +++ b/plugins/local/extra_nuclei/EZFIO.cfg @@ -3,6 +3,12 @@ doc: Number of nuclei type: integer interface: ezfio, provider +[extra_nucl_pouet] +doc: Number of nuclei +type: integer +interface: ezfio, provider, ocaml +default:1 + [extra_nucl_label] doc: Nuclear labels type: character*(32) @@ -21,3 +27,30 @@ type: double precision size: (extra_nuclei.extra_nucl_num,3) interface: ezfio +[extra_nucl_real_num] +doc: Number of real nuclei +type: integer +interface: ezfio, provider + +[extra_nucl_fictious_num] +doc: Number of fictious nuclei +type: integer +interface: ezfio, provider + +[extra_nucl_real_fictious_list] +doc: List of real nuclei to which fictious nuclei are attached to +type: integer +size: (extra_nuclei.extra_nucl_fictious_num) +interface: ezfio, provider + +[extra_nucl_fictious_list] +doc: List of fictious nuclei +type: integer +size: (extra_nuclei.extra_nucl_fictious_num) +interface: ezfio, provider + +[extra_nucl_real_list] +doc: List of real nuclei +type: integer +size: (extra_nuclei.extra_nucl_real_num) +interface: ezfio, provider diff --git a/src/aux_quantities/EZFIO.cfg b/src/aux_quantities/EZFIO.cfg index 6b4bd0f2..3f6d7783 100644 --- a/src/aux_quantities/EZFIO.cfg +++ b/src/aux_quantities/EZFIO.cfg @@ -38,3 +38,10 @@ type: double precision size: (ao_basis.ao_num,ao_basis.ao_num,determinants.n_states) +[data_one_e_dm_tot_ao] +interface: ezfio, provider +doc: TOTAL (Alpha+Beta) one body density matrix on the |AO| basis computed with the wave function +type: double precision +size: (ao_basis.ao_num,ao_basis.ao_num,determinants.n_states) + + diff --git a/src/kohn_sham/print_mos.irp.f b/src/kohn_sham/print_mos.irp.f index 19bb98bc..44718964 100644 --- a/src/kohn_sham/print_mos.irp.f +++ b/src/kohn_sham/print_mos.irp.f @@ -1,24 +1,41 @@ program print_mos implicit none integer :: i,nx - double precision :: r(3), xmax, dx, accu - double precision, allocatable :: mos_array(:) - double precision:: alpha,envelop,dm_a,dm_b - allocate(mos_array(mo_num)) - xmax = 5.d0 - nx = 1000 - dx=xmax/dble(nx) - r = 0.d0 - alpha = 0.5d0 + print*,ao_kinetic_integrals(1,1) + double precision :: xmin,xmax,dx,x,accu,gtt,g,alpha,pi,accu_norm + pi = dacos(-1.d0) + alpha = 2.D0 + xmin=0.d0 + xmax=5.D0 + nx=10000 + dx=(xmax-xmin)/dble(nx) + x = 0.d0 + accu = 0.d0 + accu_norm = 0.d0 do i = 1, nx - call dm_dft_alpha_beta_at_r(r,dm_a,dm_b) - call give_all_mos_at_r(r,mos_array) - accu = mos_array(3)**2+mos_array(4)**2+mos_array(5)**2 - accu = dsqrt(accu) - envelop = (1.d0 - dexp(-alpha * r(3)**2)) - write(33,'(100(F16.10,X))')r(3), mos_array(1), mos_array(2), accu, dm_a+dm_b, envelop - r(3) += dx + accu += g(x,alpha)*gtt(x,alpha)*x**2 * dx + accu_norm += g(x,alpha)**2*x**2 * dx + write(33,*)x,g(x,alpha),gtt(x,alpha) + x+=dx enddo + accu=accu * 4.d0 * pi + accu_norm *= 4.d0 * pi + print*,'accu_norm = ',accu_norm + accu*=-0.5D0 + print*,'accu = ',accu/accu_norm +end + + +double precision function gtt(x,alpha) + implicit none + double precision, intent(in) :: x,alpha + gtt = dexp(-alpha*x*x) * (4.D0*alpha**2*x**2 - 4.d0 * alpha) end +double precision function g(x,alpha) + implicit none + double precision, intent(in) :: x,alpha + g = dexp(-alpha*x*x) + +end diff --git a/src/tools/save_one_e_dm.irp.f b/src/tools/save_one_e_dm.irp.f index c888f55c..c206343b 100644 --- a/src/tools/save_one_e_dm.irp.f +++ b/src/tools/save_one_e_dm.irp.f @@ -27,4 +27,5 @@ subroutine routine_save_one_e_dm call ezfio_set_aux_quantities_data_one_e_dm_beta_mo(one_e_dm_mo_beta) call ezfio_set_aux_quantities_data_one_e_dm_alpha_ao(one_e_dm_ao_alpha) call ezfio_set_aux_quantities_data_one_e_dm_beta_ao(one_e_dm_ao_beta) + call ezfio_set_aux_quantities_data_one_e_dm_tot_ao(one_e_dm_ao) end From 5421126fc173d570d1d30fc7d7e0d4256a160368 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 16 Dec 2024 17:13:32 +0100 Subject: [PATCH 033/175] Fixed NAO import TREXIO --- src/determinants/ref_bitmask.irp.f | 164 +++++++++++++++++------ src/trexio/import_trexio_integrals.irp.f | 4 + 2 files changed, 129 insertions(+), 39 deletions(-) diff --git a/src/determinants/ref_bitmask.irp.f b/src/determinants/ref_bitmask.irp.f index 18fa2396..751b8b16 100644 --- a/src/determinants/ref_bitmask.irp.f +++ b/src/determinants/ref_bitmask.irp.f @@ -1,84 +1,170 @@ - BEGIN_PROVIDER [ double precision, ref_bitmask_energy ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_one_e_energy ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_kinetic_energy ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_n_e_energy ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_two_e_energy ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_ab ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_bb ] -&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_aa ] +BEGIN_PROVIDER [ double precision, ref_bitmask_one_e_energy ] use bitmasks implicit none BEGIN_DOC - ! Energy of the reference bitmask used in Slater rules + ! One-electron energy of the reference bitmask used in Slater rules END_DOC integer :: occ(N_int*bit_kind_size,2) - integer :: i,j + integer :: i call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int) call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int) - ref_bitmask_energy = 0.d0 ref_bitmask_one_e_energy = 0.d0 + + do i = 1, elec_beta_num + ref_bitmask_one_e_energy += mo_one_e_integrals(occ(i,1),occ(i,1)) + mo_one_e_integrals(occ(i,2),occ(i,2)) + enddo + + do i = elec_beta_num+1,elec_alpha_num + ref_bitmask_one_e_energy += mo_one_e_integrals(occ(i,1),occ(i,1)) + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ref_bitmask_kinetic_energy ] + + use bitmasks + implicit none + BEGIN_DOC + ! Kinetic energy of the reference bitmask used in Slater rules + END_DOC + + integer :: occ(N_int*bit_kind_size,2) + integer :: i + + call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int) + call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int) + + ref_bitmask_kinetic_energy = 0.d0 - ref_bitmask_n_e_energy = 0.d0 - ref_bitmask_two_e_energy = 0.d0 do i = 1, elec_beta_num - ref_bitmask_energy += mo_one_e_integrals(occ(i,1),occ(i,1)) + mo_one_e_integrals(occ(i,2),occ(i,2)) ref_bitmask_kinetic_energy += mo_kinetic_integrals(occ(i,1),occ(i,1)) + mo_kinetic_integrals(occ(i,2),occ(i,2)) + enddo + + do i = elec_beta_num+1,elec_alpha_num + ref_bitmask_kinetic_energy += mo_kinetic_integrals(occ(i,1),occ(i,1)) + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ref_bitmask_n_e_energy ] + + use bitmasks + implicit none + BEGIN_DOC + ! Nucleus-electron energy of the reference bitmask used in Slater rules + END_DOC + + integer :: occ(N_int*bit_kind_size,2) + integer :: i + + call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int) + call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int) + + + ref_bitmask_n_e_energy = 0.d0 + + do i = 1, elec_beta_num ref_bitmask_n_e_energy += mo_integrals_n_e(occ(i,1),occ(i,1)) + mo_integrals_n_e(occ(i,2),occ(i,2)) + enddo + + do i = elec_beta_num+1,elec_alpha_num + ref_bitmask_n_e_energy += mo_integrals_n_e(occ(i,1),occ(i,1)) + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ref_bitmask_two_e_energy ] + + use bitmasks + implicit none + BEGIN_DOC + ! Energy of the reference bitmask used in Slater rules + END_DOC + + integer :: occ(N_int*bit_kind_size,2) + integer :: i,j + + call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int) + call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int) + + ref_bitmask_two_e_energy = 0.d0 + + do i = 1, elec_beta_num do j = i+1, elec_alpha_num ref_bitmask_two_e_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1)) - ref_bitmask_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1)) enddo do j= 1, elec_alpha_num ref_bitmask_two_e_energy += mo_two_e_integrals_jj(occ(j,1),occ(i,2)) - ref_bitmask_energy += mo_two_e_integrals_jj(occ(j,1),occ(i,2)) enddo do j = i+1, elec_beta_num ref_bitmask_two_e_energy += mo_two_e_integrals_jj_anti(occ(j,2),occ(i,2)) - ref_bitmask_energy += mo_two_e_integrals_jj_anti(occ(j,2),occ(i,2)) enddo enddo do i = elec_beta_num+1,elec_alpha_num - ref_bitmask_energy += mo_one_e_integrals(occ(i,1),occ(i,1)) - ref_bitmask_kinetic_energy += mo_kinetic_integrals(occ(i,1),occ(i,1)) - ref_bitmask_n_e_energy += mo_integrals_n_e(occ(i,1),occ(i,1)) do j = i+1, elec_alpha_num ref_bitmask_two_e_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1)) - ref_bitmask_energy += mo_two_e_integrals_jj_anti(occ(j,1),occ(i,1)) enddo enddo - ref_bitmask_one_e_energy = ref_bitmask_kinetic_energy + ref_bitmask_n_e_energy +END_PROVIDER - ref_bitmask_energy_ab = 0.d0 - do i = 1, elec_alpha_num - do j = 1, elec_beta_num - ref_bitmask_energy_ab += mo_two_e_integrals_jj(occ(i,1),occ(j,2)) + BEGIN_PROVIDER [ double precision, ref_bitmask_energy_ab ] +&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_bb ] +&BEGIN_PROVIDER [ double precision, ref_bitmask_energy_aa ] + + use bitmasks + implicit none + BEGIN_DOC + ! Energy of the reference bitmask used in Slater rules + END_DOC + + integer :: occ(N_int*bit_kind_size,2) + integer :: i,j + + call bitstring_to_list(ref_bitmask(1,1), occ(1,1), i, N_int) + call bitstring_to_list(ref_bitmask(1,2), occ(1,2), i, N_int) + + ref_bitmask_energy_ab = 0.d0 + do i = 1, elec_alpha_num + do j = 1, elec_beta_num + ref_bitmask_energy_ab += mo_two_e_integrals_jj(occ(i,1),occ(j,2)) + enddo enddo - enddo - ref_bitmask_energy_aa = 0.d0 - do i = 1, elec_alpha_num - do j = 1, elec_alpha_num - ref_bitmask_energy_aa += mo_two_e_integrals_jj_anti(occ(i,1),occ(j,1)) + ref_bitmask_energy_aa = 0.d0 + do i = 1, elec_alpha_num + do j = 1, elec_alpha_num + ref_bitmask_energy_aa += mo_two_e_integrals_jj_anti(occ(i,1),occ(j,1)) + enddo enddo - enddo - ref_bitmask_energy_aa = ref_bitmask_energy_aa * 0.5d0 + ref_bitmask_energy_aa = ref_bitmask_energy_aa * 0.5d0 - ref_bitmask_energy_bb = 0.d0 - do i = 1, elec_beta_num - do j = 1, elec_beta_num - ref_bitmask_energy_bb += mo_two_e_integrals_jj_anti(occ(i,2),occ(j,2)) + ref_bitmask_energy_bb = 0.d0 + do i = 1, elec_beta_num + do j = 1, elec_beta_num + ref_bitmask_energy_bb += mo_two_e_integrals_jj_anti(occ(i,2),occ(j,2)) + enddo enddo - enddo - ref_bitmask_energy_bb = ref_bitmask_energy_bb * 0.5d0 + ref_bitmask_energy_bb = ref_bitmask_energy_bb * 0.5d0 + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ref_bitmask_energy ] + + use bitmasks + implicit none + BEGIN_DOC + ! Energy of the reference bitmask used in Slater rules + END_DOC + ref_bitmask_energy = ref_bitmask_one_e_energy + ref_bitmask_two_e_energy END_PROVIDER diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index dc342197..250a67c1 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -165,6 +165,7 @@ subroutine run(f) write(iunit) tmp(:,:,:) close(iunit) call ezfio_set_ao_two_e_ints_io_ao_cholesky('Read') + call ezfio_set_ao_two_e_ints_do_ao_cholesky(.True.) deallocate(Vi, V, tmp) print *, 'Cholesky AO integrals read from TREXIO file' @@ -206,6 +207,7 @@ subroutine run(f) call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map) call ezfio_set_ao_two_e_ints_io_ao_two_e_integrals('Read') + call ezfio_set_ao_two_e_ints_do_ao_cholesky(.False.) deallocate(buffer_i, buffer_values, Vi, V) print *, 'AO integrals read from TREXIO file' @@ -274,6 +276,7 @@ subroutine run(f) write(iunit) tmp(:,:,:) close(iunit) call ezfio_set_mo_two_e_ints_io_mo_cholesky('Read') + call ezfio_set_ao_two_e_ints_do_ao_cholesky(.True.) deallocate(Vi, V, tmp) print *, 'Cholesky MO integrals read from TREXIO file' @@ -314,6 +317,7 @@ subroutine run(f) call map_save_to_disk(trim(ezfio_filename)//'/work/mo_ints',mo_integrals_map) call ezfio_set_mo_two_e_ints_io_mo_two_e_integrals('Read') + call ezfio_set_ao_two_e_ints_do_ao_cholesky(.False.) deallocate(buffer_i, buffer_values, Vi, V) print *, 'MO integrals read from TREXIO file' endif From fe675fab925201b313aeba48c6cd56892d2c1f55 Mon Sep 17 00:00:00 2001 From: eginer Date: Mon, 16 Dec 2024 19:01:31 +0100 Subject: [PATCH 034/175] fixed the Input_ao_extra_basis.ml and beginning to work on extra_basis --- ocaml/Input_ao_extra_basis.ml | 534 ++++++++++++++++++ .../local/ao_extra_basis/density_extra.irp.f | 87 +++ plugins/local/extra_basis_int/coul_1s.irp.f | 23 + .../extra_basis_int/extra_basis_int.irp.f | 27 +- plugins/local/extra_nuclei/nuclei.irp.f | 16 + src/ao_basis/cgtos.irp.f | 164 ++++++ src/ao_one_e_ints/aos_cgtos.irp.f | 180 ------ 7 files changed, 850 insertions(+), 181 deletions(-) create mode 100644 ocaml/Input_ao_extra_basis.ml create mode 100644 plugins/local/ao_extra_basis/density_extra.irp.f create mode 100644 plugins/local/extra_basis_int/coul_1s.irp.f diff --git a/ocaml/Input_ao_extra_basis.ml b/ocaml/Input_ao_extra_basis.ml new file mode 100644 index 00000000..93013942 --- /dev/null +++ b/ocaml/Input_ao_extra_basis.ml @@ -0,0 +1,534 @@ +open Qptypes;; +open Qputils;; +open Sexplib.Std;; + +module Ao_extra_basis : sig + type t = + { ao_extra_basis : AO_basis_name.t; + ao_extra_num : AO_number.t ; + ao_extra_prim_num : AO_prim_number.t array; + ao_extra_prim_num_max : AO_prim_number.t; + ao_extra_nucl : Nucl_number.t array; + ao_extra_power : Angmom.Xyz.t array; + ao_extra_coef : AO_coef.t array; + ao_extra_expo : AO_expo.t array; + ao_extra_cartesian : bool; + ao_extra_normalized : bool; + primitives_normalized_extra : bool; + } [@@deriving sexp] + ;; + val read : unit -> t option + val to_string : t -> string + val to_basis : t -> Basis.t + val reorder : t -> t + val ordering : t -> int array + val write : t -> unit + val to_md5 : t -> MD5.t + val to_rst : t -> Rst_string.t +end = struct + type t = + { ao_extra_basis : AO_basis_name.t; + ao_extra_num : AO_number.t ; + ao_extra_prim_num : AO_prim_number.t array; + ao_extra_prim_num_max : AO_prim_number.t; + ao_extra_nucl : Nucl_number.t array; + ao_extra_power : Angmom.Xyz.t array; + ao_extra_coef : AO_coef.t array; + ao_extra_expo : AO_expo.t array; + ao_extra_cartesian : bool; + ao_extra_normalized : bool; + primitives_normalized_extra : bool; + } [@@deriving sexp] + ;; + + let get_default = Qpackage.get_ezfio_default "ao_extra_basis";; + + let read_ao_extra_basis () = + let result = + Ezfio.get_ao_extra_basis_ao_extra_basis () + in + if result <> "None" then + AO_basis_name.of_string result + else failwith "No basis" + ;; + + let read_ao_extra_num () = + Ezfio.get_ao_extra_basis_ao_extra_num () + |> AO_number.of_int + ;; + + let read_ao_extra_prim_num () = + if Ezfio.has_ao_extra_basis_ao_extra_prim_num () then + Ezfio.get_ao_extra_basis_ao_extra_prim_num () + |> Ezfio.flattened_ezfio + |> Array.map AO_prim_number.of_int + else + [||] + ;; + + let read_ao_extra_prim_num_max () = + if Ezfio.has_ao_extra_basis_ao_extra_prim_num () then + Ezfio.get_ao_extra_basis_ao_extra_prim_num () + |> Ezfio.flattened_ezfio + |> Array.fold_left (fun x y -> if x>y then x else y) 0 + |> AO_prim_number.of_int + else + AO_prim_number.of_int 0 + ;; + + let read_ao_extra_nucl () = + if Ezfio.has_ao_extra_basis_ao_extra_nucl () then + let nmax = Nucl_number.get_max () in + Ezfio.get_ao_extra_basis_ao_extra_nucl () + |> Ezfio.flattened_ezfio + |> Array.map (fun x-> Nucl_number.of_int ~max:nmax x) + else + [||] + ;; + + let read_ao_extra_power () = + if Ezfio.has_ao_extra_basis_ao_extra_power () then + let x = Ezfio.get_ao_extra_basis_ao_extra_power () in + let dim = x.Ezfio.dim.(0) in + let data = Ezfio.flattened_ezfio x in + let result = Array.init dim (fun x -> "") in + for i=1 to dim + do + if (data.(i-1) > 0) then + result.(i-1) <- result.(i-1)^"x"^(string_of_int data.(i-1)); + if (data.(dim+i-1) > 0) then + result.(i-1) <- result.(i-1)^"y"^(string_of_int data.(dim+i-1)); + if (data.(2*dim+i-1) > 0) then + result.(i-1) <- result.(i-1)^"z"^(string_of_int data.(2*dim+i-1)); + done; + Array.map Angmom.Xyz.of_string result + else + [||] + ;; + + let read_ao_extra_coef () = + if Ezfio.has_ao_extra_basis_ao_extra_coef () then + Ezfio.get_ao_extra_basis_ao_extra_coef () + |> Ezfio.flattened_ezfio + |> Array.map AO_coef.of_float + else + [||] + ;; + + let read_ao_extra_expo () = + if Ezfio.has_ao_extra_basis_ao_extra_expo () then + Ezfio.get_ao_extra_basis_ao_extra_expo () + |> Ezfio.flattened_ezfio + |> Array.map AO_expo.of_float + else + [||] + ;; + + let read_ao_extra_cartesian () = + if not (Ezfio.has_ao_extra_basis_ao_extra_cartesian ()) then + get_default "ao_extra_cartesian" + |> bool_of_string + |> Ezfio.set_ao_extra_basis_ao_extra_cartesian + ; + Ezfio.get_ao_extra_basis_ao_extra_cartesian () + ;; + + let read_ao_extra_normalized () = + if not (Ezfio.has_ao_extra_basis_ao_extra_normalized()) then + get_default "ao_extra_normalized" + |> bool_of_string + |> Ezfio.set_ao_extra_basis_ao_extra_normalized + ; + Ezfio.get_ao_extra_basis_ao_extra_normalized () + ;; + + let read_primitives_normalized_extra () = + if not (Ezfio.has_ao_extra_basis_primitives_normalized_extra()) then + get_default "primitives_normalized_extra" + |> bool_of_string + |> Ezfio.set_ao_extra_basis_primitives_normalized_extra + ; + Ezfio.get_ao_extra_basis_primitives_normalized_extra () + ;; + + let to_long_basis b = + let ao_extra_num = AO_number.to_int b.ao_extra_num in + let gto_array = Array.init (AO_number.to_int b.ao_extra_num) + (fun i -> + let s = Angmom.Xyz.to_symmetry b.ao_extra_power.(i) in + let ao_extra_prim_num = AO_prim_number.to_int b.ao_extra_prim_num.(i) in + let prims = List.init ao_extra_prim_num (fun j -> + let prim = { GaussianPrimitive.sym = s ; + GaussianPrimitive.expo = b.ao_extra_expo.(ao_extra_num*j+i) + } + in + let coef = b.ao_extra_coef.(ao_extra_num*j+i) in + (prim,coef) + ) in + Gto.of_prim_coef_list prims + ) + in + let rec do_work accu sym gto nucl = + match (sym, gto, nucl) with + | (s::srest, g::grest, n::nrest) -> + do_work ((s,g,n)::accu) srest grest nrest + | ([],[],[]) -> List.rev accu + | _ -> assert false + in + do_work [] + (Array.to_list b.ao_extra_power) + (Array.to_list gto_array) + (Array.to_list b.ao_extra_nucl) + ;; + let to_basis b = + to_long_basis b + |> Long_basis.to_basis + ;; + + let to_md5 b = + let short_basis = to_basis b in + Basis.to_md5 short_basis + ;; + + + + let write_md5 b = + to_md5 b + |> MD5.to_string + |> Ezfio.set_ao_extra_basis_ao_extra_md5 + ;; + + let write_ao_extra_basis name = + AO_basis_name.to_string name + |> Ezfio.set_ao_extra_basis_ao_extra_basis + ;; + + let write b = + let { ao_extra_basis ; + ao_extra_num ; + ao_extra_prim_num ; + ao_extra_prim_num_max ; + ao_extra_nucl ; + ao_extra_power ; + ao_extra_coef ; + ao_extra_expo ; + ao_extra_cartesian ; + ao_extra_normalized ; + primitives_normalized_extra ; + } = b + in + write_md5 b ; + write_ao_extra_basis ao_extra_basis; + let ao_extra_num = AO_number.to_int ao_extra_num + and ao_extra_prim_num_max = AO_prim_number.to_int ao_extra_prim_num_max + in + let ao_extra_prim_num = + Array.to_list ao_extra_prim_num + |> list_map AO_prim_number.to_int + in + Ezfio.set_ao_extra_basis_ao_extra_prim_num (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| ao_extra_num |] ~data:ao_extra_prim_num) ; + + let ao_extra_nucl = + Array.to_list ao_extra_nucl + |> list_map Nucl_number.to_int + in + Ezfio.set_ao_extra_basis_ao_extra_nucl(Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| ao_extra_num |] ~data:ao_extra_nucl) ; + + let ao_extra_power = + let l = Array.to_list ao_extra_power in + List.concat [ + (list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.x) l) ; + (list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.y) l) ; + (list_map (fun a -> Positive_int.to_int a.Angmom.Xyz.z) l) ] + in + Ezfio.set_ao_extra_basis_ao_extra_power(Ezfio.ezfio_array_of_list + ~rank:2 ~dim:[| ao_extra_num ; 3 |] ~data:ao_extra_power) ; + + Ezfio.set_ao_extra_basis_ao_extra_cartesian(ao_extra_cartesian); + Ezfio.set_ao_extra_basis_ao_extra_normalized(ao_extra_normalized); + Ezfio.set_ao_extra_basis_primitives_normalized_extra(primitives_normalized_extra); + + let ao_extra_coef = + Array.to_list ao_extra_coef + |> list_map AO_coef.to_float + in + Ezfio.set_ao_extra_basis_ao_extra_coef(Ezfio.ezfio_array_of_list + ~rank:2 ~dim:[| ao_extra_num ; ao_extra_prim_num_max |] ~data:ao_extra_coef) ; + + let ao_extra_expo = + Array.to_list ao_extra_expo + |> list_map AO_expo.to_float + in + Ezfio.set_ao_extra_basis_ao_extra_expo(Ezfio.ezfio_array_of_list + ~rank:2 ~dim:[| ao_extra_num ; ao_extra_prim_num_max |] ~data:ao_extra_expo) ; + + + ;; + + + let read () = + try + let result = + { ao_extra_basis = read_ao_extra_basis (); + ao_extra_num = read_ao_extra_num () ; + ao_extra_prim_num = read_ao_extra_prim_num (); + ao_extra_prim_num_max = read_ao_extra_prim_num_max (); + ao_extra_nucl = read_ao_extra_nucl (); + ao_extra_power = read_ao_extra_power (); + ao_extra_coef = read_ao_extra_coef () ; + ao_extra_expo = read_ao_extra_expo () ; + ao_extra_cartesian = read_ao_extra_cartesian () ; + ao_extra_normalized = read_ao_extra_normalized () ; + primitives_normalized_extra = read_primitives_normalized_extra () ; + } + in + to_md5 result + |> MD5.to_string + |> Ezfio.set_ao_extra_basis_ao_extra_md5 ; + Some result + with + | _ -> ( "None" + |> Digest.string + |> Digest.to_hex + |> Ezfio.set_ao_extra_basis_ao_extra_md5 ; None) + ;; + + + let ordering b = + let ordered_basis = + to_basis b + |> Long_basis.of_basis + |> Array.of_list + and unordered_basis = + to_long_basis b + |> Array.of_list + in + let find x a = + let rec find x a i = + if i = Array.length a then + find2 x a 0 + else + if a.(i) = Some x then + (a.(i) <- None ; i) + else + find x a (i+1) + and find2 (s,g,n) a i = + if i = Array.length a then -1 + else + match a.(i) with + | None -> find2 (s,g,n) a (i+1) + | Some (s', g', n') -> + if s <> s' || n <> n' then find2 (s,g,n) a (i+1) + else + let lc = list_map (fun (prim, _) -> prim) g.Gto.lc + and lc' = list_map (fun (prim, _) -> prim) g'.Gto.lc + in + if lc <> lc' then find2 (s,g,n) a (i+1) else (a.(i) <- None ; i) + in + find x a 0 + in + let search_array = Array.map (fun i -> Some i) unordered_basis in + Array.map (fun x -> find x search_array) ordered_basis + ;; + + + let of_long_basis long_basis name ao_extra_cartesian = + let ao_extra_num = List.length long_basis |> AO_number.of_int in + let ao_extra_prim_num = + list_map (fun (_,g,_) -> List.length g.Gto.lc + |> AO_prim_number.of_int ) long_basis + |> Array.of_list + and ao_extra_nucl = + list_map (fun (_,_,n) -> n) long_basis + |> Array.of_list + and ao_extra_power = + list_map (fun (x,_,_) -> x) long_basis + |> Array.of_list + in + let ao_extra_prim_num_max = Array.fold_left (fun s x -> + if AO_prim_number.to_int x > s then AO_prim_number.to_int x else s) 0 + ao_extra_prim_num + |> AO_prim_number.of_int + in + + let gtos = + list_map (fun (_,x,_) -> x) long_basis + in + let create_expo_coef ec = + let coefs = + begin match ec with + | `Coefs -> list_map (fun x-> + list_map (fun (_,coef) -> AO_coef.to_float coef) x.Gto.lc ) gtos + | `Expos -> list_map (fun x-> + list_map (fun (prim,_) -> AO_expo.to_float + prim.GaussianPrimitive.expo) x.Gto.lc ) gtos + end + in + let rec get_n n accu = function + | [] -> List.rev accu + | h::tail -> + let y = + try List.nth h n + with _ -> 0. + in + get_n n (y::accu) tail + in + let rec build accu = function + | n when n=(AO_prim_number.to_int ao_extra_prim_num_max) -> accu + | n -> build ( accu @ (get_n n [] coefs) ) (n+1) + in + build [] 0 + in + + let ao_extra_coef = create_expo_coef `Coefs + |> Array.of_list + |> Array.map AO_coef.of_float + and ao_extra_expo = create_expo_coef `Expos + |> Array.of_list + |> Array.map AO_expo.of_float + in + { ao_extra_basis = name ; + ao_extra_num ; ao_extra_prim_num ; ao_extra_prim_num_max ; ao_extra_nucl ; + ao_extra_power ; ao_extra_coef ; ao_extra_expo ; ao_extra_cartesian ; + ao_extra_normalized = bool_of_string @@ get_default "ao_extra_normalized"; + primitives_normalized_extra = bool_of_string @@ get_default "primitives_normalized_extra"; + } + ;; + + let reorder b = + let order = ordering b in + let f a = Array.init (Array.length a) (fun i -> a.(order.(i))) in + let ao_extra_prim_num_max = AO_prim_number.to_int b.ao_extra_prim_num_max + and ao_extra_num = AO_number.to_int b.ao_extra_num in + let ao_extra_coef = + Array.init ao_extra_prim_num_max (fun i -> + f @@ Array.init ao_extra_num (fun j -> b.ao_extra_coef.(i*ao_extra_num + j) ) + ) |> Array.to_list |> Array.concat + in + let ao_extra_expo = + Array.init ao_extra_prim_num_max (fun i -> + f @@ Array.init ao_extra_num (fun j -> b.ao_extra_expo.(i*ao_extra_num + j) ) + ) |> Array.to_list |> Array.concat + in + { b with + ao_extra_prim_num = f b.ao_extra_prim_num ; + ao_extra_nucl = f b.ao_extra_nucl ; + ao_extra_power = f b.ao_extra_power ; + ao_extra_coef ; + ao_extra_expo ; + } + ;; + + + + let to_rst b = + let print_sym = + let l = List.init (Array.length b.ao_extra_power) ( + fun i -> ( (i+1),b.ao_extra_nucl.(i),b.ao_extra_power.(i) ) ) + in + let rec do_work = function + | [] -> [] + | (i,n,x)::tail -> + (Printf.sprintf " %5d %6d %-8s\n" i (Nucl_number.to_int n) + (Angmom.Xyz.to_string x) + )::(do_work tail) + in do_work l + |> String.concat "" + in + + let short_basis = to_basis b in + Printf.sprintf " +Name of the AO basis :: + + ao_extra_basis = %s + +Cartesian coordinates (6d,10f,...) :: + + ao_extra_cartesian = %s + +Use normalized primitive functions :: + + primitives_normalized_extra = %s + +Use normalized basis functions :: + + ao_extra_normalized = %s + +Basis set (read-only) :: + +%s + + +======= ========= =========== + Basis Nucleus Symmetries +======= ========= =========== +%s +======= ========= =========== + +" (AO_basis_name.to_string b.ao_extra_basis) + (string_of_bool b.ao_extra_cartesian) + (string_of_bool b.primitives_normalized_extra) + (string_of_bool b.ao_extra_normalized) + (Basis.to_string short_basis + |> String_ext.split ~on:'\n' + |> list_map (fun x-> " "^x) + |> String.concat "\n" + ) print_sym + + |> Rst_string.of_string + ;; + + let read_rst s = + let s = Rst_string.to_string s + |> String_ext.split ~on:'\n' + in + let rec extract_basis = function + | [] -> failwith "Error in basis set" + | line :: tail -> + let line = String.trim line in + if line = "Basis set (read-only) ::" then + String.concat "\n" tail + else + extract_basis tail + in + extract_basis s + ;; + + let to_string b = + Printf.sprintf " +ao_extra_basis = %s +ao_extra_num = %s +ao_extra_prim_num = %s +ao_extra_prim_num_max = %s +ao_extra_nucl = %s +ao_extra_power = %s +ao_extra_coef = %s +ao_extra_expo = %s +ao_extra_cartesian = %s +ao_extra_normalized = %s +primitives_normalized_extra = %s +md5 = %s +" + (AO_basis_name.to_string b.ao_extra_basis) + (AO_number.to_string b.ao_extra_num) + (b.ao_extra_prim_num |> Array.to_list |> list_map + (AO_prim_number.to_string) |> String.concat ", " ) + (AO_prim_number.to_string b.ao_extra_prim_num_max) + (b.ao_extra_nucl |> Array.to_list |> list_map Nucl_number.to_string |> + String.concat ", ") + (b.ao_extra_power |> Array.to_list |> list_map (fun x-> + "("^(Angmom.Xyz.to_string x)^")" )|> String.concat ", ") + (b.ao_extra_coef |> Array.to_list |> list_map AO_coef.to_string + |> String.concat ", ") + (b.ao_extra_expo |> Array.to_list |> list_map AO_expo.to_string + |> String.concat ", ") + (b.ao_extra_cartesian |> string_of_bool) + (b.ao_extra_normalized |> string_of_bool) + (b.primitives_normalized_extra |> string_of_bool) + (to_md5 b |> MD5.to_string ) + + ;; +end + diff --git a/plugins/local/ao_extra_basis/density_extra.irp.f b/plugins/local/ao_extra_basis/density_extra.irp.f new file mode 100644 index 00000000..5d6492e3 --- /dev/null +++ b/plugins/local/ao_extra_basis/density_extra.irp.f @@ -0,0 +1,87 @@ +BEGIN_PROVIDER [ double precision, effective_ao_extra_dm, (ao_extra_num, ao_extra_num)] + implicit none + BEGIN_DOC + ! effective density matrix : rho_pq x N_p x N_q x E_pq x (pi/gamma_pq)^3/2 + ! + ! where rho_pq is the usual density matrix + ! + ! N_p and N_q are the normalization factors associated with the two Gaussians + ! + ! E_pq is the prefactor resulting from the Gaussian product + ! + ! gamma_pq = gamma_p + gamm_q + END_DOC + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & + * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) + enddo + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] +&BEGIN_PROVIDER [ double precision, inv_gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] +&BEGIN_PROVIDER [ double precision, inv_pi_gamma_pq_3_2_ao_extra, (ao_extra_num,ao_extra_num)] +&BEGIN_PROVIDER [ double precision, sqrt_gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] + implicit none + BEGIN_DOC + ! gamma_pq_ao_extra = gamma_p + gamma_q + ! + ! inv_gamma_pq_ao_extra = 1/(gamma_p + gamma_q) + ! + ! sqrt_gamma_pq_ao_extra = sqrt(gamma_p + gamma_q) + ! + ! WARNING :: VALID ONLY IN THE CASE OF A PURELY 1S BASIS + END_DOC + include 'constants.include.F' + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + gamma_pq_ao_extra(j,i) = ao_extra_expo(j,1) + ao_extra_expo(i,1) + inv_gamma_pq_ao_extra(j,i) = 1.d0/gamma_pq_ao_extra(j,i) + sqrt_gamma_pq_ao_extra(j,i) = dsqrt(gamma_pq_ao_extra(j,i)) + inv_pi_gamma_pq_3_2_ao_extra(j,i) = (pi * inv_gamma_pq_ao_extra(j,i))**(1.5d0) + enddo + enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, E_pq_ao_extra, (ao_extra_num,ao_extra_num)] + implicit none + BEGIN_DOC + ! E_pq_ao_extra = exp(-alpha_p alpha_q/gamma_pq (Q_p - Q_q)^2) + END_DOC + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + E_pq_ao_extra(j,i) = dexp(-ao_extra_center_1s_dist(j,i)**2 * ao_extra_expo(j,1)*ao_extra_expo(i,1)*inv_gamma_pq_ao_extra(j,i)) + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_center_1s, (3,ao_extra_num)] + implicit none + BEGIN_DOC + ! Original position of each extra AO + END_DOC + integer :: i,i_nucl + do i = 1, ao_extra_num + i_nucl= ao_extra_nucl(i) + ao_extra_center_1s(1:3,i) = extra_nucl_coord(i_nucl,1:3) + enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_center_1s_dist, (ao_extra_num,ao_extra_num)] + implicit none + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + ao_extra_center_1s_dist(j,i) = (ao_extra_center_1s(1,j) - ao_extra_center_1s(1,i))**2 & + + (ao_extra_center_1s(2,j) - ao_extra_center_1s(2,i))**2 & + + (ao_extra_center_1s(3,j) - ao_extra_center_1s(3,i))**2 + ao_extra_center_1s_dist(j,i)=dsqrt(ao_extra_center_1s_dist(j,i)) + enddo + enddo +END_PROVIDER diff --git a/plugins/local/extra_basis_int/coul_1s.irp.f b/plugins/local/extra_basis_int/coul_1s.irp.f new file mode 100644 index 00000000..b6148293 --- /dev/null +++ b/plugins/local/extra_basis_int/coul_1s.irp.f @@ -0,0 +1,23 @@ +double precision function coul_full_pq_r_1s(p,q,R,R_p,R_q) + implicit none + BEGIN_DOC + ! coul_full_pq_r_1s(p,q,r) = \int d^3r phi_p(r) phi_q(r) 1/(r-R) + ! + ! where phi_q and phi_p are centered in R_q and R_p. + ! + ! WARNING :: works only for purely 1s extra basis !! + END_DOC + double precision, intent(in) :: R(3),R_p(3),R_q(3) + integer, intent(in) :: p,q + double precision :: coef,dist,P_pq(3),coefaos + coefaos= ao_extra_coef_normalized(p,1) * ao_extra_coef_normalized(q,1) + coef = inv_pi_gamma_pq_3_2_ao_extra(p,q) * E_pq_ao_extra(p,q) + P_pq = ao_extra_expo(p,1) * R_p + ao_extra_expo(q,1) * R_q + P_pq = P_pq * inv_gamma_pq_ao_extra(q,p) + dist = (P_pq(1)-R(1)) * (P_pq(1)-R(1)) + dist+= (P_pq(2)-R(2)) * (P_pq(2)-R(2)) + dist+= (P_pq(3)-R(3)) * (P_pq(3)-R(3)) + dist = dsqrt(dist) + coul_full_pq_r_1s = coefaos * coef * derf(sqrt_gamma_pq_ao_extra(q,p) * dist)/dist + +end diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 6423cedd..4495c8ff 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -9,7 +9,8 @@ program extra_basis_int ! call routine_pot_ne_extra ! call routine_test_pot_ne_mixed ! call routine_pot_ne - call routine_test_pot_ne_extra_mixed +! call routine_test_pot_ne_extra_mixed + call routine_test_coul_1s end @@ -122,3 +123,27 @@ subroutine routine_test_pot_ne_extra_mixed enddo end + +subroutine routine_test_coul_1s + implicit none + integer :: i,j + double precision :: r(3) ,mu_in,NAI_pol_mult_erf_ao_extra + double precision :: ref,new, accu,coul_full_pq_r_1s,v_nucl_extra_ao + r(1) = 0.d0 + r(2) = 0.5d0 + r(3) = -1.5d0 + r=nucl_coord(1,1:3) + mu_in = 1.d+10 + accu = 0.d0 + do i = 1, ao_extra_num + do j = 1, ao_extra_num +! do i = 1, 1 +! do j = 1, 1 + ref = NAI_pol_mult_erf_ao_extra(i, j, mu_in, r) + new = coul_full_pq_r_1s(i,j,r,ao_extra_center_1s(1,i),ao_extra_center_1s(1,j)) +! new = v_nucl_extra_ao(i,j) + accu += dabs(new-ref) + enddo + enddo + print*,'accu = ',accu +end diff --git a/plugins/local/extra_nuclei/nuclei.irp.f b/plugins/local/extra_nuclei/nuclei.irp.f index 386d15b8..d8ea57f2 100644 --- a/plugins/local/extra_nuclei/nuclei.irp.f +++ b/plugins/local/extra_nuclei/nuclei.irp.f @@ -120,3 +120,19 @@ extra_center_of_mass(:) = extra_center_of_mass(:)*s END_PROVIDER + +BEGIN_PROVIDER [ double precision, extra_nucl_dist, (extra_nucl_num,extra_nucl_num)] + implicit none + integer :: i,j + double precision :: x,y,z + do i = 1, extra_nucl_num + do j = 1, extra_nucl_num + x = extra_nucl_coord(i,1)-extra_nucl_coord(j,1) + y = extra_nucl_coord(i,2)-extra_nucl_coord(j,2) + z = extra_nucl_coord(i,3)-extra_nucl_coord(j,3) + extra_nucl_dist(j,i) = x*x+y*y+z*z + extra_nucl_dist(j,i) = dsqrt(extra_nucl_dist(j,i)) + enddo + enddo + +END_PROVIDER diff --git a/src/ao_basis/cgtos.irp.f b/src/ao_basis/cgtos.irp.f index 914ffb34..abf46dcb 100644 --- a/src/ao_basis/cgtos.irp.f +++ b/src/ao_basis/cgtos.irp.f @@ -35,3 +35,167 @@ ! call write_time(6) END_PROVIDER + +! --- + + BEGIN_PROVIDER [complex*16, ao_expo_cgtos_ord_transp, (ao_prim_num_max, ao_num)] +&BEGIN_PROVIDER [double precision, ao_expo_pw_ord_transp, (4, ao_prim_num_max, ao_num)] +&BEGIN_PROVIDER [double precision, ao_expo_phase_ord_transp, (4, ao_prim_num_max, ao_num)] + + implicit none + + integer :: i, j, m + + do j = 1, ao_num + do i = 1, ao_prim_num_max + + ao_expo_cgtos_ord_transp(i,j) = ao_expo_cgtos_ord(j,i) + + do m = 1, 4 + ao_expo_pw_ord_transp(m,i,j) = ao_expo_pw_ord(m,j,i) + ao_expo_phase_ord_transp(m,i,j) = ao_expo_phase_ord(m,j,i) + enddo + enddo + enddo + +END_PROVIDER + +! --- + + BEGIN_PROVIDER [double precision, ao_coef_norm_cgtos_ord, (ao_num, ao_prim_num_max)] +&BEGIN_PROVIDER [complex*16 , ao_expo_cgtos_ord, (ao_num, ao_prim_num_max)] +&BEGIN_PROVIDER [double precision, ao_expo_pw_ord, (4, ao_num, ao_prim_num_max)] +&BEGIN_PROVIDER [double precision, ao_expo_phase_ord, (4, ao_num, ao_prim_num_max)] + + implicit none + + integer :: i, j, m + integer :: iorder(ao_prim_num_max) + double precision :: d(ao_prim_num_max,11) + + d = 0.d0 + + do i = 1, ao_num + + do j = 1, ao_prim_num(i) + iorder(j) = j + d(j,1) = ao_expo(i,j) + d(j,2) = ao_coef_norm_cgtos(i,j) + d(j,3) = ao_expo_im(i,j) + + do m = 1, 3 + d(j,3+m) = ao_expo_pw(m,i,j) + enddo + d(j,7) = d(j,4) * d(j,4) + d(j,5) * d(j,5) + d(j,6) * d(j,6) + + do m = 1, 3 + d(j,7+m) = ao_expo_phase(m,i,j) + enddo + d(j,11) = d(j,8) + d(j,9) + d(j,10) + enddo + + call dsort(d(1,1), iorder, ao_prim_num(i)) + do j = 2, 11 + call dset_order(d(1,j), iorder, ao_prim_num(i)) + enddo + + do j = 1, ao_prim_num(i) + ao_expo_cgtos_ord (i,j) = d(j,1) + (0.d0, 1.d0) * d(j,3) + ao_coef_norm_cgtos_ord(i,j) = d(j,2) + + do m = 1, 4 + ao_expo_pw_ord(m,i,j) = d(j,3+m) + ao_expo_phase_ord(m,i,j) = d(j,7+m) + enddo + enddo + enddo + +END_PROVIDER + + + +! --- + +BEGIN_PROVIDER [double precision, ao_coef_cgtos_norm_ord_transp, (ao_prim_num_max, ao_num)] + + implicit none + + integer :: i, j + + do j = 1, ao_num + do i = 1, ao_prim_num_max + ao_coef_cgtos_norm_ord_transp(i,j) = ao_coef_norm_cgtos_ord(j,i) + enddo + enddo + +END_PROVIDER + + +! --- + +BEGIN_PROVIDER [double precision, ao_coef_norm_cgtos, (ao_num, ao_prim_num_max)] + + implicit none + + integer :: i, j, ii, m, powA(3), nz + double precision :: norm + double precision :: kA2, phiA + complex*16 :: expo, expo_inv, C_Ae(3), C_Ap(3) + complex*16 :: overlap_x, overlap_y, overlap_z + complex*16 :: integ1, integ2, C1, C2 + + nz = 100 + + ao_coef_norm_cgtos = 0.d0 + + do i = 1, ao_num + + ii = ao_nucl(i) + powA(1) = ao_power(i,1) + powA(2) = ao_power(i,2) + powA(3) = ao_power(i,3) + + if(primitives_normalized) then + + ! Normalization of the primitives + do j = 1, ao_prim_num(i) + + expo = ao_expo(i,j) + (0.d0, 1.d0) * ao_expo_im(i,j) + expo_inv = (1.d0, 0.d0) / expo + do m = 1, 3 + C_Ap(m) = nucl_coord(ii,m) + C_Ae(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo_inv * ao_expo_pw(m,i,j) + enddo + phiA = ao_expo_phase(1,i,j) + ao_expo_phase(2,i,j) + ao_expo_phase(3,i,j) + KA2 = ao_expo_pw(1,i,j) * ao_expo_pw(1,i,j) & + + ao_expo_pw(2,i,j) * ao_expo_pw(2,i,j) & + + ao_expo_pw(3,i,j) * ao_expo_pw(3,i,j) + + C1 = zexp(-(0.d0, 2.d0) * phiA - 0.5d0 * expo_inv * KA2) + C2 = zexp(-(0.5d0, 0.d0) * real(expo_inv) * KA2) + + call overlap_cgaussian_xyz(C_Ae, C_Ae, expo, expo, powA, powA, & + C_Ap, C_Ap, overlap_x, overlap_y, overlap_z, integ1, nz) + + call overlap_cgaussian_xyz(conjg(C_Ae), C_Ae, conjg(expo), expo, powA, powA, & + conjg(C_Ap), C_Ap, overlap_x, overlap_y, overlap_z, integ2, nz) + + norm = 2.d0 * real(C1 * integ1 + C2 * integ2) + + !ao_coef_norm_cgtos(i,j) = 1.d0 / dsqrt(norm) + ao_coef_norm_cgtos(i,j) = ao_coef(i,j) / dsqrt(norm) + enddo + + else + + do j = 1, ao_prim_num(i) + ao_coef_norm_cgtos(i,j) = ao_coef(i,j) + enddo + + endif ! primitives_normalized + + enddo + +END_PROVIDER + + diff --git a/src/ao_one_e_ints/aos_cgtos.irp.f b/src/ao_one_e_ints/aos_cgtos.irp.f index 7b2dde7f..83c782b7 100644 --- a/src/ao_one_e_ints/aos_cgtos.irp.f +++ b/src/ao_one_e_ints/aos_cgtos.irp.f @@ -1,163 +1,3 @@ - -! --- - -BEGIN_PROVIDER [double precision, ao_coef_cgtos_norm_ord_transp, (ao_prim_num_max, ao_num)] - - implicit none - - integer :: i, j - - do j = 1, ao_num - do i = 1, ao_prim_num_max - ao_coef_cgtos_norm_ord_transp(i,j) = ao_coef_norm_cgtos_ord(j,i) - enddo - enddo - -END_PROVIDER - -! --- - - BEGIN_PROVIDER [complex*16, ao_expo_cgtos_ord_transp, (ao_prim_num_max, ao_num)] -&BEGIN_PROVIDER [double precision, ao_expo_pw_ord_transp, (4, ao_prim_num_max, ao_num)] -&BEGIN_PROVIDER [double precision, ao_expo_phase_ord_transp, (4, ao_prim_num_max, ao_num)] - - implicit none - - integer :: i, j, m - - do j = 1, ao_num - do i = 1, ao_prim_num_max - - ao_expo_cgtos_ord_transp(i,j) = ao_expo_cgtos_ord(j,i) - - do m = 1, 4 - ao_expo_pw_ord_transp(m,i,j) = ao_expo_pw_ord(m,j,i) - ao_expo_phase_ord_transp(m,i,j) = ao_expo_phase_ord(m,j,i) - enddo - enddo - enddo - -END_PROVIDER - -! --- - -BEGIN_PROVIDER [double precision, ao_coef_norm_cgtos, (ao_num, ao_prim_num_max)] - - implicit none - - integer :: i, j, ii, m, powA(3), nz - double precision :: norm - double precision :: kA2, phiA - complex*16 :: expo, expo_inv, C_Ae(3), C_Ap(3) - complex*16 :: overlap_x, overlap_y, overlap_z - complex*16 :: integ1, integ2, C1, C2 - - nz = 100 - - ao_coef_norm_cgtos = 0.d0 - - do i = 1, ao_num - - ii = ao_nucl(i) - powA(1) = ao_power(i,1) - powA(2) = ao_power(i,2) - powA(3) = ao_power(i,3) - - if(primitives_normalized) then - - ! Normalization of the primitives - do j = 1, ao_prim_num(i) - - expo = ao_expo(i,j) + (0.d0, 1.d0) * ao_expo_im(i,j) - expo_inv = (1.d0, 0.d0) / expo - do m = 1, 3 - C_Ap(m) = nucl_coord(ii,m) - C_Ae(m) = nucl_coord(ii,m) - (0.d0, 0.5d0) * expo_inv * ao_expo_pw(m,i,j) - enddo - phiA = ao_expo_phase(1,i,j) + ao_expo_phase(2,i,j) + ao_expo_phase(3,i,j) - KA2 = ao_expo_pw(1,i,j) * ao_expo_pw(1,i,j) & - + ao_expo_pw(2,i,j) * ao_expo_pw(2,i,j) & - + ao_expo_pw(3,i,j) * ao_expo_pw(3,i,j) - - C1 = zexp(-(0.d0, 2.d0) * phiA - 0.5d0 * expo_inv * KA2) - C2 = zexp(-(0.5d0, 0.d0) * real(expo_inv) * KA2) - - call overlap_cgaussian_xyz(C_Ae, C_Ae, expo, expo, powA, powA, & - C_Ap, C_Ap, overlap_x, overlap_y, overlap_z, integ1, nz) - - call overlap_cgaussian_xyz(conjg(C_Ae), C_Ae, conjg(expo), expo, powA, powA, & - conjg(C_Ap), C_Ap, overlap_x, overlap_y, overlap_z, integ2, nz) - - norm = 2.d0 * real(C1 * integ1 + C2 * integ2) - - !ao_coef_norm_cgtos(i,j) = 1.d0 / dsqrt(norm) - ao_coef_norm_cgtos(i,j) = ao_coef(i,j) / dsqrt(norm) - enddo - - else - - do j = 1, ao_prim_num(i) - ao_coef_norm_cgtos(i,j) = ao_coef(i,j) - enddo - - endif ! primitives_normalized - - enddo - -END_PROVIDER - -! --- - - BEGIN_PROVIDER [double precision, ao_coef_norm_cgtos_ord, (ao_num, ao_prim_num_max)] -&BEGIN_PROVIDER [complex*16 , ao_expo_cgtos_ord, (ao_num, ao_prim_num_max)] -&BEGIN_PROVIDER [double precision, ao_expo_pw_ord, (4, ao_num, ao_prim_num_max)] -&BEGIN_PROVIDER [double precision, ao_expo_phase_ord, (4, ao_num, ao_prim_num_max)] - - implicit none - - integer :: i, j, m - integer :: iorder(ao_prim_num_max) - double precision :: d(ao_prim_num_max,11) - - d = 0.d0 - - do i = 1, ao_num - - do j = 1, ao_prim_num(i) - iorder(j) = j - d(j,1) = ao_expo(i,j) - d(j,2) = ao_coef_norm_cgtos(i,j) - d(j,3) = ao_expo_im(i,j) - - do m = 1, 3 - d(j,3+m) = ao_expo_pw(m,i,j) - enddo - d(j,7) = d(j,4) * d(j,4) + d(j,5) * d(j,5) + d(j,6) * d(j,6) - - do m = 1, 3 - d(j,7+m) = ao_expo_phase(m,i,j) - enddo - d(j,11) = d(j,8) + d(j,9) + d(j,10) - enddo - - call dsort(d(1,1), iorder, ao_prim_num(i)) - do j = 2, 11 - call dset_order(d(1,j), iorder, ao_prim_num(i)) - enddo - - do j = 1, ao_prim_num(i) - ao_expo_cgtos_ord (i,j) = d(j,1) + (0.d0, 1.d0) * d(j,3) - ao_coef_norm_cgtos_ord(i,j) = d(j,2) - - do m = 1, 4 - ao_expo_pw_ord(m,i,j) = d(j,3+m) - ao_expo_phase_ord(m,i,j) = d(j,7+m) - enddo - enddo - enddo - -END_PROVIDER - ! --- BEGIN_PROVIDER [double precision, ao_overlap_cgtos, (ao_num, ao_num)] @@ -282,23 +122,3 @@ -! --- - -BEGIN_PROVIDER [logical, use_pw] - - implicit none - - logical :: exist - - use_pw = .false. - - call ezfio_has_ao_basis_ao_expo_pw(exist) - if(exist) then - PROVIDE ao_expo_pw_ord_transp - if(maxval(dabs(ao_expo_pw_ord_transp(4,:,:))) .gt. 1d-15) use_pw = .true. - endif - -END_PROVIDER - -! --- - From a61f6291da37a1ca01d0a8f8adef584a520ead3a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 17 Dec 2024 10:47:31 +0100 Subject: [PATCH 035/175] Removed dupicate provider --- plugins/local/tc_scf/README.md | 2 + src/ao_extra_basis/EZFIO.cfg | 104 ++++++ src/ao_extra_basis/LiH.xyz | 4 + src/ao_extra_basis/NEED | 3 + src/ao_extra_basis/README.rst | 15 + src/ao_extra_basis/aos.irp.f | 325 ++++++++++++++++++ src/ao_extra_basis/aos_transp.irp.f | 68 ++++ src/ao_extra_basis/density_extra.irp.f | 87 +++++ src/ao_extra_basis/dimensions_integrals.irp.f | 19 + src/ao_extra_basis/extra_basis.irp.f | 16 + src/ao_extra_basis/fit_1s_basis.irp.f | 41 +++ src/ao_extra_basis/h2o.xyz | 7 + src/ao_extra_basis/install | 23 ++ src/ao_extra_basis/prov_fit_1s.irp.f | 266 ++++++++++++++ src/ao_extra_basis/qp_add_extra_fit_system | 19 + src/ao_extra_basis/qp_copy_extra_basis | 67 ++++ .../qp_copy_extra_basis_to_usual_basis | 57 +++ src/ao_extra_basis/qp_fit_1s_basis | 12 + src/ao_extra_basis/transform_basis.irp.f | 49 +++ src/ao_extra_basis/uninstall | 20 ++ src/extra_nuclei/EZFIO.cfg | 56 +++ src/extra_nuclei/NEED | 3 + src/extra_nuclei/README.rst | 4 + src/extra_nuclei/extra_nuclei.irp.f | 7 + src/extra_nuclei/nuclei.irp.f | 138 ++++++++ src/mo_one_e_ints/mo_one_e_ints.irp.f | 10 - 26 files changed, 1412 insertions(+), 10 deletions(-) create mode 100644 plugins/local/tc_scf/README.md create mode 100644 src/ao_extra_basis/EZFIO.cfg create mode 100644 src/ao_extra_basis/LiH.xyz create mode 100644 src/ao_extra_basis/NEED create mode 100644 src/ao_extra_basis/README.rst create mode 100644 src/ao_extra_basis/aos.irp.f create mode 100644 src/ao_extra_basis/aos_transp.irp.f create mode 100644 src/ao_extra_basis/density_extra.irp.f create mode 100644 src/ao_extra_basis/dimensions_integrals.irp.f create mode 100644 src/ao_extra_basis/extra_basis.irp.f create mode 100644 src/ao_extra_basis/fit_1s_basis.irp.f create mode 100644 src/ao_extra_basis/h2o.xyz create mode 100755 src/ao_extra_basis/install create mode 100644 src/ao_extra_basis/prov_fit_1s.irp.f create mode 100755 src/ao_extra_basis/qp_add_extra_fit_system create mode 100755 src/ao_extra_basis/qp_copy_extra_basis create mode 100755 src/ao_extra_basis/qp_copy_extra_basis_to_usual_basis create mode 100755 src/ao_extra_basis/qp_fit_1s_basis create mode 100644 src/ao_extra_basis/transform_basis.irp.f create mode 100755 src/ao_extra_basis/uninstall create mode 100644 src/extra_nuclei/EZFIO.cfg create mode 100644 src/extra_nuclei/NEED create mode 100644 src/extra_nuclei/README.rst create mode 100644 src/extra_nuclei/extra_nuclei.irp.f create mode 100644 src/extra_nuclei/nuclei.irp.f diff --git a/plugins/local/tc_scf/README.md b/plugins/local/tc_scf/README.md new file mode 100644 index 00000000..45f5c60f --- /dev/null +++ b/plugins/local/tc_scf/README.md @@ -0,0 +1,2 @@ +Transcorrelated SCF +=================== diff --git a/src/ao_extra_basis/EZFIO.cfg b/src/ao_extra_basis/EZFIO.cfg new file mode 100644 index 00000000..8841c194 --- /dev/null +++ b/src/ao_extra_basis/EZFIO.cfg @@ -0,0 +1,104 @@ +[ao_extra_basis] +type: character*(256) +doc: Name of the |ao_extra| basis set +interface: ezfio + +[ao_extra_only_1s] +type: logical +doc: If |true|, you know that the additional AO basis is built only with 1s functions +interface: ezfio, provider +default: true + +[ao_extra_num] +type: integer +doc: Number of |ao_extras| +interface: ezfio, provider + +[ao_extra_prim_num] +type: integer +doc: Number of primitives per |ao_extra| +size: (ao_extra_basis.ao_extra_num) +interface: ezfio, provider + +[ao_extra_prim_num_max] +type: integer +doc: Maximum number of primitives +default: =maxval(ao_extra_basis.ao_extra_prim_num) +interface: ezfio + +[ao_extra_nucl] +type: integer +doc: Index of the nucleus on which the |ao_extra| is centered +size: (ao_extra_basis.ao_extra_num) +interface: ezfio, provider + +[ao_extra_power] +type: integer +doc: Powers of x, y and z for each |ao_extra| +size: (ao_extra_basis.ao_extra_num,3) +interface: ezfio, provider + +[ao_extra_coef] +type: double precision +doc: Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** ao_extras. +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_expo] +type: double precision +doc: Exponents for each primitive of each |ao_extra| +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_md5] +type: character*(32) +doc: MD5 key, specific of the |ao_extra| basis +interface: ezfio, provider + +[ao_extra_cartesian] +type: logical +doc: If |true|, use |ao_extras| in Cartesian coordinates (6d,10f,...) +interface: ezfio, provider +default: false + +[ao_extra_normalized] +type: logical +doc: Use normalized basis functions +interface: ezfio, provider +default: true + +[primitives_normalized_extra] +type: logical +doc: Use normalized primitive functions +interface: ezfio, provider +default: true + +[ao_extra_expo_im] +type: double precision +doc: imag part for Exponents for each primitive of each cGTOs |ao_extra| +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_expo_pw] +type: double precision +doc: plane wave part for each primitive GTOs |ao_extra| +size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_expo_phase] +type: double precision +doc: phase shift for each primitive GTOs |ao_extra| +size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) +interface: ezfio, provider + +[ao_extra_one_e_dm] +type: double precision +doc: reduced density matrix on the ao extra basis +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num) +interface: ezfio, provider + +[ao_extra_center] +type: double precision +doc: shift with which the atoms are shifted to mimick p functions +interface: ezfio + diff --git a/src/ao_extra_basis/LiH.xyz b/src/ao_extra_basis/LiH.xyz new file mode 100644 index 00000000..03431803 --- /dev/null +++ b/src/ao_extra_basis/LiH.xyz @@ -0,0 +1,4 @@ +2 + +H 0. 0. 0. +Li 0. 0. 1.0 diff --git a/src/ao_extra_basis/NEED b/src/ao_extra_basis/NEED new file mode 100644 index 00000000..c4e8c3cf --- /dev/null +++ b/src/ao_extra_basis/NEED @@ -0,0 +1,3 @@ +extra_nuclei +basis +ao_basis diff --git a/src/ao_extra_basis/README.rst b/src/ao_extra_basis/README.rst new file mode 100644 index 00000000..f60d71c0 --- /dev/null +++ b/src/ao_extra_basis/README.rst @@ -0,0 +1,15 @@ +=========== +extra_basis +=========== + +Plugin to handle an extra basis, which is attached to the extra_nuclei. +It is essentially a duplication of all important quantities (coefficients, exponents and so on) of the usual |AO| basis. + +An interesting feature is the possibility to fit any basis made at most with "p" functions onto a purely "s" basis. +This is done with the various scripts here: + + - qp_fit_1s_basis : script that creates an |EZFIO| folder corresponding to an .xyz file and a basis fitted with only "s" functions + - qp_add_extra_fit_system : script that takes as input an |EZFIO| folder and an .xyz file and add an extra_basis and extra_nuclei with a 1s fitted basis + +Ex: +qp_add_extra_fit_system LiH.ezfio/ h2o.xyz # takes the EZFIO folder "LiH.ezfio" and creates all necessary additional basis and nuclei based on h2o.xyz, but only with 1s functions. diff --git a/src/ao_extra_basis/aos.irp.f b/src/ao_extra_basis/aos.irp.f new file mode 100644 index 00000000..56d6fb04 --- /dev/null +++ b/src/ao_extra_basis/aos.irp.f @@ -0,0 +1,325 @@ +BEGIN_PROVIDER [ integer, ao_extra_prim_num_max ] + implicit none + BEGIN_DOC + ! Max number of primitives. + END_DOC + ao_extra_prim_num_max = maxval(ao_extra_prim_num) +END_PROVIDER + +BEGIN_PROVIDER [ integer, ao_extra_shell, (ao_extra_num) ] + implicit none + BEGIN_DOC + ! Index of the shell to which the ao_extra corresponds + END_DOC + integer :: i, j, k, n + k=0 + do i=1,shell_num + n = shell_ang_mom(i)+1 + do j=1,(n*(n+1))/2 + k = k+1 + ao_extra_shell(k) = i + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ integer, ao_extra_first_of_shell, (shell_num) ] + implicit none + BEGIN_DOC + ! Index of the shell to which the ao_extra corresponds + END_DOC + integer :: i, j, k, n + k=1 + do i=1,shell_num + ao_extra_first_of_shell(i) = k + n = shell_ang_mom(i)+1 + k = k+(n*(n+1))/2 + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized, (ao_extra_num,ao_extra_prim_num_max) ] +&BEGIN_PROVIDER [ double precision, ao_extra_coef_normalization_factor, (ao_extra_num) ] + implicit none + BEGIN_DOC + ! Coefficients including the |ao_extra| normalization + END_DOC + double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c + integer :: l, powA(3), nz + integer :: i,j,k + nz=100 + C_A(1) = 0.d0 + C_A(2) = 0.d0 + C_A(3) = 0.d0 + ao_extra_coef_normalized = 0.d0 + + do i=1,ao_extra_num + +! powA(1) = ao_extra_power(i,1) + ao_extra_power(i,2) + ao_extra_power(i,3) +! powA(2) = 0 +! powA(3) = 0 + powA(1) = ao_extra_power(i,1) + powA(2) = ao_extra_power(i,2) + powA(3) = ao_extra_power(i,3) + + ! Normalization of the primitives + if (primitives_normalized_extra) then + do j=1,ao_extra_prim_num(i) + call overlap_gaussian_xyz(C_A,C_A,ao_extra_expo(i,j),ao_extra_expo(i,j), & + powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) + ao_extra_coef_normalized(i,j) = ao_extra_coef(i,j)/dsqrt(norm) + enddo + else + do j=1,ao_extra_prim_num(i) + ao_extra_coef_normalized(i,j) = ao_extra_coef(i,j) + enddo + endif + + ! Normalization of the contracted basis functions + if (ao_extra_normalized) then + norm = 0.d0 + do j=1,ao_extra_prim_num(i) + do k=1,ao_extra_prim_num(i) + call overlap_gaussian_xyz(C_A,C_A,ao_extra_expo(i,j),ao_extra_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) + norm = norm+c*ao_extra_coef_normalized(i,j)*ao_extra_coef_normalized(i,k) + enddo + enddo + ao_extra_coef_normalization_factor(i) = 1.d0/dsqrt(norm) + else + ao_extra_coef_normalization_factor(i) = 1.d0 + endif + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered, (ao_extra_num,ao_extra_prim_num_max) ] +&BEGIN_PROVIDER [ double precision, ao_extra_expo_ordered, (ao_extra_num,ao_extra_prim_num_max) ] + implicit none + BEGIN_DOC + ! Sorted primitives to accelerate 4 index |MO| transformation + END_DOC + + integer :: iorder(ao_extra_prim_num_max) + double precision :: d(ao_extra_prim_num_max,2) + integer :: i,j + do i=1,ao_extra_num + do j=1,ao_extra_prim_num(i) + iorder(j) = j + d(j,1) = ao_extra_expo(i,j) + d(j,2) = ao_extra_coef_normalized(i,j) + enddo + call dsort(d(1,1),iorder,ao_extra_prim_num(i)) + call dset_order(d(1,2),iorder,ao_extra_prim_num(i)) + do j=1,ao_extra_prim_num(i) + ao_extra_expo_ordered(i,j) = d(j,1) + ao_extra_coef_normalized_ordered(i,j) = d(j,2) + enddo + enddo +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered_transp, (ao_extra_prim_num_max,ao_extra_num) ] + implicit none + BEGIN_DOC + ! Transposed :c:data:`ao_extra_coef_normalized_ordered` + END_DOC + integer :: i,j + do j=1, ao_extra_num + do i=1, ao_extra_prim_num_max + ao_extra_coef_normalized_ordered_transp(i,j) = ao_extra_coef_normalized_ordered(j,i) + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_expo_ordered_transp, (ao_extra_prim_num_max,ao_extra_num) ] + implicit none + BEGIN_DOC + ! Transposed :c:data:`ao_extra_expo_ordered` + END_DOC + integer :: i,j + do j=1, ao_extra_num + do i=1, ao_extra_prim_num_max + ao_extra_expo_ordered_transp(i,j) = ao_extra_expo_ordered(j,i) + enddo + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ integer, ao_extra_l, (ao_extra_num) ] +&BEGIN_PROVIDER [ integer, ao_extra_l_max ] +&BEGIN_PROVIDER [ character*(128), ao_extra_l_char, (ao_extra_num) ] + implicit none + BEGIN_DOC +! :math:`l` value of the |ao_extra|: :math`a+b+c` in :math:`x^a y^b z^c` + END_DOC + integer :: i + do i=1,ao_extra_num + ao_extra_l(i) = ao_extra_power(i,1) + ao_extra_power(i,2) + ao_extra_power(i,3) + ao_extra_l_char(i) = l_to_character(ao_extra_l(i)) + enddo + ao_extra_l_max = maxval(ao_extra_l) +END_PROVIDER + +integer function ao_extra_power_index(nx,ny,nz) + implicit none + integer, intent(in) :: nx, ny, nz + BEGIN_DOC + ! Unique index given to a triplet of powers: + ! + ! :math:`\frac{1}{2} (l-n_x) (l-n_x+1) + n_z + 1` + END_DOC + integer :: l + l = nx + ny + nz + ao_extra_power_index = ((l-nx)*(l-nx+1))/2 + nz + 1 +end + + + BEGIN_PROVIDER [ integer, Nucl_N_ao_extras, (extra_nucl_num)] +&BEGIN_PROVIDER [ integer, N_ao_extras_max ] + implicit none + BEGIN_DOC + ! Number of |ao_extras| per atom + END_DOC + integer :: i + Nucl_N_ao_extras = 0 + do i = 1, ao_extra_num + Nucl_N_ao_extras(ao_extra_nucl(i)) +=1 + enddo + N_ao_extras_max = maxval(Nucl_N_ao_extras) +END_PROVIDER + + BEGIN_PROVIDER [ integer, Nucl_ao_extras, (extra_nucl_num,N_ao_extras_max)] + implicit none + BEGIN_DOC + ! List of |ao_extras| centered on each atom + END_DOC + integer :: i + integer, allocatable :: nucl_tmp(:) + allocate(nucl_tmp(nucl_num)) + nucl_tmp = 0 + Nucl_ao_extras = 0 + do i = 1, ao_extra_num + nucl_tmp(ao_extra_nucl(i))+=1 + Nucl_ao_extras(ao_extra_nucl(i),nucl_tmp(ao_extra_nucl(i))) = i + enddo + deallocate(nucl_tmp) +END_PROVIDER + + + BEGIN_PROVIDER [ integer, Nucl_list_shell_ao_extras, (extra_nucl_num,N_ao_extras_max)] +&BEGIN_PROVIDER [ integer, Nucl_num_shell_ao_extras, (nucl_num)] + implicit none + integer :: i,j,k + BEGIN_DOC + ! Index of the shell type |ao_extras| and of the corresponding |ao_extras| + ! By convention, for p,d,f and g |ao_extras|, we take the index + ! of the |ao_extra| with the the corresponding power in the x axis + END_DOC + do i = 1, extra_nucl_num + Nucl_num_shell_ao_extras(i) = 0 + do j = 1, Nucl_N_ao_extras(i) + if (ao_extra_power(Nucl_ao_extras(i,j),1) == ao_extra_l(Nucl_ao_extras(i,j))) then + Nucl_num_shell_ao_extras(i)+=1 + Nucl_list_shell_ao_extras(i,Nucl_num_shell_ao_extras(i))=Nucl_ao_extras(i,j) + endif + enddo + enddo + +END_PROVIDER + + +BEGIN_PROVIDER [ character*(4), ao_extra_l_char_space, (ao_extra_num) ] + implicit none + BEGIN_DOC +! Converts an l value to a string + END_DOC + integer :: i + character*(4) :: give_ao_extra_character_space + do i=1,ao_extra_num + + if(ao_extra_l(i)==0)then + ! S type ao_extra + give_ao_extra_character_space = 'S ' + elseif(ao_extra_l(i) == 1)then + ! P type ao_extra + if(ao_extra_power(i,1)==1)then + give_ao_extra_character_space = 'X ' + elseif(ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'Y ' + else + give_ao_extra_character_space = 'Z ' + endif + elseif(ao_extra_l(i) == 2)then + ! D type ao_extra + if(ao_extra_power(i,1)==2)then + give_ao_extra_character_space = 'XX ' + elseif(ao_extra_power(i,2) == 2)then + give_ao_extra_character_space = 'YY ' + elseif(ao_extra_power(i,3) == 2)then + give_ao_extra_character_space = 'ZZ ' + elseif(ao_extra_power(i,1) == 1 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'XY ' + elseif(ao_extra_power(i,1) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XZ ' + else + give_ao_extra_character_space = 'YZ ' + endif + elseif(ao_extra_l(i) == 3)then + ! F type ao_extra + if(ao_extra_power(i,1)==3)then + give_ao_extra_character_space = 'XXX ' + elseif(ao_extra_power(i,2) == 3)then + give_ao_extra_character_space = 'YYY ' + elseif(ao_extra_power(i,3) == 3)then + give_ao_extra_character_space = 'ZZZ ' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'XXY ' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XXZ ' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'YYX ' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'YYZ ' + elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'ZZX ' + elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'ZZY ' + elseif(ao_extra_power(i,3) == 1 .and. ao_extra_power(i,2) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XYZ ' + endif + elseif(ao_extra_l(i) == 4)then + ! G type ao_extra + if(ao_extra_power(i,1)==4)then + give_ao_extra_character_space = 'XXXX' + elseif(ao_extra_power(i,2) == 4)then + give_ao_extra_character_space = 'YYYY' + elseif(ao_extra_power(i,3) == 4)then + give_ao_extra_character_space = 'ZZZZ' + elseif(ao_extra_power(i,1) == 3 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'XXXY' + elseif(ao_extra_power(i,1) == 3 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XXXZ' + elseif(ao_extra_power(i,2) == 3 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'YYYX' + elseif(ao_extra_power(i,2) == 3 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'YYYZ' + elseif(ao_extra_power(i,3) == 3 .and. ao_extra_power(i,1) == 1)then + give_ao_extra_character_space = 'ZZZX' + elseif(ao_extra_power(i,3) == 3 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'ZZZY' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 2)then + give_ao_extra_character_space = 'XXYY' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,3) == 2)then + give_ao_extra_character_space = 'YYZZ' + elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'XXYZ' + elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,1) == 1 .and. ao_extra_power(i,3) == 1)then + give_ao_extra_character_space = 'YYXZ' + elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,1) == 1 .and. ao_extra_power(i,2) == 1)then + give_ao_extra_character_space = 'ZZXY' + endif + endif + ao_extra_l_char_space(i) = give_ao_extra_character_space + enddo +END_PROVIDER diff --git a/src/ao_extra_basis/aos_transp.irp.f b/src/ao_extra_basis/aos_transp.irp.f new file mode 100644 index 00000000..ed34835b --- /dev/null +++ b/src/ao_extra_basis/aos_transp.irp.f @@ -0,0 +1,68 @@ + +! --- + +BEGIN_PROVIDER [ integer, Nucl_ao_extras_transposed, (N_ao_extras_max,nucl_num)] + + BEGIN_DOC + ! List of ao_extras attached on each atom + END_DOC + + implicit none + integer :: i + integer, allocatable :: nucl_tmp(:) + + allocate(nucl_tmp(nucl_num)) + nucl_tmp = 0 + do i = 1, ao_extra_num + nucl_tmp(ao_extra_nucl(i)) += 1 + Nucl_ao_extras_transposed(nucl_tmp(ao_extra_nucl(i)),ao_extra_nucl(i)) = i + enddo + deallocate(nucl_tmp) + +END_PROVIDER + +! --- + +BEGIN_PROVIDER [double precision, ao_extra_expo_ordered_transp_per_nucl, (ao_extra_prim_num_max,N_ao_extras_max,nucl_num) ] + implicit none + integer :: i,j,k,l + do i = 1, nucl_num + do j = 1,Nucl_N_ao_extras(i) + k = Nucl_ao_extras_transposed(j,i) + do l = 1, ao_extra_prim_num(k) + ao_extra_expo_ordered_transp_per_nucl(l,j,i) = ao_extra_expo_ordered_transp(l,k) + enddo + enddo + enddo + +END_PROVIDER + + +BEGIN_PROVIDER [ integer, ao_extra_power_ordered_transp_per_nucl, (3,N_ao_extras_max,nucl_num) ] + implicit none + integer :: i,j,k,l + do i = 1, nucl_num + do j = 1,Nucl_N_ao_extras(i) + k = Nucl_ao_extras_transposed(j,i) + do l = 1, 3 + ao_extra_power_ordered_transp_per_nucl(l,j,i) = ao_extra_power(k,l) + enddo + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered_transp_per_nucl, (ao_extra_prim_num_max,N_ao_extras_max,nucl_num) ] + implicit none + integer :: i,j,k,l + do i = 1, nucl_num + do j = 1,Nucl_N_ao_extras(i) + k = Nucl_ao_extras_transposed(j,i) + do l = 1, ao_extra_prim_num(k) + ao_extra_coef_normalized_ordered_transp_per_nucl(l,j,i) = ao_extra_coef_normalized_ordered_transp(l,k) + enddo + enddo + enddo + +END_PROVIDER + diff --git a/src/ao_extra_basis/density_extra.irp.f b/src/ao_extra_basis/density_extra.irp.f new file mode 100644 index 00000000..5d6492e3 --- /dev/null +++ b/src/ao_extra_basis/density_extra.irp.f @@ -0,0 +1,87 @@ +BEGIN_PROVIDER [ double precision, effective_ao_extra_dm, (ao_extra_num, ao_extra_num)] + implicit none + BEGIN_DOC + ! effective density matrix : rho_pq x N_p x N_q x E_pq x (pi/gamma_pq)^3/2 + ! + ! where rho_pq is the usual density matrix + ! + ! N_p and N_q are the normalization factors associated with the two Gaussians + ! + ! E_pq is the prefactor resulting from the Gaussian product + ! + ! gamma_pq = gamma_p + gamm_q + END_DOC + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & + * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) + enddo + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] +&BEGIN_PROVIDER [ double precision, inv_gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] +&BEGIN_PROVIDER [ double precision, inv_pi_gamma_pq_3_2_ao_extra, (ao_extra_num,ao_extra_num)] +&BEGIN_PROVIDER [ double precision, sqrt_gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] + implicit none + BEGIN_DOC + ! gamma_pq_ao_extra = gamma_p + gamma_q + ! + ! inv_gamma_pq_ao_extra = 1/(gamma_p + gamma_q) + ! + ! sqrt_gamma_pq_ao_extra = sqrt(gamma_p + gamma_q) + ! + ! WARNING :: VALID ONLY IN THE CASE OF A PURELY 1S BASIS + END_DOC + include 'constants.include.F' + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + gamma_pq_ao_extra(j,i) = ao_extra_expo(j,1) + ao_extra_expo(i,1) + inv_gamma_pq_ao_extra(j,i) = 1.d0/gamma_pq_ao_extra(j,i) + sqrt_gamma_pq_ao_extra(j,i) = dsqrt(gamma_pq_ao_extra(j,i)) + inv_pi_gamma_pq_3_2_ao_extra(j,i) = (pi * inv_gamma_pq_ao_extra(j,i))**(1.5d0) + enddo + enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, E_pq_ao_extra, (ao_extra_num,ao_extra_num)] + implicit none + BEGIN_DOC + ! E_pq_ao_extra = exp(-alpha_p alpha_q/gamma_pq (Q_p - Q_q)^2) + END_DOC + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + E_pq_ao_extra(j,i) = dexp(-ao_extra_center_1s_dist(j,i)**2 * ao_extra_expo(j,1)*ao_extra_expo(i,1)*inv_gamma_pq_ao_extra(j,i)) + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_center_1s, (3,ao_extra_num)] + implicit none + BEGIN_DOC + ! Original position of each extra AO + END_DOC + integer :: i,i_nucl + do i = 1, ao_extra_num + i_nucl= ao_extra_nucl(i) + ao_extra_center_1s(1:3,i) = extra_nucl_coord(i_nucl,1:3) + enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_extra_center_1s_dist, (ao_extra_num,ao_extra_num)] + implicit none + integer :: i,j + do i = 1, ao_extra_num + do j = 1, ao_extra_num + ao_extra_center_1s_dist(j,i) = (ao_extra_center_1s(1,j) - ao_extra_center_1s(1,i))**2 & + + (ao_extra_center_1s(2,j) - ao_extra_center_1s(2,i))**2 & + + (ao_extra_center_1s(3,j) - ao_extra_center_1s(3,i))**2 + ao_extra_center_1s_dist(j,i)=dsqrt(ao_extra_center_1s_dist(j,i)) + enddo + enddo +END_PROVIDER diff --git a/src/ao_extra_basis/dimensions_integrals.irp.f b/src/ao_extra_basis/dimensions_integrals.irp.f new file mode 100644 index 00000000..80dcda18 --- /dev/null +++ b/src/ao_extra_basis/dimensions_integrals.irp.f @@ -0,0 +1,19 @@ + BEGIN_PROVIDER [ integer, n_pt_max_extra_basis_integrals ] +&BEGIN_PROVIDER [ integer, n_pt_max_extra_basis_i_x] + implicit none + BEGIN_DOC +! Number of points used in the numerical integrations. + END_DOC + integer :: n_pt_sup + integer :: prim_power_l_max + include 'utils/constants.include.F' + prim_power_l_max = maxval(ao_extra_power) + n_pt_max_extra_basis_integrals = 24 * prim_power_l_max + 4 + n_pt_max_extra_basis_i_x = 8 * prim_power_l_max + ASSERT (n_pt_max_extra_basis_i_x-1 <= max_dim) + if (n_pt_max_extra_basis_i_x-1 > max_dim) then + print *, 'Increase max_dim in utils/constants.include.F to ', n_pt_max_extra_basis_i_x-1 + stop 1 + endif +END_PROVIDER + diff --git a/src/ao_extra_basis/extra_basis.irp.f b/src/ao_extra_basis/extra_basis.irp.f new file mode 100644 index 00000000..9773af2f --- /dev/null +++ b/src/ao_extra_basis/extra_basis.irp.f @@ -0,0 +1,16 @@ +program extra_basis + implicit none + BEGIN_DOC +! TODO : Put the documentation of the program here + END_DOC + integer :: i + print*,'extra_nucl_num = ',extra_nucl_num + do i = 1, extra_nucl_num + print*,'i = ',i + print*,'extra_nucl_label = ',extra_nucl_label(i) + print*,'extra_nucl_charge = ',extra_nucl_charge(i) + print*,'extra_nucl_coord = ' + print*,extra_nucl_coord(i,1:3) + enddo + print*,ao_extra_num +end diff --git a/src/ao_extra_basis/fit_1s_basis.irp.f b/src/ao_extra_basis/fit_1s_basis.irp.f new file mode 100644 index 00000000..ef09d5b2 --- /dev/null +++ b/src/ao_extra_basis/fit_1s_basis.irp.f @@ -0,0 +1,41 @@ +program fit_1s_basis + implicit none + provide lmax_too_big + integer :: i,j + print*,'////////////////////////////////////////////////////' + print*,'////////////////////////////////////////////////////' + print*,'Fitting the original basis set on uncontracted s only functions ' + print*,'WARNING :: works for now with only P functions at most !!' + print*,'WARNING :: otherwise it will stop ' + print*,'Writting the results in the extra_nuclei and ao_extra_basis folders of EZFIO' + print*,'New number of atomic functions : ' + print*,'n_func_tot = ',n_func_tot + + print*,'extra_fictious_nucl = ',extra_fictious_nucl + do i = 1, extra_fictious_nucl + print*,list_fict_nucl(i) + enddo + print*,'' + print*,'' + do i = 1, nucl_num + print*,list_real_nucl(i) + enddo + call ezfio_set_extra_nuclei_extra_nucl_num(new_nucl_num) + call ezfio_set_extra_nuclei_extra_nucl_fictious_num(extra_fictious_nucl) + call ezfio_set_extra_nuclei_extra_nucl_real_num(nucl_num) + call ezfio_set_extra_nuclei_extra_nucl_fictious_list(list_fict_nucl) + call ezfio_set_extra_nuclei_extra_nucl_real_list(list_real_nucl) + call ezfio_set_extra_nuclei_extra_nucl_real_fictious_list(extra_nucl_real_fictious_list_prov) + call ezfio_set_extra_nuclei_extra_nucl_charge(new_nucl_charge_1s) + call ezfio_set_extra_nuclei_extra_nucl_coord(new_nucl_coord_1s) + call ezfio_set_extra_nuclei_extra_nucl_label(new_nucl_label_1s) +! + call ezfio_set_ao_extra_basis_ao_extra_num(n_func_tot) + call ezfio_set_ao_extra_basis_ao_extra_center(ao_extra_center) + call ezfio_set_ao_extra_basis_ao_extra_nucl(new_ao_nucl_1s) + call ezfio_set_ao_extra_basis_ao_extra_prim_num(new_ao_prim_num_1s) + call ezfio_set_ao_extra_basis_ao_extra_coef(new_ao_coef_1s) + call ezfio_set_ao_extra_basis_ao_extra_expo(new_ao_expo_1s) + call ezfio_set_ao_extra_basis_ao_extra_power(new_ao_power_1s) +end + diff --git a/src/ao_extra_basis/h2o.xyz b/src/ao_extra_basis/h2o.xyz new file mode 100644 index 00000000..d3928214 --- /dev/null +++ b/src/ao_extra_basis/h2o.xyz @@ -0,0 +1,7 @@ +3 + +O 0.000000 -0.399441 3.000000 +H 0.761232 0.199721 3.000000 +H -0.761232 0.199721 3.000000 + + diff --git a/src/ao_extra_basis/install b/src/ao_extra_basis/install new file mode 100755 index 00000000..e7e668e1 --- /dev/null +++ b/src/ao_extra_basis/install @@ -0,0 +1,23 @@ +#!/bin/bash + +# Check if the QP_ROOT environment variable is set. +if [[ -z ${QP_ROOT} ]] +then + print "The QP_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + +# Get the absolute path of the current directory. +currdir=${PWD} + +# list of the scripts to be used by the module +scripts_list="qp_copy_extra_basis qp_add_extra_fit_system qp_copy_extra_basis_to_usual_basis qp_fit_1s_basis" + +# Make a symbolic link for all scripts to be used in the ${QP_ROOT}/scripts/ +# directory. + for i in $scripts_list + do + ln --symbolic ${currdir}/$i ${QP_ROOT}/scripts/ + done + diff --git a/src/ao_extra_basis/prov_fit_1s.irp.f b/src/ao_extra_basis/prov_fit_1s.irp.f new file mode 100644 index 00000000..99a18a6b --- /dev/null +++ b/src/ao_extra_basis/prov_fit_1s.irp.f @@ -0,0 +1,266 @@ +BEGIN_PROVIDER [ double precision, ao_extra_center] + implicit none + ao_extra_center = 0.01d0 +END_PROVIDER + + BEGIN_PROVIDER [ integer, n_func_tot] + implicit none + BEGIN_DOC + ! n_func_tot :: total number of functions in the fitted basis set + ! + ! returned in an uncontracted way + END_DOC + integer :: i,prefact + n_func_tot = 0 + print*,'n_func_tot ' + do i = 1, ao_num + if(ao_l(i) == 0)then + prefact = 1 ! s functions + else + ! p functions are fitted with 2 functions + ! d functions are fitted with 4 functions etc ... + prefact=2*ao_l(i) + endif + n_func_tot += prefact * ao_prim_num(i) + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, n_prim_tot_orig] + implicit none + integer :: i + n_prim_tot_orig = 0 + do i = 1, ao_num + n_prim_tot_orig += ao_prim_num(i) + enddo +END_PROVIDER + + +BEGIN_PROVIDER [ logical, lmax_too_big] + implicit none + if (ao_l_max.gt.1)then + lmax_too_big = .True. + else + lmax_too_big = .False. + endif + if(lmax_too_big)then + print*,'STOPPING !! lmax is larger than 1 !' + print*,'Cannot yet fit with 1s functions ...' + stop + endif +END_PROVIDER + + BEGIN_PROVIDER [ integer, n_2p_func_orig] +&BEGIN_PROVIDER [ integer, n_2p_func_tot] + implicit none + integer :: i + BEGIN_DOC + ! n_2p_func_orig :: number of 2p functions in the original basis + ! + ! n_2p_func_tot :: total number of p functions in the fitted basis + END_DOC + n_2p_func_orig= 0 + n_2p_func_tot = 0 + do i = 1, ao_num + if(ao_l(i)==1)then + n_2p_func_orig+= 1 + n_2p_func_tot += ao_prim_num(i) * 2 + endif + enddo + print*,'n_2p_func_tot = ',n_2p_func_tot +END_PROVIDER + +BEGIN_PROVIDER [ integer, list_2p_functions, (n_2p_func_orig)] + implicit none + BEGIN_DOC + ! list of 2p functions in the original basis + END_DOC + integer :: i,j + j=0 + do i = 1, ao_num + if(ao_l(i)==1)then + j+=1 + list_2p_functions(j) = i + endif + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, extra_fictious_nucl] + implicit none + extra_fictious_nucl = n_2p_func_tot +END_PROVIDER + +BEGIN_PROVIDER [ integer, new_nucl_num] + implicit none + new_nucl_num = nucl_num + n_2p_func_tot + print*,'new_nucl_num = ',new_nucl_num +END_PROVIDER + + BEGIN_PROVIDER [ character*(32), new_nucl_label_1s , (new_nucl_num) ] +&BEGIN_PROVIDER [ integer, list_real_nucl, (nucl_num) ] +&BEGIN_PROVIDER [ integer, list_fict_nucl, (extra_fictious_nucl) ] + implicit none + integer :: i,j + do i = 1, nucl_num + new_nucl_label_1s(i) = nucl_label(i) + list_real_nucl(i) = i + enddo + j=0 + do i = nucl_num+1,new_nucl_num + j+=1 + new_nucl_label_1s(i) = "X" + list_fict_nucl(j) = i + enddo +END_PROVIDER + + BEGIN_PROVIDER [ double precision, new_nucl_coord_1s, (new_nucl_num,3)] + implicit none + integer :: i,j + do i = 1, new_nucl_num + new_nucl_coord_1s(i,1:3) = new_nucl_coord_1s_transp(1:3,i) + enddo + END_PROVIDER + + BEGIN_PROVIDER [ double precision, new_nucl_coord_1s_transp, (3,new_nucl_num)] +&BEGIN_PROVIDER [ double precision, new_nucl_charge_1s, (new_nucl_num)] +&BEGIN_PROVIDER [ integer, extra_nucl_real_fictious_list_prov, (extra_fictious_nucl)] + implicit none + BEGIN_DOC +! the real atoms are located in the first nucl_num entries +! +! then the fictious atoms are located after + END_DOC + integer :: i,ii,j,i_ao,k,n_ao + integer :: return_xyz_int,power(3),good_i + new_nucl_charge_1s = 0.d0 + do i = 1, nucl_num + new_nucl_coord_1s_transp(1:3,i) = nucl_coord_transp(1:3,i) + new_nucl_charge_1s(i) = nucl_charge(i) + enddo + k = nucl_num + do i = 1, nucl_num + do ii = 1, Nucl_N_Aos(i) + i_ao = nucl_aos_transposed(ii,i) + if(ao_l(i_ao)==1)then + ! split the function into 2 s functions + ! one is centered in R_x + d + power(1:3) = ao_power(i_ao,1:3) + good_i = return_xyz_int(power) + do j = 1, ao_prim_num(i_ao) + k+=1 + new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) + new_nucl_coord_1s_transp(good_i,k)+= ao_extra_center + new_nucl_charge_1s(k) = 0.d0 + extra_nucl_real_fictious_list_prov(k-nucl_num)=i + k+=1 + ! one is centered in R_x - d + new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) + new_nucl_coord_1s_transp(good_i,k)-= ao_extra_center + new_nucl_charge_1s(k) = 0.d0 + extra_nucl_real_fictious_list_prov(k-nucl_num)=i + enddo + else if(ao_l(i_ao).gt.1)then + print*,'WARNING ! Lmax value not implemented yet !' + print*,'stopping ...' + stop + endif + enddo + enddo + +END_PROVIDER + + BEGIN_PROVIDER [ integer, new_n_AOs_max] + implicit none + new_n_AOs_max = ao_prim_num_max * n_AOs_max + + END_PROVIDER + + + BEGIN_PROVIDER [ integer, new_Nucl_N_Aos, (new_nucl_num)] +&BEGIN_PROVIDER [ integer, new_nucl_aos_transposed, (new_n_AOs_max,new_nucl_num) ] +&BEGIN_PROVIDER [ double precision, new_ao_expo_1s , (n_func_tot) ] +&BEGIN_PROVIDER [ integer, new_ao_nucl_1s, (n_func_tot)] + implicit none + integer :: i,j,ii,i_ao,n_func,n_func_total,n_nucl + double precision :: coef + n_func_total = 0 + do i = 1, nucl_num + n_func = 0 + do ii = 1, Nucl_N_Aos(i) + i_ao = nucl_aos_transposed(ii,i) + if(ao_l(i_ao)==0)then + do j = 1, ao_prim_num(i_ao) + coef= ao_expo(i_ao,j) + n_func_total += 1 + n_func +=1 + new_nucl_aos_transposed(n_func,i) = n_func_total + new_ao_expo_1s(n_func_total) = coef + new_ao_nucl_1s(n_func_total) = i + enddo + endif + enddo + new_Nucl_N_Aos(i) = n_func + enddo + n_nucl=nucl_num + do i = 1, nucl_num + do ii = 1, Nucl_N_Aos(i) + i_ao = nucl_aos_transposed(ii,i) + if(ao_l(i_ao)==1)then + do j = 1, ao_prim_num(i_ao) + coef= ao_expo(i_ao,j) + n_func_total+=1 + n_nucl +=1 + new_nucl_aos_transposed(1,n_nucl) = n_func_total + new_ao_expo_1s(n_func_total) = coef + new_Nucl_N_Aos(n_nucl)=1 + new_ao_nucl_1s(n_func_total) = n_nucl + + n_func_total+=1 + n_nucl +=1 + new_nucl_aos_transposed(1,n_nucl) = n_func_total + new_ao_expo_1s(n_func_total) = coef + new_Nucl_N_Aos(n_nucl)=1 + new_ao_nucl_1s(n_func_total) = n_nucl + enddo + endif + enddo + enddo + +END_PROVIDER + +BEGIN_PROVIDER [ double precision, new_ao_coef_1s , (n_func_tot) ] + implicit none + integer :: i + BEGIN_DOC +! Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** AOs. + END_DOC + do i = 1, n_func_tot + new_ao_coef_1s(i) = 1.d0 + enddo +END_PROVIDER + +BEGIN_PROVIDER [ integer, new_ao_prim_num_1s, (n_func_tot)] + implicit none + integer :: i + do i = 1, n_func_tot + new_ao_prim_num_1s(i) = 1 + enddo +END_PROVIDER + +BEGIN_PROVIDER [integer, new_ao_power_1s, (n_func_tot,3)] + implicit none + new_ao_power_1s = 0 +END_PROVIDER + +integer function return_xyz_int(power) + implicit none + integer,intent(in) :: power(3) + if(power(1) == 1 .and. power(2) ==0 .and. power(3) ==0)then + return_xyz_int = 1 + else if (power(2) == 1 .and. power(1) ==0 .and. power(3) ==0)then + return_xyz_int = 2 + else if (power(3) == 1 .and. power(1) ==0 .and. power(1) ==0)then + return_xyz_int = 3 + else + return_xyz_int = -1000 + endif +end diff --git a/src/ao_extra_basis/qp_add_extra_fit_system b/src/ao_extra_basis/qp_add_extra_fit_system new file mode 100755 index 00000000..dae95062 --- /dev/null +++ b/src/ao_extra_basis/qp_add_extra_fit_system @@ -0,0 +1,19 @@ +#!/bin/bash +# specify the QP folder +QP=$QP_ROOT +dir=${QP} +# sourcing the quantum_package.rc file +. ${QP}/quantum_package.rc +# The main EZFIO folder +main=${1%/} +# The XYZ file containing the geometry of the additional system you want to add +extra=${2%.xyz} +basis_extra=sto-3g +ezfio_extra=${extra}_${basis_extra}_1s +echo $ezfio_extra +qp_fit_1s_basis $extra $basis_extra +qp set_file $ezfio_extra +qp run scf | tee ${ezfio_extra}.scf.out +qp run save_one_e_dm | tee ${ezfio_extra}.one_rdm.out +qp_copy_extra_basis ${ezfio_extra} $main + diff --git a/src/ao_extra_basis/qp_copy_extra_basis b/src/ao_extra_basis/qp_copy_extra_basis new file mode 100755 index 00000000..cb435e18 --- /dev/null +++ b/src/ao_extra_basis/qp_copy_extra_basis @@ -0,0 +1,67 @@ +#!/bin/bash +# specify the QP folder +QP=$QP_ROOT +dir=${QP} +# sourcing the quantum_package.rc file +. ${QP}/quantum_package.rc +# script that copy all data from |AO| basis and nuclei of EZFIO_extra to the ao_extra_basis and extra_nuclei of EZFIO_target +# use: +# qp_copy_extra_basis EZFIO_extra EZFIO_target +EZFIO_extra=${1%/} +EZFIO_extra=${EZFIO_extra%.xyz} +EZFIO_target=${2%/} + + + +echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" +echo "Extracting data from "$EZFIO_extra +echo "and Copying data to "$EZFIO_target + +### COPYING ALL DATA FROM $EZFIO_extra/nuclei/ to ${EZFIO_target}/extra_nuclei/ +echo "COPYING ALL DATA FROM "$EZFIO_extra"/nuclei/ to "${EZFIO_target}"/extra_nuclei/" +direxists=false +if [ -d ${EZFIO_target}/extra_nuclei/ ] ; then + direxists=true + echo "The directory extra_nuclei exists" + else + echo "Creating the directory extra_nuclei " + direxists=false + mkdir ${EZFIO_target}/extra_nuclei/ +fi +data=`\ls $EZFIO_extra/nuclei/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/nucl/extra_nucl/g' ` + echo $newfile + cp ${EZFIO_extra}/nuclei/$i ${EZFIO_target}/extra_nuclei/$newfile +done + +### COPYING ALL DATA FROM $EZFIO_extra/ao_basis/ to ${EZFIO_target}/ao_extra_basis/ +direxists=false +if [ -d ${EZFIO_target}/ao_extra_basis/ ] ; then + direxists=true + echo "The directory exists ao_extra_basis" + else + echo "Creating the directory ao_extra_basis" + direxists=false + mkdir ${EZFIO_target}/ao_extra_basis/ +fi +echo "COPYING ALL DATA FROM "$EZFIO_extra"/ao_basis/ to "${EZFIO_target}"/ao_extra_basis/" +data=`\ls $EZFIO_extra/ao_basis/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/ao/ao_extra/g' ` + echo $newfile + cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile +done +i=primitives_normalized +newfile=primitives_normalized_extra +cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile + +echo "COPYING ALL DATA FROM "$EZFIO_extra"/aux_quantities/ to "${EZFIO_target}"/ao_extra_basis/" +i=data_one_e_dm_tot_ao.gz +newfile=ao_extra_one_e_dm.gz +cp ${EZFIO_extra}/aux_quantities/$i ${EZFIO_target}/ao_extra_basis/$newfile + diff --git a/src/ao_extra_basis/qp_copy_extra_basis_to_usual_basis b/src/ao_extra_basis/qp_copy_extra_basis_to_usual_basis new file mode 100755 index 00000000..ba7e6a71 --- /dev/null +++ b/src/ao_extra_basis/qp_copy_extra_basis_to_usual_basis @@ -0,0 +1,57 @@ +#!/bin/bash +# specify the QP folder +# script that copy all data in ao_extra_basis and extra_nuclei and copy it to ao_basis and ao_nuclei +QP=$QP_ROOT +dir=${QP} +# sourcing the quantum_package.rc file +. ${QP}/quantum_package.rc +EZFIO_extra=${1%/} +EZFIO_target=${2%/} + + + +echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" +echo "Extracting data from "$EZFIO_extra +echo "and Copying data to "$EZFIO_target + +### COPYING ALL DATA FROM $EZFIO_extra/nuclei/ to ${EZFIO_target}/extra_nuclei/ +echo "COPYING ALL DATA FROM "$EZFIO_extra"/extra_nuclei/ to "${EZFIO_target}"/nuclei/" +direxists=false +if [ -d ${EZFIO_target}/extra_nuclei/ ] ; then + direxists=true + echo "The directory extra_nuclei exists" + else + echo "PB !!" + direxists=false + mkdir ${EZFIO_target}/extra_nuclei/ +fi +data=`\ls $EZFIO_extra/extra_nuclei/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/extra_nucl/nucl/g' ` + echo $newfile + cp ${EZFIO_extra}/extra_nuclei/$i ${EZFIO_target}/nuclei/$newfile +done + +### COPYING ALL DATA FROM $EZFIO_extra/ao_basis/ to ${EZFIO_target}/ao_extra_basis/ +direxists=false +if [ -d ${EZFIO_target}/ao_extra_basis/ ] ; then + direxists=true + echo "The directory exists ao_extra_basis" + else + echo "PB !!" + direxists=false + mkdir ${EZFIO_target}/ao_extra_basis/ +fi +echo "COPYING ALL DATA FROM "$EZFIO_extra"/ao_basis/ to "${EZFIO_target}"/ao_extra_basis/" +data=`\ls $EZFIO_extra/ao_extra_basis/` +for i in $data +do + echo $i + newfile=`echo $i | sed 's/ao_extra/ao/g' ` + echo $newfile + cp ${EZFIO_extra}/ao_extra_basis/$i ${EZFIO_target}/ao_basis/$newfile +done + + diff --git a/src/ao_extra_basis/qp_fit_1s_basis b/src/ao_extra_basis/qp_fit_1s_basis new file mode 100755 index 00000000..366e478a --- /dev/null +++ b/src/ao_extra_basis/qp_fit_1s_basis @@ -0,0 +1,12 @@ +#!/bin/bash +## Takes as an argument an xyz file and a basis, and fit the AO basis onto an "s" basis only +## use: +# qp_fit_1s_basis my_xyz_file.xyz basis +source ~/qp2/quantum_package.rc +input=${1%.xyz} +basis=$2 +ezfio_fit=${input}_${basis}_1s +qp create_ezfio -b $basis $input.xyz -o $ezfio_fit +# Fitting the original basis on 1s only basis functions +qp run fit_1s_basis |tee ${ezfio_fit}.fit_1s.out +qp_copy_extra_basis_to_usual_basis $ezfio_fit $ezfio_fit diff --git a/src/ao_extra_basis/transform_basis.irp.f b/src/ao_extra_basis/transform_basis.irp.f new file mode 100644 index 00000000..374d2dfc --- /dev/null +++ b/src/ao_extra_basis/transform_basis.irp.f @@ -0,0 +1,49 @@ +subroutine rotate_nuclei(phi,theta,psi,nucl_centers,n_nucl,nucl_centers_after) + implicit none + BEGIN_DOC + ! routine that rotates a set of nuclei according to three axis corresponding to angles phi, theta, psi. + END_DOC + double precision, intent(in) :: phi,theta,psi + double precision, intent(in) :: nucl_centers(3,n_nucl) + integer, intent(in) :: n_nucl + double precision, intent(out):: nucl_centers_after(3,n_nucl) + double precision :: r_mat(3,3) + call r_phi_theta_psi_matrix(phi,theta,psi,r_mat) + call get_AB_prod(r_mat,3,3,nucl_centers,n_nucl,nucl_centers_after) + +end + + +subroutine r_phi_theta_psi_matrix(phi,theta,psi,r_mat) + implicit none + BEGIN_DOC + ! routine that creates the rotation matrix corresponding to phi,theta,psi + ! + ! according to conventions in MDFT code + END_DOC + double precision, intent(in) :: phi,theta,psi + double precision, intent(out):: r_mat(3,3) + double precision :: ctheta, stheta + double precision :: cphi , sphi + double precision :: cpsi , spsi + ctheta = dcos(theta) + cphi = dcos(phi) + cpsi = dcos(psi) + + stheta = dsin(theta) + sphi = dsin(phi) + spsi = dsin(psi) + + r_mat(1,1) = ctheta*cphi*cpsi-sphi*spsi + r_mat(1,2) = -ctheta*cphi*spsi-sphi*cpsi + r_mat(1,3) = stheta*cphi + + r_mat(2,1) = ctheta*sphi*cpsi+cphi*spsi + r_mat(2,2) = -ctheta*sphi*spsi+cphi*cpsi + r_mat(2,3) = stheta*sphi + + r_mat(3,1) = -stheta*cpsi + r_mat(3,2) = stheta*spsi + r_mat(3,3) = ctheta + +end diff --git a/src/ao_extra_basis/uninstall b/src/ao_extra_basis/uninstall new file mode 100755 index 00000000..0e4cd253 --- /dev/null +++ b/src/ao_extra_basis/uninstall @@ -0,0 +1,20 @@ +#!/bin/bash + +# Check if the QP_ROOT environment variable is set. +if [[ -z ${QP_ROOT} ]] +then + print "The QP_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + +# list of the scripts to be used by the module +scripts_list="qp_copy_extra_basis qp_add_extra_fit_system qp_copy_extra_basis_to_usual_basis qp_fit_1s_basis" + +# Destroy ONLY the symbolic link for the scripts to be used in the +# ${QP_ROOT}/scripts/ directory. + for i in $scripts_list + do + find ${QP_ROOT}/scripts/$i -type l -delete + done + diff --git a/src/extra_nuclei/EZFIO.cfg b/src/extra_nuclei/EZFIO.cfg new file mode 100644 index 00000000..8c04b4c7 --- /dev/null +++ b/src/extra_nuclei/EZFIO.cfg @@ -0,0 +1,56 @@ +[extra_nucl_num] +doc: Number of nuclei +type: integer +interface: ezfio, provider + +[extra_nucl_pouet] +doc: Number of nuclei +type: integer +interface: ezfio, provider, ocaml +default:1 + +[extra_nucl_label] +doc: Nuclear labels +type: character*(32) +size: (extra_nuclei.extra_nucl_num) +interface: ezfio, provider + +[extra_nucl_charge] +doc: Nuclear charges +type:double precision +size: (extra_nuclei.extra_nucl_num) +interface: ezfio, provider + +[extra_nucl_coord] +doc: Nuclear coordinates in the format (:, {x,y,z}) +type: double precision +size: (extra_nuclei.extra_nucl_num,3) +interface: ezfio + +[extra_nucl_real_num] +doc: Number of real nuclei +type: integer +interface: ezfio, provider + +[extra_nucl_fictious_num] +doc: Number of fictious nuclei +type: integer +interface: ezfio, provider + +[extra_nucl_real_fictious_list] +doc: List of real nuclei to which fictious nuclei are attached to +type: integer +size: (extra_nuclei.extra_nucl_fictious_num) +interface: ezfio, provider + +[extra_nucl_fictious_list] +doc: List of fictious nuclei +type: integer +size: (extra_nuclei.extra_nucl_fictious_num) +interface: ezfio, provider + +[extra_nucl_real_list] +doc: List of real nuclei +type: integer +size: (extra_nuclei.extra_nucl_real_num) +interface: ezfio, provider diff --git a/src/extra_nuclei/NEED b/src/extra_nuclei/NEED new file mode 100644 index 00000000..0dc19a80 --- /dev/null +++ b/src/extra_nuclei/NEED @@ -0,0 +1,3 @@ +ezfio_files +utils +nuclei diff --git a/src/extra_nuclei/README.rst b/src/extra_nuclei/README.rst new file mode 100644 index 00000000..6bb260a0 --- /dev/null +++ b/src/extra_nuclei/README.rst @@ -0,0 +1,4 @@ +============ +extra_nuclei +============ + diff --git a/src/extra_nuclei/extra_nuclei.irp.f b/src/extra_nuclei/extra_nuclei.irp.f new file mode 100644 index 00000000..53653e8d --- /dev/null +++ b/src/extra_nuclei/extra_nuclei.irp.f @@ -0,0 +1,7 @@ +program extra_nuclei + implicit none + BEGIN_DOC +! TODO : Put the documentation of the program here + END_DOC + print *, 'Hello world' +end diff --git a/src/extra_nuclei/nuclei.irp.f b/src/extra_nuclei/nuclei.irp.f new file mode 100644 index 00000000..d8ea57f2 --- /dev/null +++ b/src/extra_nuclei/nuclei.irp.f @@ -0,0 +1,138 @@ +BEGIN_PROVIDER [ double precision, extra_nucl_coord, (extra_nucl_num,3) ] + implicit none + + BEGIN_DOC + ! Nuclear coordinates in the format (:, {x,y,z}) + END_DOC + PROVIDE ezfio_filename extra_nucl_label extra_nucl_charge + + if (mpi_master) then + double precision, allocatable :: buffer(:,:) + extra_nucl_coord = 0.d0 + allocate (buffer(extra_nucl_num,3)) + buffer = 0.d0 + logical :: has + call ezfio_has_extra_nuclei_extra_nucl_coord(has) + if (.not.has) then + print *, irp_here + stop 1 + endif + call ezfio_get_extra_nuclei_extra_nucl_coord(buffer) + integer :: i,j + + do i=1,3 + do j=1,extra_nucl_num + extra_nucl_coord(j,i) = buffer(j,i) + enddo + enddo + deallocate(buffer) + + character*(64), parameter :: f = '(A16, 4(1X,F12.6))' + character*(64), parameter :: ft= '(A16, 4(1X,A12 ))' + double precision, parameter :: a0= 0.529177249d0 + + call write_time(6) + write(6,'(A)') '' + write(6,'(A)') 'Extra Nuclear Coordinates (Angstroms)' + write(6,'(A)') '=====================================' + write(6,'(A)') '' + write(6,ft) & + '================','============','============','============','============' + write(6,*) & + ' Atom Charge X Y Z ' + write(6,ft) & + '================','============','============','============','============' + + do i=1,extra_nucl_num + write(6,f) extra_nucl_label(i), extra_nucl_charge(i), & + extra_nucl_coord(i,1)*a0, & + extra_nucl_coord(i,2)*a0, & + extra_nucl_coord(i,3)*a0 + enddo + write(6,ft) & + '================','============','============','============','============' + write(6,'(A)') '' + + if (extra_nucl_num > 1) then + double precision :: dist_min, x, y, z + dist_min = huge(1.d0) + do i=1,extra_nucl_num + do j=i+1,extra_nucl_num + x = extra_nucl_coord(i,1)-extra_nucl_coord(j,1) + y = extra_nucl_coord(i,2)-extra_nucl_coord(j,2) + z = extra_nucl_coord(i,3)-extra_nucl_coord(j,3) + dist_min = min(x*x + y*y + z*z, dist_min) + enddo + enddo + write(6,'(A,F12.4,A)') 'Minimal interatomic distance found: ', & + dsqrt(dist_min)*a0,' Angstrom' + endif + + 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' + integer :: ierr + call MPI_BCAST( extra_nucl_coord, 3*extra_nucl_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + stop 'Unable to read nucl_coord with MPI' + endif + IRP_ENDIF + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, extra_nucl_coord_transp, (3,extra_nucl_num) ] + implicit none + BEGIN_DOC + ! Transposed array of extra_nucl_coord + END_DOC + integer :: i, k + extra_nucl_coord_transp = 0.d0 + + do i=1,extra_nucl_num + extra_nucl_coord_transp(1,i) = extra_nucl_coord(i,1) + extra_nucl_coord_transp(2,i) = extra_nucl_coord(i,2) + extra_nucl_coord_transp(3,i) = extra_nucl_coord(i,3) + enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, extra_center_of_mass, (3) ] + implicit none + BEGIN_DOC + ! Center of mass of the molecule + END_DOC + integer :: i,j + double precision :: s + extra_center_of_mass(:) = 0.d0 + s = 0.d0 + do i=1,extra_nucl_num + do j=1,3 + extra_center_of_mass(j) += extra_nucl_coord(i,j)* element_mass(int(extra_nucl_charge(i))) + enddo + s += element_mass(int(extra_nucl_charge(i))) + enddo + s = 1.d0/s + extra_center_of_mass(:) = extra_center_of_mass(:)*s +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, extra_nucl_dist, (extra_nucl_num,extra_nucl_num)] + implicit none + integer :: i,j + double precision :: x,y,z + do i = 1, extra_nucl_num + do j = 1, extra_nucl_num + x = extra_nucl_coord(i,1)-extra_nucl_coord(j,1) + y = extra_nucl_coord(i,2)-extra_nucl_coord(j,2) + z = extra_nucl_coord(i,3)-extra_nucl_coord(j,3) + extra_nucl_dist(j,i) = x*x+y*y+z*z + extra_nucl_dist(j,i) = dsqrt(extra_nucl_dist(j,i)) + enddo + enddo + +END_PROVIDER diff --git a/src/mo_one_e_ints/mo_one_e_ints.irp.f b/src/mo_one_e_ints/mo_one_e_ints.irp.f index 19cd2159..db05ba90 100644 --- a/src/mo_one_e_ints/mo_one_e_ints.irp.f +++ b/src/mo_one_e_ints/mo_one_e_ints.irp.f @@ -22,13 +22,3 @@ END_PROVIDER - -BEGIN_PROVIDER [ double precision, ao_one_e_integrals_from_mo, (ao_num, ao_num)] - implicit none - BEGIN_DOC -! Integrals of the one e hamiltonian obtained from the integrals on the MO basis -! -! WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions - END_DOC - call mo_to_ao(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_num) -END_PROVIDER From e0d93d193b993313145a8b36d830d421c2aeaabf Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 18 Dec 2024 10:42:26 +0100 Subject: [PATCH 036/175] ao_extra_one_e_dm works --- plugins/local/extra_basis_int/NEED | 1 + plugins/local/extra_basis_int/coul_1s.irp.f | 38 +++++++++++++-- .../extra_basis_int/extra_basis_int.irp.f | 48 +++++++++++++++++-- src/ao_extra_basis/EZFIO.cfg | 2 +- src/ao_extra_basis/density_extra.irp.f | 2 +- 5 files changed, 83 insertions(+), 8 deletions(-) diff --git a/plugins/local/extra_basis_int/NEED b/plugins/local/extra_basis_int/NEED index 6214e5cd..0419f87f 100644 --- a/plugins/local/extra_basis_int/NEED +++ b/plugins/local/extra_basis_int/NEED @@ -1,3 +1,4 @@ ao_extra_basis ao_one_e_ints ao_two_e_ints +determinants diff --git a/plugins/local/extra_basis_int/coul_1s.irp.f b/plugins/local/extra_basis_int/coul_1s.irp.f index b6148293..964ed36a 100644 --- a/plugins/local/extra_basis_int/coul_1s.irp.f +++ b/plugins/local/extra_basis_int/coul_1s.irp.f @@ -1,9 +1,10 @@ -double precision function coul_full_pq_r_1s(p,q,R,R_p,R_q) +double precision function coul_full_ao_pq_r_1s(p,q,R,R_p,R_q) implicit none + include 'constants.include.F' BEGIN_DOC ! coul_full_pq_r_1s(p,q,r) = \int d^3r phi_p(r) phi_q(r) 1/(r-R) ! - ! where phi_q and phi_p are centered in R_q and R_p. + ! where phi_q and phi_p are centered in R_q and R_p. ! ! WARNING :: works only for purely 1s extra basis !! END_DOC @@ -18,6 +19,37 @@ double precision function coul_full_pq_r_1s(p,q,R,R_p,R_q) dist+= (P_pq(2)-R(2)) * (P_pq(2)-R(2)) dist+= (P_pq(3)-R(3)) * (P_pq(3)-R(3)) dist = dsqrt(dist) - coul_full_pq_r_1s = coefaos * coef * derf(sqrt_gamma_pq_ao_extra(q,p) * dist)/dist + if(dist.gt.1.d-10)then + coul_full_ao_pq_r_1s = coefaos * coef * derf(sqrt_gamma_pq_ao_extra(q,p) * dist)/dist + else + coul_full_ao_pq_r_1s = coefaos * coef * 2.d0 * sqrt_gamma_pq_ao_extra(q,p) * inv_sq_pi + endif + +end + +double precision function coul_pq_r_1s(p,q,R,R_p,R_q) + implicit none + include 'constants.include.F' + BEGIN_DOC + ! coul_full_pq_r_1s(p,q,r) = \int d^3r exp(-alpha_p (r-R_p)^2) exp(-alpha_q (r-R_q)^2) 1/|r-R| + ! + ! where alpha_p and alpha_q are the 1s extra basis + ! + ! WARNING :: works only for purely 1s extra basis !! + END_DOC + double precision, intent(in) :: R(3),R_p(3),R_q(3) + integer, intent(in) :: p,q + double precision :: dist,P_pq(3) + P_pq = ao_extra_expo(p,1) * R_p + ao_extra_expo(q,1) * R_q + P_pq = P_pq * inv_gamma_pq_ao_extra(q,p) + dist = (P_pq(1)-R(1)) * (P_pq(1)-R(1)) + dist+= (P_pq(2)-R(2)) * (P_pq(2)-R(2)) + dist+= (P_pq(3)-R(3)) * (P_pq(3)-R(3)) + dist = dsqrt(dist) + if(dist.gt.1.d-10)then + coul_pq_r_1s = derf(sqrt_gamma_pq_ao_extra(q,p) * dist)/dist + else + coul_pq_r_1s = 2.d0 * sqrt_gamma_pq_ao_extra(q,p) * inv_sq_pi + endif end diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 4495c8ff..1d35b1c2 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -10,7 +10,9 @@ program extra_basis_int ! call routine_test_pot_ne_mixed ! call routine_pot_ne ! call routine_test_pot_ne_extra_mixed - call routine_test_coul_1s +! call routine_test_coul_1s + call print_v_ne_extra_basis + call print_v_ne_basis end @@ -128,7 +130,7 @@ subroutine routine_test_coul_1s implicit none integer :: i,j double precision :: r(3) ,mu_in,NAI_pol_mult_erf_ao_extra - double precision :: ref,new, accu,coul_full_pq_r_1s,v_nucl_extra_ao + double precision :: ref,new, accu,coul_full_ao_pq_r_1s,v_nucl_extra_ao r(1) = 0.d0 r(2) = 0.5d0 r(3) = -1.5d0 @@ -140,10 +142,50 @@ subroutine routine_test_coul_1s ! do i = 1, 1 ! do j = 1, 1 ref = NAI_pol_mult_erf_ao_extra(i, j, mu_in, r) - new = coul_full_pq_r_1s(i,j,r,ao_extra_center_1s(1,i),ao_extra_center_1s(1,j)) + new = coul_full_ao_pq_r_1s(i,j,r,ao_extra_center_1s(1,i),ao_extra_center_1s(1,j)) ! new = v_nucl_extra_ao(i,j) accu += dabs(new-ref) enddo enddo print*,'accu = ',accu end + +subroutine print_v_ne_extra_basis + implicit none + integer :: i_ao,j_ao,i + double precision :: integral, accu, charge, coord(3), coul_pq_r_1s + + accu = 0.d0 + do i_ao = 1, ao_extra_num + do j_ao = 1, ao_extra_num + do i = 1, nucl_num + charge = nucl_charge(i) + coord(1:3) = nucl_coord_transp(1:3,i) + integral = coul_pq_r_1s(i_ao,j_ao,coord,ao_extra_center_1s(1,i_ao),ao_extra_center_1s(1,j_ao)) + accu += -charge * integral * effective_ao_extra_dm(j_ao,i_ao) + enddo + enddo + enddo + print*,'accu = ',accu + +end + +subroutine print_v_ne_basis + implicit none + integer :: i_ao,j_ao,i + double precision :: integral, accu, charge, coord(3), coul_full_pq_r_1s,NAI_pol_mult_erf_ao + + accu = 0.d0 + do i_ao = 1, ao_num + do j_ao = 1, ao_num + do i = 1, nucl_num + charge = nucl_charge(i) + coord(1:3) = nucl_coord_transp(1:3,i) + integral = NAI_pol_mult_erf_ao(i_ao, j_ao, 1d+10, coord) + accu += -charge * integral * one_e_dm_ao(j_ao,i_ao) + enddo + enddo + enddo + print*,'accu = ',accu + +end diff --git a/src/ao_extra_basis/EZFIO.cfg b/src/ao_extra_basis/EZFIO.cfg index 8841c194..79b37bf0 100644 --- a/src/ao_extra_basis/EZFIO.cfg +++ b/src/ao_extra_basis/EZFIO.cfg @@ -94,7 +94,7 @@ interface: ezfio, provider [ao_extra_one_e_dm] type: double precision doc: reduced density matrix on the ao extra basis -size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num) +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num,1) interface: ezfio, provider [ao_extra_center] diff --git a/src/ao_extra_basis/density_extra.irp.f b/src/ao_extra_basis/density_extra.irp.f index 5d6492e3..fa215466 100644 --- a/src/ao_extra_basis/density_extra.irp.f +++ b/src/ao_extra_basis/density_extra.irp.f @@ -14,7 +14,7 @@ integer :: i,j do i = 1, ao_extra_num do j = 1, ao_extra_num - effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & + effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i,1) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) enddo enddo From 31ddd20bf92526bd0a67992193a6e623f96d0055 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 18 Dec 2024 11:21:37 +0100 Subject: [PATCH 037/175] Finally fixed completion of qp set_file --- etc/qp.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/qp.rc b/etc/qp.rc index bd061e3e..b2992780 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -198,7 +198,7 @@ _qp_Complete() do dir_name=${i%/.version} # Remove the ".version" suffix dir_name=${dir_name#./} # Remove the leading "./" - dirs+="./$dir_name " + dirs+="$dir_name " done COMPREPLY=( $(compgen -W "$dirs" -- ${cur} ) ) From 88c49a03cef5ca87aa1c41706f2d559f99c71da7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 18 Dec 2024 17:01:31 +0100 Subject: [PATCH 038/175] Fixed qp_import_trexio.py --- etc/qp.rc | 27 ++++++++++++++----------- scripts/qp_import_trexio.py | 8 ++++---- src/trexio/export_trexio_routines.irp.f | 12 +++++------ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/etc/qp.rc b/etc/qp.rc index b2992780..adabc404 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -190,18 +190,21 @@ _qp_Complete() ;; esac;; set_file) - # Array to store directory names - dirs="" - - # Find directories containing "ezfio/.version" file recursively - for i in $(find . -name ezfio | sed 's/ezfio$/.version/') - do - dir_name=${i%/.version} # Remove the ".version" suffix - dir_name=${dir_name#./} # Remove the leading "./" - dirs+="$dir_name " - done - - COMPREPLY=( $(compgen -W "$dirs" -- ${cur} ) ) + # Caching the search results to reduce repeated find calls + if [[ -z "$QP_FILE_CACHE" || "$CACHE_DIR" != "$PWD" ]]; then + CACHE_DIR="$PWD" + QP_FILE_CACHE=$(find . -type f -name .version -exec dirname {} \; | sed 's/\/\.version$//') + fi + + # Support for relative paths + prefix=$(dirname "${cur}") + if [[ "$prefix" != "." ]]; then + dirs=$(echo "$QP_FILE_CACHE" | grep "^$prefix") + else + dirs="$QP_FILE_CACHE" + fi + + COMPREPLY=( $(compgen -W "$dirs" -- "$cur") ) return 0 ;; plugins) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index d75d0074..630ffb5e 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -3,11 +3,11 @@ convert TREXIO file to EZFIO Usage: - qp_import_trexio [-o EZFIO_DIR] FILE + qp_import_trexio [-o EZFIO_DIR] [-p] FILE Options: - -o --output=EZFIO_DIR Produced directory - by default is FILE.ezfio + -o --output=EZFIO_DIR Produced directory + by default is FILE.ezfio """ @@ -195,7 +195,7 @@ def write_ezfio(trexio_filename, filename): prim_factor = trexio.read_basis_prim_factor(trexio_file) for i,p in enumerate(prim_factor): coefficient[i] *= prim_factor[i] - ezfio.set_ao_basis_primitives_normalized(False) + ezfio.set_ao_basis_primitives_normalized(True) ezfio.set_basis_prim_coef(coefficient) elif basis_type.lower() == "numerical": diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index 0eec68bd..5bc44880 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -272,9 +272,9 @@ subroutine export_trexio(update,full_path) allocate(factor(shell_num)) ! if (ao_normalized) then -! factor(1:shell_num) = shell_normalization_factor(1:shell_num) + factor(1:shell_num) = shell_normalization_factor(1:shell_num) ! else - factor(1:shell_num) = 1.d0 +! factor(1:shell_num) = 1.d0 ! endif rc = trexio_write_basis_shell_factor(f(1), factor) call trexio_assert(rc, TREXIO_SUCCESS) @@ -291,11 +291,11 @@ subroutine export_trexio(update,full_path) call trexio_assert(rc, TREXIO_SUCCESS) allocate(factor(prim_num)) - if (primitives_normalized) then +! if (primitives_normalized) then factor(1:prim_num) = prim_normalization_factor(1:prim_num) - else - factor(1:prim_num) = 1.d0 - endif +! else +! factor(1:prim_num) = 1.d0 +! endif rc = trexio_write_basis_prim_factor(f(1), factor) call trexio_assert(rc, TREXIO_SUCCESS) deallocate(factor) From 2865ff8a701c005d3bdb3e0970f8db672b2489fd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 19 Dec 2024 09:36:32 +0100 Subject: [PATCH 039/175] Fixed qp set_file autocompletion --- etc/qp.rc | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/etc/qp.rc b/etc/qp.rc index adabc404..4e206096 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -190,21 +190,8 @@ _qp_Complete() ;; esac;; set_file) - # Caching the search results to reduce repeated find calls - if [[ -z "$QP_FILE_CACHE" || "$CACHE_DIR" != "$PWD" ]]; then - CACHE_DIR="$PWD" - QP_FILE_CACHE=$(find . -type f -name .version -exec dirname {} \; | sed 's/\/\.version$//') - fi - - # Support for relative paths - prefix=$(dirname "${cur}") - if [[ "$prefix" != "." ]]; then - dirs=$(echo "$QP_FILE_CACHE" | grep "^$prefix") - else - dirs="$QP_FILE_CACHE" - fi - - COMPREPLY=( $(compgen -W "$dirs" -- "$cur") ) + compopt -o nospace + COMPREPLY=( $(compgen -d -- "$cur") ) return 0 ;; plugins) From cf64024884285eac7770fa89126a4aca1f6505ff Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 20 Dec 2024 16:08:43 +0100 Subject: [PATCH 040/175] minor modifs --- plugins/local/ao_extra_basis/EZFIO.cfg | 2 +- plugins/local/ao_extra_basis/density_extra.irp.f | 2 +- src/ao_extra_basis/density_extra.irp.f | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg index 8841c194..79b37bf0 100644 --- a/plugins/local/ao_extra_basis/EZFIO.cfg +++ b/plugins/local/ao_extra_basis/EZFIO.cfg @@ -94,7 +94,7 @@ interface: ezfio, provider [ao_extra_one_e_dm] type: double precision doc: reduced density matrix on the ao extra basis -size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num) +size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num,1) interface: ezfio, provider [ao_extra_center] diff --git a/plugins/local/ao_extra_basis/density_extra.irp.f b/plugins/local/ao_extra_basis/density_extra.irp.f index 5d6492e3..fa215466 100644 --- a/plugins/local/ao_extra_basis/density_extra.irp.f +++ b/plugins/local/ao_extra_basis/density_extra.irp.f @@ -14,7 +14,7 @@ integer :: i,j do i = 1, ao_extra_num do j = 1, ao_extra_num - effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & + effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i,1) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) enddo enddo diff --git a/src/ao_extra_basis/density_extra.irp.f b/src/ao_extra_basis/density_extra.irp.f index fa215466..00c667d5 100644 --- a/src/ao_extra_basis/density_extra.irp.f +++ b/src/ao_extra_basis/density_extra.irp.f @@ -14,8 +14,10 @@ integer :: i,j do i = 1, ao_extra_num do j = 1, ao_extra_num - effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i,1) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & - * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) + ! it is assumed that you wish to take the ground state density and therefore the "1" last entry + effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i,1) & + * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & ! purely uncontracted 1s functions + * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) ! normalization factors and other stuffs enddo enddo From 0f6caa3ac0bda043c875dc5dbbe5fc4568c90fec Mon Sep 17 00:00:00 2001 From: eginer Date: Mon, 30 Dec 2024 14:31:02 +0100 Subject: [PATCH 041/175] fixed a stupid bug in f_psi_i_a_v_utils.irp.f --- plugins/local/ao_extra_basis/EZFIO.cfg | 104 ------ plugins/local/ao_extra_basis/LiH.xyz | 4 - plugins/local/ao_extra_basis/NEED | 3 - plugins/local/ao_extra_basis/README.rst | 15 - plugins/local/ao_extra_basis/aos.irp.f | 325 ------------------ plugins/local/ao_extra_basis/aos_transp.irp.f | 68 ---- .../local/ao_extra_basis/density_extra.irp.f | 87 ----- .../ao_extra_basis/dimensions_integrals.irp.f | 19 - .../local/ao_extra_basis/extra_basis.irp.f | 16 - .../local/ao_extra_basis/fit_1s_basis.irp.f | 41 --- plugins/local/ao_extra_basis/h2o.xyz | 7 - plugins/local/ao_extra_basis/install | 23 -- .../local/ao_extra_basis/prov_fit_1s.irp.f | 266 -------------- .../ao_extra_basis/qp_add_extra_fit_system | 19 - .../local/ao_extra_basis/qp_copy_extra_basis | 67 ---- .../qp_copy_extra_basis_to_usual_basis | 57 --- plugins/local/ao_extra_basis/qp_fit_1s_basis | 12 - .../ao_extra_basis/transform_basis.irp.f | 49 --- plugins/local/ao_extra_basis/uninstall | 20 -- plugins/local/extra_nuclei/EZFIO.cfg | 56 --- plugins/local/extra_nuclei/NEED | 3 - plugins/local/extra_nuclei/README.rst | 4 - plugins/local/extra_nuclei/extra_nuclei.irp.f | 7 - plugins/local/extra_nuclei/nuclei.irp.f | 138 -------- src/mu_of_r/f_psi_i_a_v_utils.irp.f | 2 +- 25 files changed, 1 insertion(+), 1411 deletions(-) delete mode 100644 plugins/local/ao_extra_basis/EZFIO.cfg delete mode 100644 plugins/local/ao_extra_basis/LiH.xyz delete mode 100644 plugins/local/ao_extra_basis/NEED delete mode 100644 plugins/local/ao_extra_basis/README.rst delete mode 100644 plugins/local/ao_extra_basis/aos.irp.f delete mode 100644 plugins/local/ao_extra_basis/aos_transp.irp.f delete mode 100644 plugins/local/ao_extra_basis/density_extra.irp.f delete mode 100644 plugins/local/ao_extra_basis/dimensions_integrals.irp.f delete mode 100644 plugins/local/ao_extra_basis/extra_basis.irp.f delete mode 100644 plugins/local/ao_extra_basis/fit_1s_basis.irp.f delete mode 100644 plugins/local/ao_extra_basis/h2o.xyz delete mode 100755 plugins/local/ao_extra_basis/install delete mode 100644 plugins/local/ao_extra_basis/prov_fit_1s.irp.f delete mode 100755 plugins/local/ao_extra_basis/qp_add_extra_fit_system delete mode 100755 plugins/local/ao_extra_basis/qp_copy_extra_basis delete mode 100755 plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis delete mode 100755 plugins/local/ao_extra_basis/qp_fit_1s_basis delete mode 100644 plugins/local/ao_extra_basis/transform_basis.irp.f delete mode 100755 plugins/local/ao_extra_basis/uninstall delete mode 100644 plugins/local/extra_nuclei/EZFIO.cfg delete mode 100644 plugins/local/extra_nuclei/NEED delete mode 100644 plugins/local/extra_nuclei/README.rst delete mode 100644 plugins/local/extra_nuclei/extra_nuclei.irp.f delete mode 100644 plugins/local/extra_nuclei/nuclei.irp.f diff --git a/plugins/local/ao_extra_basis/EZFIO.cfg b/plugins/local/ao_extra_basis/EZFIO.cfg deleted file mode 100644 index 79b37bf0..00000000 --- a/plugins/local/ao_extra_basis/EZFIO.cfg +++ /dev/null @@ -1,104 +0,0 @@ -[ao_extra_basis] -type: character*(256) -doc: Name of the |ao_extra| basis set -interface: ezfio - -[ao_extra_only_1s] -type: logical -doc: If |true|, you know that the additional AO basis is built only with 1s functions -interface: ezfio, provider -default: true - -[ao_extra_num] -type: integer -doc: Number of |ao_extras| -interface: ezfio, provider - -[ao_extra_prim_num] -type: integer -doc: Number of primitives per |ao_extra| -size: (ao_extra_basis.ao_extra_num) -interface: ezfio, provider - -[ao_extra_prim_num_max] -type: integer -doc: Maximum number of primitives -default: =maxval(ao_extra_basis.ao_extra_prim_num) -interface: ezfio - -[ao_extra_nucl] -type: integer -doc: Index of the nucleus on which the |ao_extra| is centered -size: (ao_extra_basis.ao_extra_num) -interface: ezfio, provider - -[ao_extra_power] -type: integer -doc: Powers of x, y and z for each |ao_extra| -size: (ao_extra_basis.ao_extra_num,3) -interface: ezfio, provider - -[ao_extra_coef] -type: double precision -doc: Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** ao_extras. -size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) -interface: ezfio, provider - -[ao_extra_expo] -type: double precision -doc: Exponents for each primitive of each |ao_extra| -size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) -interface: ezfio, provider - -[ao_extra_md5] -type: character*(32) -doc: MD5 key, specific of the |ao_extra| basis -interface: ezfio, provider - -[ao_extra_cartesian] -type: logical -doc: If |true|, use |ao_extras| in Cartesian coordinates (6d,10f,...) -interface: ezfio, provider -default: false - -[ao_extra_normalized] -type: logical -doc: Use normalized basis functions -interface: ezfio, provider -default: true - -[primitives_normalized_extra] -type: logical -doc: Use normalized primitive functions -interface: ezfio, provider -default: true - -[ao_extra_expo_im] -type: double precision -doc: imag part for Exponents for each primitive of each cGTOs |ao_extra| -size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) -interface: ezfio, provider - -[ao_extra_expo_pw] -type: double precision -doc: plane wave part for each primitive GTOs |ao_extra| -size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) -interface: ezfio, provider - -[ao_extra_expo_phase] -type: double precision -doc: phase shift for each primitive GTOs |ao_extra| -size: (3,ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_prim_num_max) -interface: ezfio, provider - -[ao_extra_one_e_dm] -type: double precision -doc: reduced density matrix on the ao extra basis -size: (ao_extra_basis.ao_extra_num,ao_extra_basis.ao_extra_num,1) -interface: ezfio, provider - -[ao_extra_center] -type: double precision -doc: shift with which the atoms are shifted to mimick p functions -interface: ezfio - diff --git a/plugins/local/ao_extra_basis/LiH.xyz b/plugins/local/ao_extra_basis/LiH.xyz deleted file mode 100644 index 03431803..00000000 --- a/plugins/local/ao_extra_basis/LiH.xyz +++ /dev/null @@ -1,4 +0,0 @@ -2 - -H 0. 0. 0. -Li 0. 0. 1.0 diff --git a/plugins/local/ao_extra_basis/NEED b/plugins/local/ao_extra_basis/NEED deleted file mode 100644 index c4e8c3cf..00000000 --- a/plugins/local/ao_extra_basis/NEED +++ /dev/null @@ -1,3 +0,0 @@ -extra_nuclei -basis -ao_basis diff --git a/plugins/local/ao_extra_basis/README.rst b/plugins/local/ao_extra_basis/README.rst deleted file mode 100644 index f60d71c0..00000000 --- a/plugins/local/ao_extra_basis/README.rst +++ /dev/null @@ -1,15 +0,0 @@ -=========== -extra_basis -=========== - -Plugin to handle an extra basis, which is attached to the extra_nuclei. -It is essentially a duplication of all important quantities (coefficients, exponents and so on) of the usual |AO| basis. - -An interesting feature is the possibility to fit any basis made at most with "p" functions onto a purely "s" basis. -This is done with the various scripts here: - - - qp_fit_1s_basis : script that creates an |EZFIO| folder corresponding to an .xyz file and a basis fitted with only "s" functions - - qp_add_extra_fit_system : script that takes as input an |EZFIO| folder and an .xyz file and add an extra_basis and extra_nuclei with a 1s fitted basis - -Ex: -qp_add_extra_fit_system LiH.ezfio/ h2o.xyz # takes the EZFIO folder "LiH.ezfio" and creates all necessary additional basis and nuclei based on h2o.xyz, but only with 1s functions. diff --git a/plugins/local/ao_extra_basis/aos.irp.f b/plugins/local/ao_extra_basis/aos.irp.f deleted file mode 100644 index 56d6fb04..00000000 --- a/plugins/local/ao_extra_basis/aos.irp.f +++ /dev/null @@ -1,325 +0,0 @@ -BEGIN_PROVIDER [ integer, ao_extra_prim_num_max ] - implicit none - BEGIN_DOC - ! Max number of primitives. - END_DOC - ao_extra_prim_num_max = maxval(ao_extra_prim_num) -END_PROVIDER - -BEGIN_PROVIDER [ integer, ao_extra_shell, (ao_extra_num) ] - implicit none - BEGIN_DOC - ! Index of the shell to which the ao_extra corresponds - END_DOC - integer :: i, j, k, n - k=0 - do i=1,shell_num - n = shell_ang_mom(i)+1 - do j=1,(n*(n+1))/2 - k = k+1 - ao_extra_shell(k) = i - enddo - enddo - -END_PROVIDER - -BEGIN_PROVIDER [ integer, ao_extra_first_of_shell, (shell_num) ] - implicit none - BEGIN_DOC - ! Index of the shell to which the ao_extra corresponds - END_DOC - integer :: i, j, k, n - k=1 - do i=1,shell_num - ao_extra_first_of_shell(i) = k - n = shell_ang_mom(i)+1 - k = k+(n*(n+1))/2 - enddo - -END_PROVIDER - - BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized, (ao_extra_num,ao_extra_prim_num_max) ] -&BEGIN_PROVIDER [ double precision, ao_extra_coef_normalization_factor, (ao_extra_num) ] - implicit none - BEGIN_DOC - ! Coefficients including the |ao_extra| normalization - END_DOC - double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c - integer :: l, powA(3), nz - integer :: i,j,k - nz=100 - C_A(1) = 0.d0 - C_A(2) = 0.d0 - C_A(3) = 0.d0 - ao_extra_coef_normalized = 0.d0 - - do i=1,ao_extra_num - -! powA(1) = ao_extra_power(i,1) + ao_extra_power(i,2) + ao_extra_power(i,3) -! powA(2) = 0 -! powA(3) = 0 - powA(1) = ao_extra_power(i,1) - powA(2) = ao_extra_power(i,2) - powA(3) = ao_extra_power(i,3) - - ! Normalization of the primitives - if (primitives_normalized_extra) then - do j=1,ao_extra_prim_num(i) - call overlap_gaussian_xyz(C_A,C_A,ao_extra_expo(i,j),ao_extra_expo(i,j), & - powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) - ao_extra_coef_normalized(i,j) = ao_extra_coef(i,j)/dsqrt(norm) - enddo - else - do j=1,ao_extra_prim_num(i) - ao_extra_coef_normalized(i,j) = ao_extra_coef(i,j) - enddo - endif - - ! Normalization of the contracted basis functions - if (ao_extra_normalized) then - norm = 0.d0 - do j=1,ao_extra_prim_num(i) - do k=1,ao_extra_prim_num(i) - call overlap_gaussian_xyz(C_A,C_A,ao_extra_expo(i,j),ao_extra_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) - norm = norm+c*ao_extra_coef_normalized(i,j)*ao_extra_coef_normalized(i,k) - enddo - enddo - ao_extra_coef_normalization_factor(i) = 1.d0/dsqrt(norm) - else - ao_extra_coef_normalization_factor(i) = 1.d0 - endif - enddo - -END_PROVIDER - - BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered, (ao_extra_num,ao_extra_prim_num_max) ] -&BEGIN_PROVIDER [ double precision, ao_extra_expo_ordered, (ao_extra_num,ao_extra_prim_num_max) ] - implicit none - BEGIN_DOC - ! Sorted primitives to accelerate 4 index |MO| transformation - END_DOC - - integer :: iorder(ao_extra_prim_num_max) - double precision :: d(ao_extra_prim_num_max,2) - integer :: i,j - do i=1,ao_extra_num - do j=1,ao_extra_prim_num(i) - iorder(j) = j - d(j,1) = ao_extra_expo(i,j) - d(j,2) = ao_extra_coef_normalized(i,j) - enddo - call dsort(d(1,1),iorder,ao_extra_prim_num(i)) - call dset_order(d(1,2),iorder,ao_extra_prim_num(i)) - do j=1,ao_extra_prim_num(i) - ao_extra_expo_ordered(i,j) = d(j,1) - ao_extra_coef_normalized_ordered(i,j) = d(j,2) - enddo - enddo -END_PROVIDER - - -BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered_transp, (ao_extra_prim_num_max,ao_extra_num) ] - implicit none - BEGIN_DOC - ! Transposed :c:data:`ao_extra_coef_normalized_ordered` - END_DOC - integer :: i,j - do j=1, ao_extra_num - do i=1, ao_extra_prim_num_max - ao_extra_coef_normalized_ordered_transp(i,j) = ao_extra_coef_normalized_ordered(j,i) - enddo - enddo - -END_PROVIDER - -BEGIN_PROVIDER [ double precision, ao_extra_expo_ordered_transp, (ao_extra_prim_num_max,ao_extra_num) ] - implicit none - BEGIN_DOC - ! Transposed :c:data:`ao_extra_expo_ordered` - END_DOC - integer :: i,j - do j=1, ao_extra_num - do i=1, ao_extra_prim_num_max - ao_extra_expo_ordered_transp(i,j) = ao_extra_expo_ordered(j,i) - enddo - enddo - -END_PROVIDER - - BEGIN_PROVIDER [ integer, ao_extra_l, (ao_extra_num) ] -&BEGIN_PROVIDER [ integer, ao_extra_l_max ] -&BEGIN_PROVIDER [ character*(128), ao_extra_l_char, (ao_extra_num) ] - implicit none - BEGIN_DOC -! :math:`l` value of the |ao_extra|: :math`a+b+c` in :math:`x^a y^b z^c` - END_DOC - integer :: i - do i=1,ao_extra_num - ao_extra_l(i) = ao_extra_power(i,1) + ao_extra_power(i,2) + ao_extra_power(i,3) - ao_extra_l_char(i) = l_to_character(ao_extra_l(i)) - enddo - ao_extra_l_max = maxval(ao_extra_l) -END_PROVIDER - -integer function ao_extra_power_index(nx,ny,nz) - implicit none - integer, intent(in) :: nx, ny, nz - BEGIN_DOC - ! Unique index given to a triplet of powers: - ! - ! :math:`\frac{1}{2} (l-n_x) (l-n_x+1) + n_z + 1` - END_DOC - integer :: l - l = nx + ny + nz - ao_extra_power_index = ((l-nx)*(l-nx+1))/2 + nz + 1 -end - - - BEGIN_PROVIDER [ integer, Nucl_N_ao_extras, (extra_nucl_num)] -&BEGIN_PROVIDER [ integer, N_ao_extras_max ] - implicit none - BEGIN_DOC - ! Number of |ao_extras| per atom - END_DOC - integer :: i - Nucl_N_ao_extras = 0 - do i = 1, ao_extra_num - Nucl_N_ao_extras(ao_extra_nucl(i)) +=1 - enddo - N_ao_extras_max = maxval(Nucl_N_ao_extras) -END_PROVIDER - - BEGIN_PROVIDER [ integer, Nucl_ao_extras, (extra_nucl_num,N_ao_extras_max)] - implicit none - BEGIN_DOC - ! List of |ao_extras| centered on each atom - END_DOC - integer :: i - integer, allocatable :: nucl_tmp(:) - allocate(nucl_tmp(nucl_num)) - nucl_tmp = 0 - Nucl_ao_extras = 0 - do i = 1, ao_extra_num - nucl_tmp(ao_extra_nucl(i))+=1 - Nucl_ao_extras(ao_extra_nucl(i),nucl_tmp(ao_extra_nucl(i))) = i - enddo - deallocate(nucl_tmp) -END_PROVIDER - - - BEGIN_PROVIDER [ integer, Nucl_list_shell_ao_extras, (extra_nucl_num,N_ao_extras_max)] -&BEGIN_PROVIDER [ integer, Nucl_num_shell_ao_extras, (nucl_num)] - implicit none - integer :: i,j,k - BEGIN_DOC - ! Index of the shell type |ao_extras| and of the corresponding |ao_extras| - ! By convention, for p,d,f and g |ao_extras|, we take the index - ! of the |ao_extra| with the the corresponding power in the x axis - END_DOC - do i = 1, extra_nucl_num - Nucl_num_shell_ao_extras(i) = 0 - do j = 1, Nucl_N_ao_extras(i) - if (ao_extra_power(Nucl_ao_extras(i,j),1) == ao_extra_l(Nucl_ao_extras(i,j))) then - Nucl_num_shell_ao_extras(i)+=1 - Nucl_list_shell_ao_extras(i,Nucl_num_shell_ao_extras(i))=Nucl_ao_extras(i,j) - endif - enddo - enddo - -END_PROVIDER - - -BEGIN_PROVIDER [ character*(4), ao_extra_l_char_space, (ao_extra_num) ] - implicit none - BEGIN_DOC -! Converts an l value to a string - END_DOC - integer :: i - character*(4) :: give_ao_extra_character_space - do i=1,ao_extra_num - - if(ao_extra_l(i)==0)then - ! S type ao_extra - give_ao_extra_character_space = 'S ' - elseif(ao_extra_l(i) == 1)then - ! P type ao_extra - if(ao_extra_power(i,1)==1)then - give_ao_extra_character_space = 'X ' - elseif(ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'Y ' - else - give_ao_extra_character_space = 'Z ' - endif - elseif(ao_extra_l(i) == 2)then - ! D type ao_extra - if(ao_extra_power(i,1)==2)then - give_ao_extra_character_space = 'XX ' - elseif(ao_extra_power(i,2) == 2)then - give_ao_extra_character_space = 'YY ' - elseif(ao_extra_power(i,3) == 2)then - give_ao_extra_character_space = 'ZZ ' - elseif(ao_extra_power(i,1) == 1 .and. ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'XY ' - elseif(ao_extra_power(i,1) == 1 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'XZ ' - else - give_ao_extra_character_space = 'YZ ' - endif - elseif(ao_extra_l(i) == 3)then - ! F type ao_extra - if(ao_extra_power(i,1)==3)then - give_ao_extra_character_space = 'XXX ' - elseif(ao_extra_power(i,2) == 3)then - give_ao_extra_character_space = 'YYY ' - elseif(ao_extra_power(i,3) == 3)then - give_ao_extra_character_space = 'ZZZ ' - elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'XXY ' - elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'XXZ ' - elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,1) == 1)then - give_ao_extra_character_space = 'YYX ' - elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'YYZ ' - elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,1) == 1)then - give_ao_extra_character_space = 'ZZX ' - elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'ZZY ' - elseif(ao_extra_power(i,3) == 1 .and. ao_extra_power(i,2) == 1 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'XYZ ' - endif - elseif(ao_extra_l(i) == 4)then - ! G type ao_extra - if(ao_extra_power(i,1)==4)then - give_ao_extra_character_space = 'XXXX' - elseif(ao_extra_power(i,2) == 4)then - give_ao_extra_character_space = 'YYYY' - elseif(ao_extra_power(i,3) == 4)then - give_ao_extra_character_space = 'ZZZZ' - elseif(ao_extra_power(i,1) == 3 .and. ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'XXXY' - elseif(ao_extra_power(i,1) == 3 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'XXXZ' - elseif(ao_extra_power(i,2) == 3 .and. ao_extra_power(i,1) == 1)then - give_ao_extra_character_space = 'YYYX' - elseif(ao_extra_power(i,2) == 3 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'YYYZ' - elseif(ao_extra_power(i,3) == 3 .and. ao_extra_power(i,1) == 1)then - give_ao_extra_character_space = 'ZZZX' - elseif(ao_extra_power(i,3) == 3 .and. ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'ZZZY' - elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 2)then - give_ao_extra_character_space = 'XXYY' - elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,3) == 2)then - give_ao_extra_character_space = 'YYZZ' - elseif(ao_extra_power(i,1) == 2 .and. ao_extra_power(i,2) == 1 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'XXYZ' - elseif(ao_extra_power(i,2) == 2 .and. ao_extra_power(i,1) == 1 .and. ao_extra_power(i,3) == 1)then - give_ao_extra_character_space = 'YYXZ' - elseif(ao_extra_power(i,3) == 2 .and. ao_extra_power(i,1) == 1 .and. ao_extra_power(i,2) == 1)then - give_ao_extra_character_space = 'ZZXY' - endif - endif - ao_extra_l_char_space(i) = give_ao_extra_character_space - enddo -END_PROVIDER diff --git a/plugins/local/ao_extra_basis/aos_transp.irp.f b/plugins/local/ao_extra_basis/aos_transp.irp.f deleted file mode 100644 index ed34835b..00000000 --- a/plugins/local/ao_extra_basis/aos_transp.irp.f +++ /dev/null @@ -1,68 +0,0 @@ - -! --- - -BEGIN_PROVIDER [ integer, Nucl_ao_extras_transposed, (N_ao_extras_max,nucl_num)] - - BEGIN_DOC - ! List of ao_extras attached on each atom - END_DOC - - implicit none - integer :: i - integer, allocatable :: nucl_tmp(:) - - allocate(nucl_tmp(nucl_num)) - nucl_tmp = 0 - do i = 1, ao_extra_num - nucl_tmp(ao_extra_nucl(i)) += 1 - Nucl_ao_extras_transposed(nucl_tmp(ao_extra_nucl(i)),ao_extra_nucl(i)) = i - enddo - deallocate(nucl_tmp) - -END_PROVIDER - -! --- - -BEGIN_PROVIDER [double precision, ao_extra_expo_ordered_transp_per_nucl, (ao_extra_prim_num_max,N_ao_extras_max,nucl_num) ] - implicit none - integer :: i,j,k,l - do i = 1, nucl_num - do j = 1,Nucl_N_ao_extras(i) - k = Nucl_ao_extras_transposed(j,i) - do l = 1, ao_extra_prim_num(k) - ao_extra_expo_ordered_transp_per_nucl(l,j,i) = ao_extra_expo_ordered_transp(l,k) - enddo - enddo - enddo - -END_PROVIDER - - -BEGIN_PROVIDER [ integer, ao_extra_power_ordered_transp_per_nucl, (3,N_ao_extras_max,nucl_num) ] - implicit none - integer :: i,j,k,l - do i = 1, nucl_num - do j = 1,Nucl_N_ao_extras(i) - k = Nucl_ao_extras_transposed(j,i) - do l = 1, 3 - ao_extra_power_ordered_transp_per_nucl(l,j,i) = ao_extra_power(k,l) - enddo - enddo - enddo - -END_PROVIDER - -BEGIN_PROVIDER [ double precision, ao_extra_coef_normalized_ordered_transp_per_nucl, (ao_extra_prim_num_max,N_ao_extras_max,nucl_num) ] - implicit none - integer :: i,j,k,l - do i = 1, nucl_num - do j = 1,Nucl_N_ao_extras(i) - k = Nucl_ao_extras_transposed(j,i) - do l = 1, ao_extra_prim_num(k) - ao_extra_coef_normalized_ordered_transp_per_nucl(l,j,i) = ao_extra_coef_normalized_ordered_transp(l,k) - enddo - enddo - enddo - -END_PROVIDER - diff --git a/plugins/local/ao_extra_basis/density_extra.irp.f b/plugins/local/ao_extra_basis/density_extra.irp.f deleted file mode 100644 index fa215466..00000000 --- a/plugins/local/ao_extra_basis/density_extra.irp.f +++ /dev/null @@ -1,87 +0,0 @@ -BEGIN_PROVIDER [ double precision, effective_ao_extra_dm, (ao_extra_num, ao_extra_num)] - implicit none - BEGIN_DOC - ! effective density matrix : rho_pq x N_p x N_q x E_pq x (pi/gamma_pq)^3/2 - ! - ! where rho_pq is the usual density matrix - ! - ! N_p and N_q are the normalization factors associated with the two Gaussians - ! - ! E_pq is the prefactor resulting from the Gaussian product - ! - ! gamma_pq = gamma_p + gamm_q - END_DOC - integer :: i,j - do i = 1, ao_extra_num - do j = 1, ao_extra_num - effective_ao_extra_dm(j,i) = ao_extra_one_e_dm(j,i,1) * ao_extra_coef_normalized(j,1) * ao_extra_coef_normalized(i,1) & - * inv_pi_gamma_pq_3_2_ao_extra(j,i) * E_pq_ao_extra(j,i) - enddo - enddo - -END_PROVIDER - - BEGIN_PROVIDER [ double precision, gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] -&BEGIN_PROVIDER [ double precision, inv_gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] -&BEGIN_PROVIDER [ double precision, inv_pi_gamma_pq_3_2_ao_extra, (ao_extra_num,ao_extra_num)] -&BEGIN_PROVIDER [ double precision, sqrt_gamma_pq_ao_extra, (ao_extra_num,ao_extra_num)] - implicit none - BEGIN_DOC - ! gamma_pq_ao_extra = gamma_p + gamma_q - ! - ! inv_gamma_pq_ao_extra = 1/(gamma_p + gamma_q) - ! - ! sqrt_gamma_pq_ao_extra = sqrt(gamma_p + gamma_q) - ! - ! WARNING :: VALID ONLY IN THE CASE OF A PURELY 1S BASIS - END_DOC - include 'constants.include.F' - integer :: i,j - do i = 1, ao_extra_num - do j = 1, ao_extra_num - gamma_pq_ao_extra(j,i) = ao_extra_expo(j,1) + ao_extra_expo(i,1) - inv_gamma_pq_ao_extra(j,i) = 1.d0/gamma_pq_ao_extra(j,i) - sqrt_gamma_pq_ao_extra(j,i) = dsqrt(gamma_pq_ao_extra(j,i)) - inv_pi_gamma_pq_3_2_ao_extra(j,i) = (pi * inv_gamma_pq_ao_extra(j,i))**(1.5d0) - enddo - enddo -END_PROVIDER - -BEGIN_PROVIDER [ double precision, E_pq_ao_extra, (ao_extra_num,ao_extra_num)] - implicit none - BEGIN_DOC - ! E_pq_ao_extra = exp(-alpha_p alpha_q/gamma_pq (Q_p - Q_q)^2) - END_DOC - integer :: i,j - do i = 1, ao_extra_num - do j = 1, ao_extra_num - E_pq_ao_extra(j,i) = dexp(-ao_extra_center_1s_dist(j,i)**2 * ao_extra_expo(j,1)*ao_extra_expo(i,1)*inv_gamma_pq_ao_extra(j,i)) - enddo - enddo - -END_PROVIDER - -BEGIN_PROVIDER [ double precision, ao_extra_center_1s, (3,ao_extra_num)] - implicit none - BEGIN_DOC - ! Original position of each extra AO - END_DOC - integer :: i,i_nucl - do i = 1, ao_extra_num - i_nucl= ao_extra_nucl(i) - ao_extra_center_1s(1:3,i) = extra_nucl_coord(i_nucl,1:3) - enddo -END_PROVIDER - -BEGIN_PROVIDER [ double precision, ao_extra_center_1s_dist, (ao_extra_num,ao_extra_num)] - implicit none - integer :: i,j - do i = 1, ao_extra_num - do j = 1, ao_extra_num - ao_extra_center_1s_dist(j,i) = (ao_extra_center_1s(1,j) - ao_extra_center_1s(1,i))**2 & - + (ao_extra_center_1s(2,j) - ao_extra_center_1s(2,i))**2 & - + (ao_extra_center_1s(3,j) - ao_extra_center_1s(3,i))**2 - ao_extra_center_1s_dist(j,i)=dsqrt(ao_extra_center_1s_dist(j,i)) - enddo - enddo -END_PROVIDER diff --git a/plugins/local/ao_extra_basis/dimensions_integrals.irp.f b/plugins/local/ao_extra_basis/dimensions_integrals.irp.f deleted file mode 100644 index 80dcda18..00000000 --- a/plugins/local/ao_extra_basis/dimensions_integrals.irp.f +++ /dev/null @@ -1,19 +0,0 @@ - BEGIN_PROVIDER [ integer, n_pt_max_extra_basis_integrals ] -&BEGIN_PROVIDER [ integer, n_pt_max_extra_basis_i_x] - implicit none - BEGIN_DOC -! Number of points used in the numerical integrations. - END_DOC - integer :: n_pt_sup - integer :: prim_power_l_max - include 'utils/constants.include.F' - prim_power_l_max = maxval(ao_extra_power) - n_pt_max_extra_basis_integrals = 24 * prim_power_l_max + 4 - n_pt_max_extra_basis_i_x = 8 * prim_power_l_max - ASSERT (n_pt_max_extra_basis_i_x-1 <= max_dim) - if (n_pt_max_extra_basis_i_x-1 > max_dim) then - print *, 'Increase max_dim in utils/constants.include.F to ', n_pt_max_extra_basis_i_x-1 - stop 1 - endif -END_PROVIDER - diff --git a/plugins/local/ao_extra_basis/extra_basis.irp.f b/plugins/local/ao_extra_basis/extra_basis.irp.f deleted file mode 100644 index 9773af2f..00000000 --- a/plugins/local/ao_extra_basis/extra_basis.irp.f +++ /dev/null @@ -1,16 +0,0 @@ -program extra_basis - implicit none - BEGIN_DOC -! TODO : Put the documentation of the program here - END_DOC - integer :: i - print*,'extra_nucl_num = ',extra_nucl_num - do i = 1, extra_nucl_num - print*,'i = ',i - print*,'extra_nucl_label = ',extra_nucl_label(i) - print*,'extra_nucl_charge = ',extra_nucl_charge(i) - print*,'extra_nucl_coord = ' - print*,extra_nucl_coord(i,1:3) - enddo - print*,ao_extra_num -end diff --git a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f b/plugins/local/ao_extra_basis/fit_1s_basis.irp.f deleted file mode 100644 index ef09d5b2..00000000 --- a/plugins/local/ao_extra_basis/fit_1s_basis.irp.f +++ /dev/null @@ -1,41 +0,0 @@ -program fit_1s_basis - implicit none - provide lmax_too_big - integer :: i,j - print*,'////////////////////////////////////////////////////' - print*,'////////////////////////////////////////////////////' - print*,'Fitting the original basis set on uncontracted s only functions ' - print*,'WARNING :: works for now with only P functions at most !!' - print*,'WARNING :: otherwise it will stop ' - print*,'Writting the results in the extra_nuclei and ao_extra_basis folders of EZFIO' - print*,'New number of atomic functions : ' - print*,'n_func_tot = ',n_func_tot - - print*,'extra_fictious_nucl = ',extra_fictious_nucl - do i = 1, extra_fictious_nucl - print*,list_fict_nucl(i) - enddo - print*,'' - print*,'' - do i = 1, nucl_num - print*,list_real_nucl(i) - enddo - call ezfio_set_extra_nuclei_extra_nucl_num(new_nucl_num) - call ezfio_set_extra_nuclei_extra_nucl_fictious_num(extra_fictious_nucl) - call ezfio_set_extra_nuclei_extra_nucl_real_num(nucl_num) - call ezfio_set_extra_nuclei_extra_nucl_fictious_list(list_fict_nucl) - call ezfio_set_extra_nuclei_extra_nucl_real_list(list_real_nucl) - call ezfio_set_extra_nuclei_extra_nucl_real_fictious_list(extra_nucl_real_fictious_list_prov) - call ezfio_set_extra_nuclei_extra_nucl_charge(new_nucl_charge_1s) - call ezfio_set_extra_nuclei_extra_nucl_coord(new_nucl_coord_1s) - call ezfio_set_extra_nuclei_extra_nucl_label(new_nucl_label_1s) -! - call ezfio_set_ao_extra_basis_ao_extra_num(n_func_tot) - call ezfio_set_ao_extra_basis_ao_extra_center(ao_extra_center) - call ezfio_set_ao_extra_basis_ao_extra_nucl(new_ao_nucl_1s) - call ezfio_set_ao_extra_basis_ao_extra_prim_num(new_ao_prim_num_1s) - call ezfio_set_ao_extra_basis_ao_extra_coef(new_ao_coef_1s) - call ezfio_set_ao_extra_basis_ao_extra_expo(new_ao_expo_1s) - call ezfio_set_ao_extra_basis_ao_extra_power(new_ao_power_1s) -end - diff --git a/plugins/local/ao_extra_basis/h2o.xyz b/plugins/local/ao_extra_basis/h2o.xyz deleted file mode 100644 index d3928214..00000000 --- a/plugins/local/ao_extra_basis/h2o.xyz +++ /dev/null @@ -1,7 +0,0 @@ -3 - -O 0.000000 -0.399441 3.000000 -H 0.761232 0.199721 3.000000 -H -0.761232 0.199721 3.000000 - - diff --git a/plugins/local/ao_extra_basis/install b/plugins/local/ao_extra_basis/install deleted file mode 100755 index e7e668e1..00000000 --- a/plugins/local/ao_extra_basis/install +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Check if the QP_ROOT environment variable is set. -if [[ -z ${QP_ROOT} ]] -then - print "The QP_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." - exit -1 -fi - -# Get the absolute path of the current directory. -currdir=${PWD} - -# list of the scripts to be used by the module -scripts_list="qp_copy_extra_basis qp_add_extra_fit_system qp_copy_extra_basis_to_usual_basis qp_fit_1s_basis" - -# Make a symbolic link for all scripts to be used in the ${QP_ROOT}/scripts/ -# directory. - for i in $scripts_list - do - ln --symbolic ${currdir}/$i ${QP_ROOT}/scripts/ - done - diff --git a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f b/plugins/local/ao_extra_basis/prov_fit_1s.irp.f deleted file mode 100644 index 99a18a6b..00000000 --- a/plugins/local/ao_extra_basis/prov_fit_1s.irp.f +++ /dev/null @@ -1,266 +0,0 @@ -BEGIN_PROVIDER [ double precision, ao_extra_center] - implicit none - ao_extra_center = 0.01d0 -END_PROVIDER - - BEGIN_PROVIDER [ integer, n_func_tot] - implicit none - BEGIN_DOC - ! n_func_tot :: total number of functions in the fitted basis set - ! - ! returned in an uncontracted way - END_DOC - integer :: i,prefact - n_func_tot = 0 - print*,'n_func_tot ' - do i = 1, ao_num - if(ao_l(i) == 0)then - prefact = 1 ! s functions - else - ! p functions are fitted with 2 functions - ! d functions are fitted with 4 functions etc ... - prefact=2*ao_l(i) - endif - n_func_tot += prefact * ao_prim_num(i) - enddo -END_PROVIDER - -BEGIN_PROVIDER [ integer, n_prim_tot_orig] - implicit none - integer :: i - n_prim_tot_orig = 0 - do i = 1, ao_num - n_prim_tot_orig += ao_prim_num(i) - enddo -END_PROVIDER - - -BEGIN_PROVIDER [ logical, lmax_too_big] - implicit none - if (ao_l_max.gt.1)then - lmax_too_big = .True. - else - lmax_too_big = .False. - endif - if(lmax_too_big)then - print*,'STOPPING !! lmax is larger than 1 !' - print*,'Cannot yet fit with 1s functions ...' - stop - endif -END_PROVIDER - - BEGIN_PROVIDER [ integer, n_2p_func_orig] -&BEGIN_PROVIDER [ integer, n_2p_func_tot] - implicit none - integer :: i - BEGIN_DOC - ! n_2p_func_orig :: number of 2p functions in the original basis - ! - ! n_2p_func_tot :: total number of p functions in the fitted basis - END_DOC - n_2p_func_orig= 0 - n_2p_func_tot = 0 - do i = 1, ao_num - if(ao_l(i)==1)then - n_2p_func_orig+= 1 - n_2p_func_tot += ao_prim_num(i) * 2 - endif - enddo - print*,'n_2p_func_tot = ',n_2p_func_tot -END_PROVIDER - -BEGIN_PROVIDER [ integer, list_2p_functions, (n_2p_func_orig)] - implicit none - BEGIN_DOC - ! list of 2p functions in the original basis - END_DOC - integer :: i,j - j=0 - do i = 1, ao_num - if(ao_l(i)==1)then - j+=1 - list_2p_functions(j) = i - endif - enddo -END_PROVIDER - -BEGIN_PROVIDER [ integer, extra_fictious_nucl] - implicit none - extra_fictious_nucl = n_2p_func_tot -END_PROVIDER - -BEGIN_PROVIDER [ integer, new_nucl_num] - implicit none - new_nucl_num = nucl_num + n_2p_func_tot - print*,'new_nucl_num = ',new_nucl_num -END_PROVIDER - - BEGIN_PROVIDER [ character*(32), new_nucl_label_1s , (new_nucl_num) ] -&BEGIN_PROVIDER [ integer, list_real_nucl, (nucl_num) ] -&BEGIN_PROVIDER [ integer, list_fict_nucl, (extra_fictious_nucl) ] - implicit none - integer :: i,j - do i = 1, nucl_num - new_nucl_label_1s(i) = nucl_label(i) - list_real_nucl(i) = i - enddo - j=0 - do i = nucl_num+1,new_nucl_num - j+=1 - new_nucl_label_1s(i) = "X" - list_fict_nucl(j) = i - enddo -END_PROVIDER - - BEGIN_PROVIDER [ double precision, new_nucl_coord_1s, (new_nucl_num,3)] - implicit none - integer :: i,j - do i = 1, new_nucl_num - new_nucl_coord_1s(i,1:3) = new_nucl_coord_1s_transp(1:3,i) - enddo - END_PROVIDER - - BEGIN_PROVIDER [ double precision, new_nucl_coord_1s_transp, (3,new_nucl_num)] -&BEGIN_PROVIDER [ double precision, new_nucl_charge_1s, (new_nucl_num)] -&BEGIN_PROVIDER [ integer, extra_nucl_real_fictious_list_prov, (extra_fictious_nucl)] - implicit none - BEGIN_DOC -! the real atoms are located in the first nucl_num entries -! -! then the fictious atoms are located after - END_DOC - integer :: i,ii,j,i_ao,k,n_ao - integer :: return_xyz_int,power(3),good_i - new_nucl_charge_1s = 0.d0 - do i = 1, nucl_num - new_nucl_coord_1s_transp(1:3,i) = nucl_coord_transp(1:3,i) - new_nucl_charge_1s(i) = nucl_charge(i) - enddo - k = nucl_num - do i = 1, nucl_num - do ii = 1, Nucl_N_Aos(i) - i_ao = nucl_aos_transposed(ii,i) - if(ao_l(i_ao)==1)then - ! split the function into 2 s functions - ! one is centered in R_x + d - power(1:3) = ao_power(i_ao,1:3) - good_i = return_xyz_int(power) - do j = 1, ao_prim_num(i_ao) - k+=1 - new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) - new_nucl_coord_1s_transp(good_i,k)+= ao_extra_center - new_nucl_charge_1s(k) = 0.d0 - extra_nucl_real_fictious_list_prov(k-nucl_num)=i - k+=1 - ! one is centered in R_x - d - new_nucl_coord_1s_transp(1:3,k)= nucl_coord_transp(1:3,i) - new_nucl_coord_1s_transp(good_i,k)-= ao_extra_center - new_nucl_charge_1s(k) = 0.d0 - extra_nucl_real_fictious_list_prov(k-nucl_num)=i - enddo - else if(ao_l(i_ao).gt.1)then - print*,'WARNING ! Lmax value not implemented yet !' - print*,'stopping ...' - stop - endif - enddo - enddo - -END_PROVIDER - - BEGIN_PROVIDER [ integer, new_n_AOs_max] - implicit none - new_n_AOs_max = ao_prim_num_max * n_AOs_max - - END_PROVIDER - - - BEGIN_PROVIDER [ integer, new_Nucl_N_Aos, (new_nucl_num)] -&BEGIN_PROVIDER [ integer, new_nucl_aos_transposed, (new_n_AOs_max,new_nucl_num) ] -&BEGIN_PROVIDER [ double precision, new_ao_expo_1s , (n_func_tot) ] -&BEGIN_PROVIDER [ integer, new_ao_nucl_1s, (n_func_tot)] - implicit none - integer :: i,j,ii,i_ao,n_func,n_func_total,n_nucl - double precision :: coef - n_func_total = 0 - do i = 1, nucl_num - n_func = 0 - do ii = 1, Nucl_N_Aos(i) - i_ao = nucl_aos_transposed(ii,i) - if(ao_l(i_ao)==0)then - do j = 1, ao_prim_num(i_ao) - coef= ao_expo(i_ao,j) - n_func_total += 1 - n_func +=1 - new_nucl_aos_transposed(n_func,i) = n_func_total - new_ao_expo_1s(n_func_total) = coef - new_ao_nucl_1s(n_func_total) = i - enddo - endif - enddo - new_Nucl_N_Aos(i) = n_func - enddo - n_nucl=nucl_num - do i = 1, nucl_num - do ii = 1, Nucl_N_Aos(i) - i_ao = nucl_aos_transposed(ii,i) - if(ao_l(i_ao)==1)then - do j = 1, ao_prim_num(i_ao) - coef= ao_expo(i_ao,j) - n_func_total+=1 - n_nucl +=1 - new_nucl_aos_transposed(1,n_nucl) = n_func_total - new_ao_expo_1s(n_func_total) = coef - new_Nucl_N_Aos(n_nucl)=1 - new_ao_nucl_1s(n_func_total) = n_nucl - - n_func_total+=1 - n_nucl +=1 - new_nucl_aos_transposed(1,n_nucl) = n_func_total - new_ao_expo_1s(n_func_total) = coef - new_Nucl_N_Aos(n_nucl)=1 - new_ao_nucl_1s(n_func_total) = n_nucl - enddo - endif - enddo - enddo - -END_PROVIDER - -BEGIN_PROVIDER [ double precision, new_ao_coef_1s , (n_func_tot) ] - implicit none - integer :: i - BEGIN_DOC -! Primitive coefficients, read from input. Those should not be used directly, as the MOs are expressed on the basis of **normalized** AOs. - END_DOC - do i = 1, n_func_tot - new_ao_coef_1s(i) = 1.d0 - enddo -END_PROVIDER - -BEGIN_PROVIDER [ integer, new_ao_prim_num_1s, (n_func_tot)] - implicit none - integer :: i - do i = 1, n_func_tot - new_ao_prim_num_1s(i) = 1 - enddo -END_PROVIDER - -BEGIN_PROVIDER [integer, new_ao_power_1s, (n_func_tot,3)] - implicit none - new_ao_power_1s = 0 -END_PROVIDER - -integer function return_xyz_int(power) - implicit none - integer,intent(in) :: power(3) - if(power(1) == 1 .and. power(2) ==0 .and. power(3) ==0)then - return_xyz_int = 1 - else if (power(2) == 1 .and. power(1) ==0 .and. power(3) ==0)then - return_xyz_int = 2 - else if (power(3) == 1 .and. power(1) ==0 .and. power(1) ==0)then - return_xyz_int = 3 - else - return_xyz_int = -1000 - endif -end diff --git a/plugins/local/ao_extra_basis/qp_add_extra_fit_system b/plugins/local/ao_extra_basis/qp_add_extra_fit_system deleted file mode 100755 index dae95062..00000000 --- a/plugins/local/ao_extra_basis/qp_add_extra_fit_system +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# specify the QP folder -QP=$QP_ROOT -dir=${QP} -# sourcing the quantum_package.rc file -. ${QP}/quantum_package.rc -# The main EZFIO folder -main=${1%/} -# The XYZ file containing the geometry of the additional system you want to add -extra=${2%.xyz} -basis_extra=sto-3g -ezfio_extra=${extra}_${basis_extra}_1s -echo $ezfio_extra -qp_fit_1s_basis $extra $basis_extra -qp set_file $ezfio_extra -qp run scf | tee ${ezfio_extra}.scf.out -qp run save_one_e_dm | tee ${ezfio_extra}.one_rdm.out -qp_copy_extra_basis ${ezfio_extra} $main - diff --git a/plugins/local/ao_extra_basis/qp_copy_extra_basis b/plugins/local/ao_extra_basis/qp_copy_extra_basis deleted file mode 100755 index cb435e18..00000000 --- a/plugins/local/ao_extra_basis/qp_copy_extra_basis +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -# specify the QP folder -QP=$QP_ROOT -dir=${QP} -# sourcing the quantum_package.rc file -. ${QP}/quantum_package.rc -# script that copy all data from |AO| basis and nuclei of EZFIO_extra to the ao_extra_basis and extra_nuclei of EZFIO_target -# use: -# qp_copy_extra_basis EZFIO_extra EZFIO_target -EZFIO_extra=${1%/} -EZFIO_extra=${EZFIO_extra%.xyz} -EZFIO_target=${2%/} - - - -echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" -echo "Extracting data from "$EZFIO_extra -echo "and Copying data to "$EZFIO_target - -### COPYING ALL DATA FROM $EZFIO_extra/nuclei/ to ${EZFIO_target}/extra_nuclei/ -echo "COPYING ALL DATA FROM "$EZFIO_extra"/nuclei/ to "${EZFIO_target}"/extra_nuclei/" -direxists=false -if [ -d ${EZFIO_target}/extra_nuclei/ ] ; then - direxists=true - echo "The directory extra_nuclei exists" - else - echo "Creating the directory extra_nuclei " - direxists=false - mkdir ${EZFIO_target}/extra_nuclei/ -fi -data=`\ls $EZFIO_extra/nuclei/` -for i in $data -do - echo $i - newfile=`echo $i | sed 's/nucl/extra_nucl/g' ` - echo $newfile - cp ${EZFIO_extra}/nuclei/$i ${EZFIO_target}/extra_nuclei/$newfile -done - -### COPYING ALL DATA FROM $EZFIO_extra/ao_basis/ to ${EZFIO_target}/ao_extra_basis/ -direxists=false -if [ -d ${EZFIO_target}/ao_extra_basis/ ] ; then - direxists=true - echo "The directory exists ao_extra_basis" - else - echo "Creating the directory ao_extra_basis" - direxists=false - mkdir ${EZFIO_target}/ao_extra_basis/ -fi -echo "COPYING ALL DATA FROM "$EZFIO_extra"/ao_basis/ to "${EZFIO_target}"/ao_extra_basis/" -data=`\ls $EZFIO_extra/ao_basis/` -for i in $data -do - echo $i - newfile=`echo $i | sed 's/ao/ao_extra/g' ` - echo $newfile - cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile -done -i=primitives_normalized -newfile=primitives_normalized_extra -cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile - -echo "COPYING ALL DATA FROM "$EZFIO_extra"/aux_quantities/ to "${EZFIO_target}"/ao_extra_basis/" -i=data_one_e_dm_tot_ao.gz -newfile=ao_extra_one_e_dm.gz -cp ${EZFIO_extra}/aux_quantities/$i ${EZFIO_target}/ao_extra_basis/$newfile - diff --git a/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis b/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis deleted file mode 100755 index ba7e6a71..00000000 --- a/plugins/local/ao_extra_basis/qp_copy_extra_basis_to_usual_basis +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# specify the QP folder -# script that copy all data in ao_extra_basis and extra_nuclei and copy it to ao_basis and ao_nuclei -QP=$QP_ROOT -dir=${QP} -# sourcing the quantum_package.rc file -. ${QP}/quantum_package.rc -EZFIO_extra=${1%/} -EZFIO_target=${2%/} - - - -echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" -echo "Extracting data from "$EZFIO_extra -echo "and Copying data to "$EZFIO_target - -### COPYING ALL DATA FROM $EZFIO_extra/nuclei/ to ${EZFIO_target}/extra_nuclei/ -echo "COPYING ALL DATA FROM "$EZFIO_extra"/extra_nuclei/ to "${EZFIO_target}"/nuclei/" -direxists=false -if [ -d ${EZFIO_target}/extra_nuclei/ ] ; then - direxists=true - echo "The directory extra_nuclei exists" - else - echo "PB !!" - direxists=false - mkdir ${EZFIO_target}/extra_nuclei/ -fi -data=`\ls $EZFIO_extra/extra_nuclei/` -for i in $data -do - echo $i - newfile=`echo $i | sed 's/extra_nucl/nucl/g' ` - echo $newfile - cp ${EZFIO_extra}/extra_nuclei/$i ${EZFIO_target}/nuclei/$newfile -done - -### COPYING ALL DATA FROM $EZFIO_extra/ao_basis/ to ${EZFIO_target}/ao_extra_basis/ -direxists=false -if [ -d ${EZFIO_target}/ao_extra_basis/ ] ; then - direxists=true - echo "The directory exists ao_extra_basis" - else - echo "PB !!" - direxists=false - mkdir ${EZFIO_target}/ao_extra_basis/ -fi -echo "COPYING ALL DATA FROM "$EZFIO_extra"/ao_basis/ to "${EZFIO_target}"/ao_extra_basis/" -data=`\ls $EZFIO_extra/ao_extra_basis/` -for i in $data -do - echo $i - newfile=`echo $i | sed 's/ao_extra/ao/g' ` - echo $newfile - cp ${EZFIO_extra}/ao_extra_basis/$i ${EZFIO_target}/ao_basis/$newfile -done - - diff --git a/plugins/local/ao_extra_basis/qp_fit_1s_basis b/plugins/local/ao_extra_basis/qp_fit_1s_basis deleted file mode 100755 index 366e478a..00000000 --- a/plugins/local/ao_extra_basis/qp_fit_1s_basis +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -## Takes as an argument an xyz file and a basis, and fit the AO basis onto an "s" basis only -## use: -# qp_fit_1s_basis my_xyz_file.xyz basis -source ~/qp2/quantum_package.rc -input=${1%.xyz} -basis=$2 -ezfio_fit=${input}_${basis}_1s -qp create_ezfio -b $basis $input.xyz -o $ezfio_fit -# Fitting the original basis on 1s only basis functions -qp run fit_1s_basis |tee ${ezfio_fit}.fit_1s.out -qp_copy_extra_basis_to_usual_basis $ezfio_fit $ezfio_fit diff --git a/plugins/local/ao_extra_basis/transform_basis.irp.f b/plugins/local/ao_extra_basis/transform_basis.irp.f deleted file mode 100644 index 374d2dfc..00000000 --- a/plugins/local/ao_extra_basis/transform_basis.irp.f +++ /dev/null @@ -1,49 +0,0 @@ -subroutine rotate_nuclei(phi,theta,psi,nucl_centers,n_nucl,nucl_centers_after) - implicit none - BEGIN_DOC - ! routine that rotates a set of nuclei according to three axis corresponding to angles phi, theta, psi. - END_DOC - double precision, intent(in) :: phi,theta,psi - double precision, intent(in) :: nucl_centers(3,n_nucl) - integer, intent(in) :: n_nucl - double precision, intent(out):: nucl_centers_after(3,n_nucl) - double precision :: r_mat(3,3) - call r_phi_theta_psi_matrix(phi,theta,psi,r_mat) - call get_AB_prod(r_mat,3,3,nucl_centers,n_nucl,nucl_centers_after) - -end - - -subroutine r_phi_theta_psi_matrix(phi,theta,psi,r_mat) - implicit none - BEGIN_DOC - ! routine that creates the rotation matrix corresponding to phi,theta,psi - ! - ! according to conventions in MDFT code - END_DOC - double precision, intent(in) :: phi,theta,psi - double precision, intent(out):: r_mat(3,3) - double precision :: ctheta, stheta - double precision :: cphi , sphi - double precision :: cpsi , spsi - ctheta = dcos(theta) - cphi = dcos(phi) - cpsi = dcos(psi) - - stheta = dsin(theta) - sphi = dsin(phi) - spsi = dsin(psi) - - r_mat(1,1) = ctheta*cphi*cpsi-sphi*spsi - r_mat(1,2) = -ctheta*cphi*spsi-sphi*cpsi - r_mat(1,3) = stheta*cphi - - r_mat(2,1) = ctheta*sphi*cpsi+cphi*spsi - r_mat(2,2) = -ctheta*sphi*spsi+cphi*cpsi - r_mat(2,3) = stheta*sphi - - r_mat(3,1) = -stheta*cpsi - r_mat(3,2) = stheta*spsi - r_mat(3,3) = ctheta - -end diff --git a/plugins/local/ao_extra_basis/uninstall b/plugins/local/ao_extra_basis/uninstall deleted file mode 100755 index 0e4cd253..00000000 --- a/plugins/local/ao_extra_basis/uninstall +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Check if the QP_ROOT environment variable is set. -if [[ -z ${QP_ROOT} ]] -then - print "The QP_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." - exit -1 -fi - -# list of the scripts to be used by the module -scripts_list="qp_copy_extra_basis qp_add_extra_fit_system qp_copy_extra_basis_to_usual_basis qp_fit_1s_basis" - -# Destroy ONLY the symbolic link for the scripts to be used in the -# ${QP_ROOT}/scripts/ directory. - for i in $scripts_list - do - find ${QP_ROOT}/scripts/$i -type l -delete - done - diff --git a/plugins/local/extra_nuclei/EZFIO.cfg b/plugins/local/extra_nuclei/EZFIO.cfg deleted file mode 100644 index 8c04b4c7..00000000 --- a/plugins/local/extra_nuclei/EZFIO.cfg +++ /dev/null @@ -1,56 +0,0 @@ -[extra_nucl_num] -doc: Number of nuclei -type: integer -interface: ezfio, provider - -[extra_nucl_pouet] -doc: Number of nuclei -type: integer -interface: ezfio, provider, ocaml -default:1 - -[extra_nucl_label] -doc: Nuclear labels -type: character*(32) -size: (extra_nuclei.extra_nucl_num) -interface: ezfio, provider - -[extra_nucl_charge] -doc: Nuclear charges -type:double precision -size: (extra_nuclei.extra_nucl_num) -interface: ezfio, provider - -[extra_nucl_coord] -doc: Nuclear coordinates in the format (:, {x,y,z}) -type: double precision -size: (extra_nuclei.extra_nucl_num,3) -interface: ezfio - -[extra_nucl_real_num] -doc: Number of real nuclei -type: integer -interface: ezfio, provider - -[extra_nucl_fictious_num] -doc: Number of fictious nuclei -type: integer -interface: ezfio, provider - -[extra_nucl_real_fictious_list] -doc: List of real nuclei to which fictious nuclei are attached to -type: integer -size: (extra_nuclei.extra_nucl_fictious_num) -interface: ezfio, provider - -[extra_nucl_fictious_list] -doc: List of fictious nuclei -type: integer -size: (extra_nuclei.extra_nucl_fictious_num) -interface: ezfio, provider - -[extra_nucl_real_list] -doc: List of real nuclei -type: integer -size: (extra_nuclei.extra_nucl_real_num) -interface: ezfio, provider diff --git a/plugins/local/extra_nuclei/NEED b/plugins/local/extra_nuclei/NEED deleted file mode 100644 index 0dc19a80..00000000 --- a/plugins/local/extra_nuclei/NEED +++ /dev/null @@ -1,3 +0,0 @@ -ezfio_files -utils -nuclei diff --git a/plugins/local/extra_nuclei/README.rst b/plugins/local/extra_nuclei/README.rst deleted file mode 100644 index 6bb260a0..00000000 --- a/plugins/local/extra_nuclei/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -============ -extra_nuclei -============ - diff --git a/plugins/local/extra_nuclei/extra_nuclei.irp.f b/plugins/local/extra_nuclei/extra_nuclei.irp.f deleted file mode 100644 index 53653e8d..00000000 --- a/plugins/local/extra_nuclei/extra_nuclei.irp.f +++ /dev/null @@ -1,7 +0,0 @@ -program extra_nuclei - implicit none - BEGIN_DOC -! TODO : Put the documentation of the program here - END_DOC - print *, 'Hello world' -end diff --git a/plugins/local/extra_nuclei/nuclei.irp.f b/plugins/local/extra_nuclei/nuclei.irp.f deleted file mode 100644 index d8ea57f2..00000000 --- a/plugins/local/extra_nuclei/nuclei.irp.f +++ /dev/null @@ -1,138 +0,0 @@ -BEGIN_PROVIDER [ double precision, extra_nucl_coord, (extra_nucl_num,3) ] - implicit none - - BEGIN_DOC - ! Nuclear coordinates in the format (:, {x,y,z}) - END_DOC - PROVIDE ezfio_filename extra_nucl_label extra_nucl_charge - - if (mpi_master) then - double precision, allocatable :: buffer(:,:) - extra_nucl_coord = 0.d0 - allocate (buffer(extra_nucl_num,3)) - buffer = 0.d0 - logical :: has - call ezfio_has_extra_nuclei_extra_nucl_coord(has) - if (.not.has) then - print *, irp_here - stop 1 - endif - call ezfio_get_extra_nuclei_extra_nucl_coord(buffer) - integer :: i,j - - do i=1,3 - do j=1,extra_nucl_num - extra_nucl_coord(j,i) = buffer(j,i) - enddo - enddo - deallocate(buffer) - - character*(64), parameter :: f = '(A16, 4(1X,F12.6))' - character*(64), parameter :: ft= '(A16, 4(1X,A12 ))' - double precision, parameter :: a0= 0.529177249d0 - - call write_time(6) - write(6,'(A)') '' - write(6,'(A)') 'Extra Nuclear Coordinates (Angstroms)' - write(6,'(A)') '=====================================' - write(6,'(A)') '' - write(6,ft) & - '================','============','============','============','============' - write(6,*) & - ' Atom Charge X Y Z ' - write(6,ft) & - '================','============','============','============','============' - - do i=1,extra_nucl_num - write(6,f) extra_nucl_label(i), extra_nucl_charge(i), & - extra_nucl_coord(i,1)*a0, & - extra_nucl_coord(i,2)*a0, & - extra_nucl_coord(i,3)*a0 - enddo - write(6,ft) & - '================','============','============','============','============' - write(6,'(A)') '' - - if (extra_nucl_num > 1) then - double precision :: dist_min, x, y, z - dist_min = huge(1.d0) - do i=1,extra_nucl_num - do j=i+1,extra_nucl_num - x = extra_nucl_coord(i,1)-extra_nucl_coord(j,1) - y = extra_nucl_coord(i,2)-extra_nucl_coord(j,2) - z = extra_nucl_coord(i,3)-extra_nucl_coord(j,3) - dist_min = min(x*x + y*y + z*z, dist_min) - enddo - enddo - write(6,'(A,F12.4,A)') 'Minimal interatomic distance found: ', & - dsqrt(dist_min)*a0,' Angstrom' - endif - - 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' - integer :: ierr - call MPI_BCAST( extra_nucl_coord, 3*extra_nucl_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - if (ierr /= MPI_SUCCESS) then - stop 'Unable to read nucl_coord with MPI' - endif - IRP_ENDIF - -END_PROVIDER - - -BEGIN_PROVIDER [ double precision, extra_nucl_coord_transp, (3,extra_nucl_num) ] - implicit none - BEGIN_DOC - ! Transposed array of extra_nucl_coord - END_DOC - integer :: i, k - extra_nucl_coord_transp = 0.d0 - - do i=1,extra_nucl_num - extra_nucl_coord_transp(1,i) = extra_nucl_coord(i,1) - extra_nucl_coord_transp(2,i) = extra_nucl_coord(i,2) - extra_nucl_coord_transp(3,i) = extra_nucl_coord(i,3) - enddo -END_PROVIDER - -BEGIN_PROVIDER [ double precision, extra_center_of_mass, (3) ] - implicit none - BEGIN_DOC - ! Center of mass of the molecule - END_DOC - integer :: i,j - double precision :: s - extra_center_of_mass(:) = 0.d0 - s = 0.d0 - do i=1,extra_nucl_num - do j=1,3 - extra_center_of_mass(j) += extra_nucl_coord(i,j)* element_mass(int(extra_nucl_charge(i))) - enddo - s += element_mass(int(extra_nucl_charge(i))) - enddo - s = 1.d0/s - extra_center_of_mass(:) = extra_center_of_mass(:)*s -END_PROVIDER - - -BEGIN_PROVIDER [ double precision, extra_nucl_dist, (extra_nucl_num,extra_nucl_num)] - implicit none - integer :: i,j - double precision :: x,y,z - do i = 1, extra_nucl_num - do j = 1, extra_nucl_num - x = extra_nucl_coord(i,1)-extra_nucl_coord(j,1) - y = extra_nucl_coord(i,2)-extra_nucl_coord(j,2) - z = extra_nucl_coord(i,3)-extra_nucl_coord(j,3) - extra_nucl_dist(j,i) = x*x+y*y+z*z - extra_nucl_dist(j,i) = dsqrt(extra_nucl_dist(j,i)) - enddo - enddo - -END_PROVIDER diff --git a/src/mu_of_r/f_psi_i_a_v_utils.irp.f b/src/mu_of_r/f_psi_i_a_v_utils.irp.f index 69fa16ff..6e9d58fd 100644 --- a/src/mu_of_r/f_psi_i_a_v_utils.irp.f +++ b/src/mu_of_r/f_psi_i_a_v_utils.irp.f @@ -122,7 +122,7 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) ! Contracted two-e integrals : intermediate quantity ! v_tilde(i,a) = \sum_{m,n} phi_m(1) * phi_n(2) < i a | m n > - allocate( v_tilde(n_act_orb,n_act_orb) ) + allocate( v_tilde(n_inact_orb,n_act_orb) ) allocate( integrals_array(mo_num,mo_num) ) v_tilde = 0.d0 do a = 1, n_act_orb From 46f11e9dabfb1f89841398f0438ff22b8b9a2eda Mon Sep 17 00:00:00 2001 From: eginer Date: Mon, 30 Dec 2024 15:20:37 +0100 Subject: [PATCH 042/175] removed stupid bug in casscf neworbs --- src/casscf_cipsi/neworbs.irp.f | 3 ++- src/iterations/print_summary.irp.f | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/casscf_cipsi/neworbs.irp.f b/src/casscf_cipsi/neworbs.irp.f index ca2deebb..b44ac065 100644 --- a/src/casscf_cipsi/neworbs.irp.f +++ b/src/casscf_cipsi/neworbs.irp.f @@ -116,7 +116,8 @@ end if end do if(best_vector_ovrlp_casscf.lt.0)then - best_vector_ovrlp_casscf = minloc(SXeigenval,nMonoEx+1) +! best_vector_ovrlp_casscf = minloc(SXeigenval) + best_vector_ovrlp_casscf = 1 endif c0=SXeigenvec(1,best_vector_ovrlp_casscf) if (bavard) then diff --git a/src/iterations/print_summary.irp.f b/src/iterations/print_summary.irp.f index 8e6285e2..3d36d964 100644 --- a/src/iterations/print_summary.irp.f +++ b/src/iterations/print_summary.irp.f @@ -69,7 +69,9 @@ subroutine print_summary(e_,pt2_data,pt2_data_err,n_det_,n_configuration_,n_st,s print *, '< S^2 > = ', s2_(k) print *, 'E = ', e_(k) print *, 'Variance = ', pt2_data % variance(k), ' +/- ', pt2_data_err % variance(k) - print *, 'PT norm = ', dsqrt(pt2_data % overlap(k,k)), ' +/- ', 0.5d0*dsqrt(pt2_data % overlap(k,k)) * pt2_data_err % overlap(k,k) / (pt2_data % overlap(k,k)) + if(dabs(pt2_data % overlap(k,k)).gt.0.d0)then + print *, 'PT norm = ', dsqrt(pt2_data % overlap(k,k)), ' +/- ', 0.5d0*dsqrt(pt2_data % overlap(k,k)) * pt2_data_err % overlap(k,k) / (pt2_data % overlap(k,k)) + endif print *, 'PT2 = ', pt2_data % pt2(k), ' +/- ', pt2_data_err % pt2(k) print *, 'rPT2 = ', pt2_data % rpt2(k), ' +/- ', pt2_data_err % rpt2(k) print *, 'E+PT2 '//pt2_string//' = ', e_(k)+pt2_data % pt2(k), ' +/- ', pt2_data_err % pt2(k) From ebce2854e99df01cc09119f822d0a208cdee1243 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 15 Jan 2025 10:45:44 +0100 Subject: [PATCH 043/175] removed free from grid_becke_vector --- src/becke_numerical_grid/example.irp.f | 1 + src/becke_numerical_grid/grid_becke_vector.irp.f | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/becke_numerical_grid/example.irp.f b/src/becke_numerical_grid/example.irp.f index d91e1bc9..b9238fef 100644 --- a/src/becke_numerical_grid/example.irp.f +++ b/src/becke_numerical_grid/example.irp.f @@ -50,6 +50,7 @@ subroutine example_becke_numerical_grid print*,'The second example uses the grid points as a collection of spherical grids centered on each atom' print*,'This is mostly useful if one needs to split contributions between radial/angular/atomic of an integral' ! you browse the nuclei + integral_2 = 0.d0 do i = 1, nucl_num ! you browse the radial points attached to each nucleus do j = 1, n_points_radial_grid diff --git a/src/becke_numerical_grid/grid_becke_vector.irp.f b/src/becke_numerical_grid/grid_becke_vector.irp.f index 9da8a099..f696b023 100644 --- a/src/becke_numerical_grid/grid_becke_vector.irp.f +++ b/src/becke_numerical_grid/grid_becke_vector.irp.f @@ -71,8 +71,8 @@ enddo enddo - FREE grid_points_per_atom - FREE final_weight_at_r +! FREE grid_points_per_atom +! FREE final_weight_at_r call wall_time(wall1) print *, ' wall time for final_grid_points,', wall1 - wall0 From b0191f2c72a3053abb6a9df644ea97274f3d11ae Mon Sep 17 00:00:00 2001 From: Yann Damour <77277447+Ydrnan@users.noreply.github.com> Date: Fri, 17 Jan 2025 04:24:27 +0100 Subject: [PATCH 044/175] Update qp_import_trexio.py If True the export under trexio format followed by the import under trexio format leads to a wrong energy --- scripts/qp_import_trexio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 630ffb5e..fc76f8de 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -195,7 +195,7 @@ def write_ezfio(trexio_filename, filename): prim_factor = trexio.read_basis_prim_factor(trexio_file) for i,p in enumerate(prim_factor): coefficient[i] *= prim_factor[i] - ezfio.set_ao_basis_primitives_normalized(True) + ezfio.set_ao_basis_primitives_normalized(False) ezfio.set_basis_prim_coef(coefficient) elif basis_type.lower() == "numerical": From 09f6d338e88dfc66ecb598f1c719322c6ca3ca22 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 20 Jan 2025 17:56:13 +0100 Subject: [PATCH 045/175] provide all_mo_integrals --- src/davidson/diagonalization_h_dressed.irp.f | 2 +- .../diagonalization_hcsf_dressed.irp.f | 2 +- .../diagonalization_hs2_dressed.irp.f | 2 +- .../diagonalization_nonsym_h_dressed.irp.f | 2 +- src/determinants/h_apply_nozmq.template.f | 2 +- src/determinants/slater_rules.irp.f | 12 ++++----- src/determinants/slater_rules_wee_mono.irp.f | 4 +-- src/determinants/utils.irp.f | 9 +++---- src/mo_two_e_ints/map_integrals.irp.f | 25 ++++++++++++++----- 9 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/davidson/diagonalization_h_dressed.irp.f b/src/davidson/diagonalization_h_dressed.irp.f index 15bf256d..a7e501ea 100644 --- a/src/davidson/diagonalization_h_dressed.irp.f +++ b/src/davidson/diagonalization_h_dressed.irp.f @@ -31,7 +31,7 @@ subroutine davidson_diag_h(dets_in,u_in,dim_in,energies,sze,N_st,N_st_diag,Nint, ASSERT (sze > 0) ASSERT (Nint > 0) ASSERT (Nint == N_int) - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals allocate(H_jj(sze)) H_jj(1) = diag_h_mat_elem(dets_in(1,1,1),Nint) diff --git a/src/davidson/diagonalization_hcsf_dressed.irp.f b/src/davidson/diagonalization_hcsf_dressed.irp.f index 656dd1d9..1fb24e08 100644 --- a/src/davidson/diagonalization_hcsf_dressed.irp.f +++ b/src/davidson/diagonalization_hcsf_dressed.irp.f @@ -30,7 +30,7 @@ subroutine davidson_diag_h_csf(dets_in,u_in,dim_in,energies,sze,sze_csf,N_st,N_s ASSERT (sze > 0) ASSERT (Nint > 0) ASSERT (Nint == N_int) - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals allocate(H_jj(sze)) H_jj(1) = diag_h_mat_elem(dets_in(1,1,1),Nint) diff --git a/src/davidson/diagonalization_hs2_dressed.irp.f b/src/davidson/diagonalization_hs2_dressed.irp.f index d299f982..ce2cb63f 100644 --- a/src/davidson/diagonalization_hs2_dressed.irp.f +++ b/src/davidson/diagonalization_hs2_dressed.irp.f @@ -62,7 +62,7 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d ASSERT (sze > 0) ASSERT (Nint > 0) ASSERT (Nint == N_int) - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals allocate(H_jj(sze)) H_jj(1) = diag_h_mat_elem(dets_in(1,1,1),Nint) diff --git a/src/davidson/diagonalization_nonsym_h_dressed.irp.f b/src/davidson/diagonalization_nonsym_h_dressed.irp.f index 86df3a19..3ac37f1d 100644 --- a/src/davidson/diagonalization_nonsym_h_dressed.irp.f +++ b/src/davidson/diagonalization_nonsym_h_dressed.irp.f @@ -42,7 +42,7 @@ subroutine davidson_diag_nonsym_h(dets_in, u_in, dim_in, energies, sze, N_st, N_ ASSERT (sze > 0) ASSERT (Nint > 0) ASSERT (Nint == N_int) - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals allocate(H_jj(sze)) diff --git a/src/determinants/h_apply_nozmq.template.f b/src/determinants/h_apply_nozmq.template.f index bd261bbe..3463a818 100644 --- a/src/determinants/h_apply_nozmq.template.f +++ b/src/determinants/h_apply_nozmq.template.f @@ -17,7 +17,7 @@ double precision, allocatable :: fock_diag_tmp(:,:) $initialization - PROVIDE H_apply_buffer_allocated mo_two_e_integrals_in_map psi_det_generators psi_coef_generators + PROVIDE H_apply_buffer_allocated all_mo_integrals psi_det_generators psi_coef_generators call wall_time(wall_0) diff --git a/src/determinants/slater_rules.irp.f b/src/determinants/slater_rules.irp.f index 3a33a37d..5c170b9e 100644 --- a/src/determinants/slater_rules.irp.f +++ b/src/determinants/slater_rules.irp.f @@ -521,7 +521,7 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) integer :: occ(Nint*bit_kind_size,2) double precision :: diag_H_mat_elem, phase integer :: n_occ_ab(2) - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals + PROVIDE all_mo_integrals ASSERT (Nint > 0) ASSERT (Nint == N_int) @@ -623,7 +623,7 @@ subroutine i_H_j(key_i,key_j,Nint,hij) integer :: occ(Nint*bit_kind_size,2) double precision :: diag_H_mat_elem, phase integer :: n_occ_ab(2) - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals + PROVIDE all_mo_integrals ASSERT (Nint > 0) ASSERT (Nint == N_int) @@ -724,7 +724,7 @@ subroutine i_H_j_verbose(key_i,key_j,Nint,hij,hmono,hdouble,phase) integer :: n_occ_ab(2) logical :: has_mipi(Nint*bit_kind_size) double precision :: mipi(Nint*bit_kind_size), miip(Nint*bit_kind_size) - PROVIDE mo_two_e_integrals_in_map mo_integrals_map + PROVIDE all_mo_integrals ASSERT (Nint > 0) ASSERT (Nint == N_int) @@ -2227,7 +2227,7 @@ subroutine i_H_j_single_spin(key_i,key_j,Nint,spin,hij) integer :: exc(0:2,2) double precision :: phase - PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map + PROVIDE all_mo_integrals call get_single_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) call get_single_excitation_from_fock(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij) @@ -2248,7 +2248,7 @@ subroutine i_H_j_double_spin(key_i,key_j,Nint,hij) double precision :: phase double precision, external :: get_two_e_integral - PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map + PROVIDE all_mo_integrals call get_double_excitation_spin(key_i,key_j,exc,phase,Nint) hij = phase*(get_two_e_integral( & exc(1,1), & @@ -2277,7 +2277,7 @@ subroutine i_H_j_double_alpha_beta(key_i,key_j,Nint,hij) double precision :: phase, phase2 double precision, external :: get_two_e_integral - PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map + PROVIDE all_mo_integrals call get_single_excitation_spin(key_i(1,1),key_j(1,1),exc(0,1,1),phase,Nint) call get_single_excitation_spin(key_i(1,2),key_j(1,2),exc(0,1,2),phase2,Nint) diff --git a/src/determinants/slater_rules_wee_mono.irp.f b/src/determinants/slater_rules_wee_mono.irp.f index 4c1c9330..b94927e3 100644 --- a/src/determinants/slater_rules_wee_mono.irp.f +++ b/src/determinants/slater_rules_wee_mono.irp.f @@ -13,7 +13,7 @@ subroutine i_Wee_j_single(key_i,key_j,Nint,spin,hij) integer :: exc(0:2,2) double precision :: phase - PROVIDE big_array_exchange_integrals mo_two_e_integrals_in_map + PROVIDE all_mo_integrals call get_single_excitation_spin(key_i(1,spin),key_j(1,spin),exc,phase,Nint) call single_excitation_wee(key_i,key_j,exc(1,1),exc(1,2),spin,phase,hij) @@ -285,7 +285,7 @@ subroutine i_H_j_two_e(key_i,key_j,Nint,hij) integer :: occ(Nint*bit_kind_size,2) double precision :: diag_H_mat_elem, phase,phase_2 integer :: n_occ_ab(2) - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals ref_bitmask_two_e_energy + PROVIDE all_mo_integrals ref_bitmask_two_e_energy ASSERT (Nint > 0) ASSERT (Nint == N_int) diff --git a/src/determinants/utils.irp.f b/src/determinants/utils.irp.f index 7b75d985..07a6334b 100644 --- a/src/determinants/utils.irp.f +++ b/src/determinants/utils.irp.f @@ -4,12 +4,11 @@ BEGIN_DOC ! |H| matrix on the basis of the Slater determinants defined by psi_det END_DOC - integer :: i,j,k + integer :: i,j double precision :: hij - integer :: degree(N_det),idx(0:N_det) - call i_H_j(psi_det(1,1,1),psi_det(1,1,1),N_int,hij) + PROVIDE all_mo_integrals print*,'Providing the H_matrix_all_dets ...' - !$OMP PARALLEL DO SCHEDULE(GUIDED) DEFAULT(NONE) PRIVATE(i,j,hij,degree,idx,k) & + !$OMP PARALLEL DO SCHEDULE(GUIDED) DEFAULT(NONE) PRIVATE(i,j,hij) & !$OMP SHARED (N_det, psi_det, N_int,H_matrix_all_dets) do i =1,N_det do j = i, N_det @@ -31,7 +30,7 @@ integer :: i double precision :: hij integer :: degree(N_det) - call i_H_j(psi_det(1,1,1),psi_det(1,1,1),N_int,hij) + PROVIDE all_mo_integrals !$OMP PARALLEL DO SCHEDULE(GUIDED) DEFAULT(NONE) PRIVATE(i,hij,degree) & !$OMP SHARED (N_det, psi_det, N_int,H_matrix_diag_all_dets) do i =1,N_det diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index eeb4279f..e6b2967a 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -1,5 +1,15 @@ use map_module +BEGIN_PROVIDER [ logical, all_mo_integrals ] + implicit none + BEGIN_DOC +! Used to provide everything needed before using MO integrals +! PROVIDE all_mo_integrals + END_DOC + PROVIDE mo_two_e_integrals_in_map mo_integrals_cache mo_two_e_integrals_jj_exchange mo_two_e_integrals_jj_anti mo_two_e_integrals_jj big_array_exchange_integrals big_array_coulomb_integrals +END_PROVIDER + + !! MO Map !! ====== @@ -35,20 +45,24 @@ subroutine insert_into_mo_integrals_map(n_integrals, & BEGIN_PROVIDER [ integer, mo_integrals_cache_min ] &BEGIN_PROVIDER [ integer, mo_integrals_cache_max ] &BEGIN_PROVIDER [ integer, mo_integrals_cache_size ] +&BEGIN_PROVIDER [ integer*8, mo_integrals_cache_size_8 ] implicit none BEGIN_DOC ! Min and max values of the MOs for which the integrals are in the cache END_DOC - mo_integrals_cache_size = 2**mo_integrals_cache_shift + mo_integrals_cache_size = shiftl(1,mo_integrals_cache_shift) + mo_integrals_cache_size_8 = shiftl(1_8, mo_integrals_cache_shift*4) + mo_integrals_cache_min = max(1,elec_alpha_num - (mo_integrals_cache_size/2 - 1) ) mo_integrals_cache_max = min(mo_num, mo_integrals_cache_min + mo_integrals_cache_size - 1) - print *, 'MO integrals cache: (', mo_integrals_cache_min, ', ', mo_integrals_cache_max, ')' + print *, 'MO integrals cache: (', mo_integrals_cache_min, ', ', mo_integrals_cache_max, '), ', & + shiftr(mo_integrals_cache_size_8, 17), 'MiB' END_PROVIDER -BEGIN_PROVIDER [ double precision, mo_integrals_cache, (0_8:(1_8*mo_integrals_cache_size)**4) ] +BEGIN_PROVIDER [ double precision, mo_integrals_cache, (0_8:mo_integrals_cache_size_8**4_8) ] implicit none BEGIN_DOC ! Cache of MO integrals for fast access @@ -67,8 +81,7 @@ subroutine insert_into_mo_integrals_map(n_integrals, & do k=mo_integrals_cache_min,mo_integrals_cache_max ii = int(l-mo_integrals_cache_min,8) ii = ior( shiftl(ii,mo_integrals_cache_shift), int(k-mo_integrals_cache_min,8)) - ii = shiftl(ii,mo_integrals_cache_shift) - ii = shiftl(ii,mo_integrals_cache_shift) + ii = shiftl(ii,2*mo_integrals_cache_shift) call dgemm('T','N', mo_integrals_cache_max-mo_integrals_cache_min+1, & mo_integrals_cache_max-mo_integrals_cache_min+1, & cholesky_mo_num, 1.d0, & @@ -328,7 +341,7 @@ double precision function mo_two_e_integral(i,j,k,l) END_DOC integer, intent(in) :: i,j,k,l double precision :: get_two_e_integral - PROVIDE mo_two_e_integrals_in_map mo_integrals_cache + PROVIDE all_mo_integrals !DIR$ FORCEINLINE mo_two_e_integral = get_two_e_integral(i,j,k,l,mo_integrals_map) return From 348f6067914983d8919644d464a0ad18e7af6dc4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 20 Jan 2025 18:03:19 +0100 Subject: [PATCH 046/175] Provide mo...in_map -> all_mo_integrals --- src/casscf_cipsi/bielec.irp.f | 28 +-- src/casscf_cipsi/hessian.irp.f | 2 +- src/casscf_cipsi/hessian_old.irp.f | 52 ++-- src/ccsd/ccsd_space_orb_sub.irp.f | 2 +- src/cipsi/stochastic_cipsi.irp.f | 6 +- src/cipsi_utils/pt2_stoch_routines.irp.f | 2 +- src/cipsi_utils/slave_cipsi.irp.f | 2 +- src/dressing/dress_slave.irp.f | 2 +- src/dressing/dress_stoch_routines.irp.f | 2 +- src/fci/fci.irp.f | 5 +- src/fci/pt2.irp.f | 16 +- .../debug_gradient_list_opt.irp.f | 22 +- src/mo_optimization/debug_gradient_opt.irp.f | 22 +- .../debug_hessian_list_opt.irp.f | 32 +-- src/mo_optimization/debug_hessian_opt.irp.f | 34 +-- .../routine_opt_mos.irp.f | 6 +- .../run_orb_opt_trust_v2.irp.f | 38 +-- src/mo_two_e_ints/map_integrals.irp.f | 2 +- src/mu_of_r/f_hf_utils.irp.f | 78 +++--- src/mu_of_r/f_psi_i_a_v_utils.irp.f | 144 +++++------ src/mu_of_r/mu_of_r_conditions.irp.f | 82 +++---- src/tools/fcidump.irp.f | 2 +- src/tools/fcidump_pyscf.irp.f | 2 +- src/tools/four_idx_transform.irp.f | 2 +- src/trexio/export_trexio_routines.irp.f | 2 +- src/two_body_rdm/act_2_rdm.irp.f | 76 +++--- src/two_rdm_routines/davidson_like_2rdm.irp.f | 228 +++++++++--------- .../davidson_like_trans_2rdm.irp.f | 228 +++++++++--------- src/utils_cc/mo_integrals_cc.irp.f | 26 +- 29 files changed, 573 insertions(+), 572 deletions(-) diff --git a/src/casscf_cipsi/bielec.irp.f b/src/casscf_cipsi/bielec.irp.f index a4901985..cd96d25a 100644 --- a/src/casscf_cipsi/bielec.irp.f +++ b/src/casscf_cipsi/bielec.irp.f @@ -1,7 +1,7 @@ BEGIN_PROVIDER [real*8, bielec_PQxx_array, (mo_num, mo_num,n_core_inact_act_orb,n_core_inact_act_orb)] BEGIN_DOC - ! WARNING !!! Old version !!! NOT USED ANYMORE IN THE PROGRAM !!! TOO BIG TO BE STORED ON LARGE SYSTEMS !!! - ! + ! WARNING !!! Old version !!! NOT USED ANYMORE IN THE PROGRAM !!! TOO BIG TO BE STORED ON LARGE SYSTEMS !!! + ! ! Replaced by the Cholesky-based function bielec_PQxx ! ! bielec_PQxx_array : integral (pq|xx) with p,q arbitrary, x core or active @@ -13,10 +13,10 @@ print*,'' print*,'Providing bielec_PQxx_array, WARNING IT CAN BE A VERY BIG ARRAY WHEN MO_NUM IS LARGE !!!' print*,'' - + bielec_PQxx_array(:,:,:,:) = 0.d0 - PROVIDE mo_two_e_integrals_in_map - + PROVIDE all_mo_integrals + !$OMP PARALLEL DEFAULT(NONE) & !$OMP PRIVATE(i,ii,j,jj,i3,j3) & !$OMP SHARED(n_core_inact_orb,list_core_inact,mo_num,bielec_PQxx_array, & @@ -61,8 +61,8 @@ BEGIN_PROVIDER [real*8, bielec_PxxQ_array, (mo_num,n_core_inact_act_orb,n_core_inact_act_orb, mo_num)] BEGIN_DOC - ! WARNING !!! Old version !!! NOT USED ANYMORE IN THE PROGRAM !!! TOO BIG TO BE STORED ON LARGE SYSTEMS !!! - ! + ! WARNING !!! Old version !!! NOT USED ANYMORE IN THE PROGRAM !!! TOO BIG TO BE STORED ON LARGE SYSTEMS !!! + ! ! Replaced by the Cholesky-based function bielec_PxxQ ! ! bielec_PxxQ_array : integral (px|xq) with p,q arbitrary, x core or active @@ -72,11 +72,11 @@ integer :: i,j,ii,jj,p,q,i3,j3,t3,v3 double precision, allocatable :: integrals_array(:,:) real*8 :: mo_two_e_integral - + print*,'' print*,'Providing bielec_PxxQ_array, WARNING IT CAN BE A VERY BIG ARRAY WHEN MO_NUM IS LARGE !!!' print*,'' - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals bielec_PxxQ_array = 0.d0 !$OMP PARALLEL DEFAULT(NONE) & @@ -85,7 +85,7 @@ !$OMP n_act_orb,mo_integrals_map,list_act) allocate(integrals_array(mo_num,mo_num)) - + !$OMP DO do i=1,n_core_inact_orb ii=list_core_inact(i) @@ -143,17 +143,17 @@ BEGIN_DOC ! bielecCI : integrals (tu|vp) with p arbitrary, tuv active ! index p runs over the whole basis, t,u,v only over the active orbitals - ! + ! ! This array can be stored anyway. Ex: 50 active orbitals, 1500 MOs ==> 8x50^3x1500 = 1.5 Gb END_DOC implicit none integer :: i,j,k,p,t,u,v double precision, external :: mo_two_e_integral - double precision :: wall0, wall1 + double precision :: wall0, wall1 call wall_time(wall0) print*,'Providing bielecCI' - PROVIDE mo_two_e_integrals_in_map - + PROVIDE all_mo_integrals + !$OMP PARALLEL DO DEFAULT(NONE) & !$OMP PRIVATE(i,j,k,p,t,u,v) & !$OMP SHARED(mo_num,n_act_orb,list_act,bielecCI) diff --git a/src/casscf_cipsi/hessian.irp.f b/src/casscf_cipsi/hessian.irp.f index 9a7a9031..1ee073d2 100644 --- a/src/casscf_cipsi/hessian.irp.f +++ b/src/casscf_cipsi/hessian.irp.f @@ -380,7 +380,7 @@ end function hessmat_taub ! c-v | X X ! a-v | X - provide mo_two_e_integrals_in_map + provide all_mo_integrals hessmat = 0.d0 diff --git a/src/casscf_cipsi/hessian_old.irp.f b/src/casscf_cipsi/hessian_old.irp.f index d17f1f0a..0f7c8682 100644 --- a/src/casscf_cipsi/hessian_old.irp.f +++ b/src/casscf_cipsi/hessian_old.irp.f @@ -13,18 +13,18 @@ integer :: jndx,jhole,jpart character*3 :: iexc,jexc real*8 :: res - + if (bavard) then write(6,*) ' providing Hessian matrix hessmat_old ' write(6,*) ' nMonoEx = ',nMonoEx endif - + do indx=1,nMonoEx do jndx=1,nMonoEx hessmat_old(indx,jndx)=0.D0 end do end do - + do indx=1,nMonoEx ihole=excit(1,indx) ipart=excit(2,indx) @@ -38,7 +38,7 @@ hessmat_old(jndx,indx)=res end do end do - + END_PROVIDER subroutine calc_hess_elem(ihole,ipart,jhole,jpart,res) @@ -75,9 +75,9 @@ subroutine calc_hess_elem(ihole,ipart,jhole,jpart,res) integer :: nu_rs_possible integer :: mu_pqrs_possible integer :: mu_rspq_possible - + res=0.D0 - + ! the terms <0|E E H |0> do mu=1,n_det ! get the string of the determinant @@ -174,10 +174,10 @@ subroutine calc_hess_elem(ihole,ipart,jhole,jpart,res) end if end do end do - + ! state-averaged Hessian res*=1.D0/dble(N_states) - + end subroutine calc_hess_elem BEGIN_PROVIDER [real*8, hessmat_peter, (nMonoEx,nMonoEx)] @@ -190,26 +190,26 @@ end subroutine calc_hess_elem END_DOC implicit none integer :: i,j,t,u,a,b,indx,jndx,bstart,ustart,indx_shift - + real*8 :: hessmat_itju real*8 :: hessmat_itja real*8 :: hessmat_itua real*8 :: hessmat_iajb real*8 :: hessmat_iatb real*8 :: hessmat_taub - + if (bavard) then write(6,*) ' providing Hessian matrix hessmat_peter ' write(6,*) ' nMonoEx = ',nMonoEx endif - provide mo_two_e_integrals_in_map - + provide all_mo_integrals + !$OMP PARALLEL DEFAULT(NONE) & !$OMP SHARED(hessmat_peter,n_core_inact_orb,n_act_orb,n_virt_orb,nMonoEx) & !$OMP PRIVATE(i,indx,jndx,j,ustart,t,u,a,bstart,indx_shift) !$OMP DO - ! (DOUBLY OCCUPIED ---> ACT ) + ! (DOUBLY OCCUPIED ---> ACT ) do i=1,n_core_inact_orb do t=1,n_act_orb indx = t + (i-1)*n_act_orb @@ -226,14 +226,14 @@ end subroutine calc_hess_elem jndx+=1 end do end do - ! (DOUBLY OCCUPIED ---> VIRTUAL) + ! (DOUBLY OCCUPIED ---> VIRTUAL) do j=1,n_core_inact_orb do a=1,n_virt_orb hessmat_peter(jndx,indx)=hessmat_itja(i,t,j,a) jndx+=1 end do end do - ! (ACTIVE ---> VIRTUAL) + ! (ACTIVE ---> VIRTUAL) do u=1,n_act_orb do a=1,n_virt_orb hessmat_peter(jndx,indx)=hessmat_itua(i,t,u,a) @@ -243,15 +243,15 @@ end subroutine calc_hess_elem end do end do !$OMP END DO NOWAIT - + indx_shift = n_core_inact_orb*n_act_orb !$OMP DO - ! (DOUBLY OCCUPIED ---> VIRTUAL) + ! (DOUBLY OCCUPIED ---> VIRTUAL) do a=1,n_virt_orb do i=1,n_core_inact_orb indx = a + (i-1)*n_virt_orb + indx_shift jndx=indx - ! (DOUBLY OCCUPIED ---> VIRTUAL) + ! (DOUBLY OCCUPIED ---> VIRTUAL) do j=i,n_core_inact_orb if (i.eq.j) then bstart=a @@ -263,7 +263,7 @@ end subroutine calc_hess_elem jndx+=1 end do end do - ! (ACT ---> VIRTUAL) + ! (ACT ---> VIRTUAL) do t=1,n_act_orb do b=1,n_virt_orb hessmat_peter(jndx,indx)=hessmat_iatb(i,a,t,b) @@ -273,15 +273,15 @@ end subroutine calc_hess_elem end do end do !$OMP END DO NOWAIT - + indx_shift += n_core_inact_orb*n_virt_orb - !$OMP DO - ! (ACT ---> VIRTUAL) + !$OMP DO + ! (ACT ---> VIRTUAL) do a=1,n_virt_orb do t=1,n_act_orb indx = a + (t-1)*n_virt_orb + indx_shift jndx=indx - ! (ACT ---> VIRTUAL) + ! (ACT ---> VIRTUAL) do u=t,n_act_orb if (t.eq.u) then bstart=a @@ -295,16 +295,16 @@ end subroutine calc_hess_elem end do end do end do - !$OMP END DO + !$OMP END DO !$OMP END PARALLEL - + do jndx=1,nMonoEx do indx=1,jndx-1 hessmat_peter(indx,jndx) = hessmat_peter(jndx,indx) enddo enddo - + END_PROVIDER diff --git a/src/ccsd/ccsd_space_orb_sub.irp.f b/src/ccsd/ccsd_space_orb_sub.irp.f index e4907f22..30f134fc 100644 --- a/src/ccsd/ccsd_space_orb_sub.irp.f +++ b/src/ccsd/ccsd_space_orb_sub.irp.f @@ -35,7 +35,7 @@ subroutine run_ccsd_space_orb PROVIDE cholesky_mo_transp FREE cholesky_ao else - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals endif det = psi_det(:,:,cc_ref) diff --git a/src/cipsi/stochastic_cipsi.irp.f b/src/cipsi/stochastic_cipsi.irp.f index 289040f0..40d77ef5 100644 --- a/src/cipsi/stochastic_cipsi.irp.f +++ b/src/cipsi/stochastic_cipsi.irp.f @@ -1,11 +1,11 @@ -subroutine run_stochastic_cipsi(Ev,PT2) +subroutine run_stochastic_cipsi(Ev,PT2) use selection_types implicit none BEGIN_DOC ! Selected Full Configuration Interaction with Stochastic selection and PT2. END_DOC integer :: i,j,k - double precision, intent(out) :: Ev(N_states), PT2(N_states) + double precision, intent(out) :: Ev(N_states), PT2(N_states) double precision, allocatable :: zeros(:) integer :: to_select type(pt2_type) :: pt2_data, pt2_data_err @@ -14,7 +14,7 @@ subroutine run_stochastic_cipsi(Ev,PT2) double precision :: rss double precision, external :: memory_of_double - PROVIDE H_apply_buffer_allocated distributed_davidson mo_two_e_integrals_in_map + PROVIDE H_apply_buffer_allocated distributed_davidson all_mo_integrals threshold_generators = 1.d0 SOFT_TOUCH threshold_generators diff --git a/src/cipsi_utils/pt2_stoch_routines.irp.f b/src/cipsi_utils/pt2_stoch_routines.irp.f index 744c4006..144d052d 100644 --- a/src/cipsi_utils/pt2_stoch_routines.irp.f +++ b/src/cipsi_utils/pt2_stoch_routines.irp.f @@ -165,7 +165,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in) state_average_weight(pt2_stoch_istate) = 1.d0 TOUCH state_average_weight pt2_stoch_istate selection_weight - PROVIDE nproc pt2_F mo_two_e_integrals_in_map mo_one_e_integrals pt2_w + PROVIDE nproc pt2_F all_mo_integrals mo_one_e_integrals pt2_w PROVIDE psi_selectors pt2_u pt2_J pt2_R call new_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'pt2') diff --git a/src/cipsi_utils/slave_cipsi.irp.f b/src/cipsi_utils/slave_cipsi.irp.f index 3e778270..ae8d3472 100644 --- a/src/cipsi_utils/slave_cipsi.irp.f +++ b/src/cipsi_utils/slave_cipsi.irp.f @@ -14,7 +14,7 @@ subroutine run_slave_cipsi end subroutine provide_everything - PROVIDE H_apply_buffer_allocated mo_two_e_integrals_in_map psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context N_states_diag + PROVIDE H_apply_buffer_allocated all_mo_integrals psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context N_states_diag PROVIDE pt2_e0_denominator mo_num N_int ci_energy mpi_master zmq_state zmq_context PROVIDE psi_det psi_coef threshold_generators state_average_weight PROVIDE N_det_selectors pt2_stoch_istate N_det selection_weight pseudo_sym diff --git a/src/dressing/dress_slave.irp.f b/src/dressing/dress_slave.irp.f index 04e4f01b..e0274a8a 100644 --- a/src/dressing/dress_slave.irp.f +++ b/src/dressing/dress_slave.irp.f @@ -15,7 +15,7 @@ subroutine dress_slave end subroutine provide_everything - PROVIDE H_apply_buffer_allocated mo_two_e_integrals_in_map psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context + PROVIDE H_apply_buffer_allocated all_mo_integrals psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context end subroutine run_wf diff --git a/src/dressing/dress_stoch_routines.irp.f b/src/dressing/dress_stoch_routines.irp.f index 6b37fad1..cdbe2c4f 100644 --- a/src/dressing/dress_stoch_routines.irp.f +++ b/src/dressing/dress_stoch_routines.irp.f @@ -258,7 +258,7 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error) state_average_weight(dress_stoch_istate) = 1.d0 TOUCH state_average_weight dress_stoch_istate - provide nproc mo_two_e_integrals_in_map mo_one_e_integrals psi_selectors pt2_F pt2_N_teeth dress_M_m + provide nproc all_mo_integrals mo_one_e_integrals psi_selectors pt2_F pt2_N_teeth dress_M_m print *, '========== ================= ================= =================' print *, ' Samples Energy Stat. Error Seconds ' diff --git a/src/fci/fci.irp.f b/src/fci/fci.irp.f index 2059a53b..d3ecc45d 100644 --- a/src/fci/fci.irp.f +++ b/src/fci/fci.irp.f @@ -36,8 +36,9 @@ program fci ! END_DOC + PROVIDE all_mo_integrals if (.not.is_zmq_slave) then - PROVIDE psi_det psi_coef mo_two_e_integrals_in_map + PROVIDE psi_det psi_coef write(json_unit,json_array_open_fmt) 'fci' @@ -55,7 +56,7 @@ program fci call json_close else - PROVIDE mo_two_e_integrals_in_map pt2_min_parallel_tasks + PROVIDE pt2_min_parallel_tasks call run_slave_cipsi diff --git a/src/fci/pt2.irp.f b/src/fci/pt2.irp.f index 1c9f9dcd..53bf1699 100644 --- a/src/fci/pt2.irp.f +++ b/src/fci/pt2.irp.f @@ -11,7 +11,7 @@ program pt2 ! ! The main option for the |PT2| correction is the ! :option:`perturbation pt2_relative_error` which is the relative - ! stochastic error on the |PT2| to reach before stopping the + ! stochastic error on the |PT2| to reach before stopping the ! sampling. ! END_DOC @@ -19,7 +19,7 @@ program pt2 read_wf = .True. threshold_generators = 1.d0 SOFT_TOUCH read_wf threshold_generators - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals PROVIDE psi_energy call run else @@ -32,22 +32,22 @@ subroutine run use selection_types integer :: i,j,k logical, external :: detEq - + type(pt2_type) :: pt2_data, pt2_data_err integer :: degree integer :: n_det_before, to_select double precision :: threshold_davidson_in - + double precision :: relative_error double precision, allocatable :: E_CI_before(:) - + allocate ( E_CI_before(N_states)) call pt2_alloc(pt2_data, N_states) call pt2_alloc(pt2_data_err, N_states) - + E_CI_before(:) = psi_energy(:) + nuclear_repulsion relative_error=PT2_relative_error - + if (do_pt2) then call ZMQ_pt2(psi_energy_with_nucl_rep, pt2_data, pt2_data_err, relative_error, 0) ! Stochastic PT2 else @@ -56,7 +56,7 @@ subroutine run call print_summary(psi_energy_with_nucl_rep(1:N_states), & pt2_data, pt2_data_err, N_det,N_configuration,N_states,psi_s2) - + call save_energy(E_CI_before, pt2_data % pt2) call pt2_dealloc(pt2_data) call pt2_dealloc(pt2_data_err) diff --git a/src/mo_optimization/debug_gradient_list_opt.irp.f b/src/mo_optimization/debug_gradient_list_opt.irp.f index 32cea90c..dcc731fc 100644 --- a/src/mo_optimization/debug_gradient_list_opt.irp.f +++ b/src/mo_optimization/debug_gradient_list_opt.irp.f @@ -19,7 +19,7 @@ program debug_gradient_list - + implicit none ! Variables @@ -30,12 +30,12 @@ program debug_gradient_list double precision :: threshold double precision :: max_error, max_elem, norm integer :: nb_error - + m = dim_list_act_orb - ! Definition of n + ! Definition of n n = m*(m-1)/2 - PROVIDE mo_two_e_integrals_in_map ! Verifier pour suppression + PROVIDE all_mo_integrals ! Verifier pour suppression ! Allocation allocate(v_grad(n), v_grad2(n)) @@ -44,15 +44,15 @@ program debug_gradient_list call diagonalize_ci ! Verifier pour suppression - ! Gradient + ! Gradient call gradient_list_opt(n,m,list_act,v_grad,max_elem,norm) call first_gradient_list_opt(n,m,list_act,v_grad2) - - + + v_grad = v_grad - v_grad2 nb_error = 0 - max_error = 0d0 - threshold = 1d-12 + max_error = 0d0 + threshold = 1d-12 do i = 1, n if (ABS(v_grad(i)) > threshold) then @@ -65,9 +65,9 @@ program debug_gradient_list endif enddo - + print*,'' - print*,'Check the gradient' + print*,'Check the gradient' print*,'Threshold:', threshold print*,'Nb error:', nb_error print*,'Max error:', max_error diff --git a/src/mo_optimization/debug_gradient_opt.irp.f b/src/mo_optimization/debug_gradient_opt.irp.f index 529a02b6..7aba985b 100644 --- a/src/mo_optimization/debug_gradient_opt.irp.f +++ b/src/mo_optimization/debug_gradient_opt.irp.f @@ -19,7 +19,7 @@ program debug_gradient - + implicit none ! Variables @@ -30,27 +30,27 @@ program debug_gradient double precision :: threshold double precision :: max_error, max_elem integer :: nb_error - - ! Definition of n + + ! Definition of n n = mo_num*(mo_num-1)/2 - PROVIDE mo_two_e_integrals_in_map ! Check for suppression + PROVIDE all_mo_integrals ! Check for suppression ! Allocation allocate(v_grad(n), v_grad2(n)) ! Calculation - call diagonalize_ci + call diagonalize_ci - ! Gradient + ! Gradient call first_gradient_opt(n,v_grad) call gradient_opt(n,v_grad2,max_elem) - + v_grad = v_grad - v_grad2 nb_error = 0 - max_error = 0d0 - threshold = 1d-12 + max_error = 0d0 + threshold = 1d-12 do i = 1, n if (ABS(v_grad(i)) > threshold) then @@ -63,9 +63,9 @@ program debug_gradient endif enddo - + print*,'' - print*,'Check the gradient' + print*,'Check the gradient' print*,'Threshold :', threshold print*,'Nb error :', nb_error print*,'Max error :', max_error diff --git a/src/mo_optimization/debug_hessian_list_opt.irp.f b/src/mo_optimization/debug_hessian_list_opt.irp.f index 65a7bcf3..417642b6 100644 --- a/src/mo_optimization/debug_hessian_list_opt.irp.f +++ b/src/mo_optimization/debug_hessian_list_opt.irp.f @@ -43,18 +43,18 @@ program debug_hessian_list_opt double precision :: max_error, max_error_H integer :: nb_error, nb_error_H double precision :: threshold - + m = dim_list_act_orb !mo_num - ! Definition of n + ! Definition of n n = m*(m-1)/2 - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals - ! Hessian + ! Hessian if (optimization_method == 'full') then print*,'Use the full hessian matrix' - allocate(H(n,n),H2(n,n)) + allocate(H(n,n),H2(n,n)) allocate(h_f(m,m,m,m),h_f2(m,m,m,m)) call hessian_list_opt(n,m,list_act,H,h_f) @@ -65,7 +65,7 @@ program debug_hessian_list_opt h_f = h_f - h_f2 H = H - H2 max_error = 0d0 - nb_error = 0 + nb_error = 0 threshold = 1d-12 do l = 1, m @@ -99,7 +99,7 @@ program debug_hessian_list_opt endif enddo - enddo + enddo ! Deallocation deallocate(H, H2, h_f, h_f2) @@ -110,26 +110,26 @@ program debug_hessian_list_opt allocate(H(n,1),H2(n,1)) call diag_hessian_list_opt(n,m,list_act,H) call first_diag_hessian_list_opt(n,m,list_act,H2) - + H = H - H2 - + max_error_H = 0d0 nb_error_H = 0 - + do i = 1, n if (ABS(H(i,1)) > threshold) then print*, H(i,1) nb_error_H = nb_error_H + 1 - + if (ABS(H(i,1)) > ABS(max_error_H)) then max_error_H = H(i,1) endif - + endif enddo - + endif - + print*,'' if (optimization_method == 'full') then print*,'Check of the full hessian' @@ -140,8 +140,8 @@ program debug_hessian_list_opt else print*,'Check of the diagonal hessian' endif - + print*,'Nb error_H:', nb_error_H print*,'Max error_H:', max_error_H - + end program diff --git a/src/mo_optimization/debug_hessian_opt.irp.f b/src/mo_optimization/debug_hessian_opt.irp.f index 684a0da5..729fc2a3 100644 --- a/src/mo_optimization/debug_hessian_opt.irp.f +++ b/src/mo_optimization/debug_hessian_opt.irp.f @@ -36,20 +36,20 @@ program debug_hessian double precision :: max_error, max_error_H integer :: nb_error, nb_error_H double precision :: threshold - - ! Definition of n + + ! Definition of n n = mo_num*(mo_num-1)/2 - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals ! Allocation - allocate(H(n,n),H2(n,n)) + allocate(H(n,n),H2(n,n)) allocate(h_f(mo_num,mo_num,mo_num,mo_num),h_f2(mo_num,mo_num,mo_num,mo_num)) ! Calculation - - ! Hessian - if (optimization_method == 'full') then + + ! Hessian + if (optimization_method == 'full') then print*,'Use the full hessian matrix' call hessian_opt(n,H,h_f) @@ -59,7 +59,7 @@ program debug_hessian h_f = h_f - h_f2 H = H - H2 max_error = 0d0 - nb_error = 0 + nb_error = 0 threshold = 1d-12 do l = 1, mo_num @@ -93,7 +93,7 @@ program debug_hessian endif enddo - enddo + enddo elseif (optimization_method == 'diag') then @@ -128,43 +128,43 @@ program debug_hessian enddo h=H-H2 - + max_error_H = 0d0 nb_error_H = 0 - + do j = 1, n do i = 1, n if (ABS(H(i,j)) > threshold) then print*, H(i,j) nb_error_H = nb_error_H + 1 - + if (ABS(H(i,j)) > ABS(max_error_H)) then max_error_H = H(i,j) endif - + endif enddo enddo - + else print*,'Unknown optimization_method, please select full, diag' call abort endif - + print*,'' if (optimization_method == 'full') then print*,'Check the full hessian' else print*,'Check the diagonal hessian' endif - + print*,'Threshold :', threshold print*,'Nb error :', nb_error print*,'Max error :', max_error print*,'' print*,'Nb error_H :', nb_error_H print*,'Max error_H :', max_error_H - + ! Deallocation deallocate(H,H2,h_f,h_f2) diff --git a/src/mo_optimization_utils/routine_opt_mos.irp.f b/src/mo_optimization_utils/routine_opt_mos.irp.f index fceba2c5..742e074b 100644 --- a/src/mo_optimization_utils/routine_opt_mos.irp.f +++ b/src/mo_optimization_utils/routine_opt_mos.irp.f @@ -9,7 +9,7 @@ subroutine run_optimization_mos_CIPSI logical :: not_converged character (len=100) :: filename - PROVIDE psi_det psi_coef mo_two_e_integrals_in_map ao_pseudo_integrals + PROVIDE psi_det psi_coef all_mo_integrals ao_pseudo_integrals allocate(Ev(N_states),PT2(N_states)) not_converged = .True. @@ -30,7 +30,7 @@ subroutine run_optimization_mos_CIPSI print*,'======================' print*,' Cipsi step:', nb_iter print*,'======================' - print*,'' + print*,'' print*,'********** cipsi step **********' ! cispi calculation call run_stochastic_cipsi(Ev,PT2) @@ -70,7 +70,7 @@ subroutine run_optimization_mos_CIPSI print*, 'The program will exit' exit endif - + ! To double the number of determinants in the wf N_det_max = int(dble(n_det * 2)*0.9) TOUCH N_det_max diff --git a/src/mo_optimization_utils/run_orb_opt_trust_v2.irp.f b/src/mo_optimization_utils/run_orb_opt_trust_v2.irp.f index e1431255..afa4da0a 100644 --- a/src/mo_optimization_utils/run_orb_opt_trust_v2.irp.f +++ b/src/mo_optimization_utils/run_orb_opt_trust_v2.irp.f @@ -93,7 +93,7 @@ subroutine run_orb_opt_trust_v2 integer,allocatable :: tmp_list(:), key(:) double precision, allocatable :: tmp_m_x(:,:),tmp_R(:,:), tmp_x(:), W(:,:), e_val(:) - PROVIDE mo_two_e_integrals_in_map ci_energy psi_det psi_coef + PROVIDE all_mo_integrals ci_energy psi_det psi_coef ! Allocation @@ -110,17 +110,17 @@ subroutine run_orb_opt_trust_v2 allocate(e_val(tmp_n),key(tmp_n),v_grad(tmp_n)) ! Method -! There are three different methods : +! There are three different methods : ! - the "full" hessian, which uses all the elements of the hessian ! matrix" ! - the "diagonal" hessian, which uses only the diagonal elements of the ! hessian -! - without the hessian (hessian = identity matrix) +! - without the hessian (hessian = identity matrix) !Display the method print*, 'Method :', optimization_method -if (optimization_method == 'full') then +if (optimization_method == 'full') then print*, 'Full hessian' allocate(H(tmp_n,tmp_n), h_f(m,m,m,m),W(tmp_n,tmp_n)) tmp_n2 = tmp_n @@ -147,13 +147,13 @@ subroutine run_orb_opt_trust_v2 ! - We diagonalize the hessian ! - We compute a step and loop to reduce the radius of the ! trust region (and the size of the step by the way) until the step is -! accepted -! - We repeat the process until the convergence +! accepted +! - We repeat the process until the convergence ! NB: the convergence criterion can be changed ! Loop until the convergence of the optimization -! call diagonalize_ci +! call diagonalize_ci !### Initialization ### nb_iter = 0 @@ -183,14 +183,14 @@ subroutine run_orb_opt_trust_v2 ! Full hessian call hessian_list_opt(tmp_n, m, tmp_list, H, h_f) - ! Diagonalization of the hessian + ! Diagonalization of the hessian call diagonalization_hessian(tmp_n, H, e_val, w) elseif (optimization_method == 'diag') then - ! Diagonal hessian + ! Diagonal hessian call diag_hessian_list_opt(tmp_n, m, tmp_list, H) else - ! Identity matrix + ! Identity matrix do tmp_i = 1, tmp_n H(tmp_i,1) = 1d0 enddo @@ -212,7 +212,7 @@ subroutine run_orb_opt_trust_v2 endif ! Init before the internal loop - cancel_step = .True. ! To enter in the loop just after + cancel_step = .True. ! To enter in the loop just after nb_cancel = 0 nb_sub_iter = 0 @@ -225,15 +225,15 @@ subroutine run_orb_opt_trust_v2 print*,'Max elem grad:', max_elem_grad print*,'-----------------------------' - ! Hessian,gradient,Criterion -> x - call trust_region_step_w_expected_e(tmp_n,tmp_n2,H,W,e_val,v_grad,prev_criterion,rho,nb_iter,delta,criterion_model,tmp_x,must_exit) + ! Hessian,gradient,Criterion -> x + call trust_region_step_w_expected_e(tmp_n,tmp_n2,H,W,e_val,v_grad,prev_criterion,rho,nb_iter,delta,criterion_model,tmp_x,must_exit) if (must_exit) then print*,'step_in_trust_region sends: Exit' exit endif - ! 1D tmp -> 2D tmp + ! 1D tmp -> 2D tmp call vec_to_mat_v2(tmp_n, m, tmp_x, tmp_m_x) ! Rotation matrix for the active MOs @@ -250,14 +250,14 @@ subroutine run_orb_opt_trust_v2 call sub_to_full_rotation_matrix(m, tmp_list, tmp_R, R) ! MO rotations - call apply_mo_rotation(R, prev_mos) + call apply_mo_rotation(R, prev_mos) ! Update of the energy before the diagonalization of the hamiltonian call clear_mo_map - TOUCH mo_coef psi_det psi_coef ci_energy two_e_dm_mo + TOUCH mo_coef psi_det psi_coef ci_energy two_e_dm_mo call state_average_energy(criterion) - ! Criterion -> step accepted or rejected + ! Criterion -> step accepted or rejected call trust_region_is_step_cancelled(nb_iter, prev_criterion, criterion, criterion_model, rho, cancel_step) ! Cancellation of the step if necessary @@ -283,7 +283,7 @@ subroutine run_orb_opt_trust_v2 ! To exit the external loop if must_exit = .True. if (must_exit) then exit - endif + endif ! Step accepted, nb iteration + 1 nb_iter = nb_iter + 1 @@ -295,7 +295,7 @@ subroutine run_orb_opt_trust_v2 endif if (nb_iter >= optimization_max_nb_iter) then print*,'Not converged: nb_iter >= optimization_max_nb_iter' - not_converged = .False. + not_converged = .False. endif if (.not. not_converged) then diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index e6b2967a..06300666 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -6,7 +6,7 @@ ! Used to provide everything needed before using MO integrals ! PROVIDE all_mo_integrals END_DOC - PROVIDE mo_two_e_integrals_in_map mo_integrals_cache mo_two_e_integrals_jj_exchange mo_two_e_integrals_jj_anti mo_two_e_integrals_jj big_array_exchange_integrals big_array_coulomb_integrals + PROVIDE mo_two_e_integrals_in_map mo_integrals_cache mo_two_e_integrals_jj_exchange mo_two_e_integrals_jj_anti mo_two_e_integrals_jj big_array_exchange_integrals big_array_coulomb_integrals mo_one_e_integrals END_PROVIDER diff --git a/src/mu_of_r/f_hf_utils.irp.f b/src/mu_of_r/f_hf_utils.irp.f index 102b40a0..7c40fc80 100644 --- a/src/mu_of_r/f_hf_utils.irp.f +++ b/src/mu_of_r/f_hf_utils.irp.f @@ -1,41 +1,41 @@ BEGIN_PROVIDER [double precision, two_e_int_hf_f, (n_basis_orb,n_basis_orb,n_max_occ_val_orb_for_hf,n_max_occ_val_orb_for_hf)] implicit none BEGIN_DOC -! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) -! -! needed to compute the function f_{HF}(r_1,r_2) +! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) +! +! needed to compute the function f_{HF}(r_1,r_2) ! ! two_e_int_hf_f(j,i,n,m) = < j i | n m > where all orbitals belong to "list_basis" END_DOC integer :: orb_i,orb_j,i,j,orb_m,orb_n,m,n double precision :: get_two_e_integral - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals - do orb_m = 1, n_max_occ_val_orb_for_hf! electron 1 + PROVIDE all_mo_integrals big_array_exchange_integrals + do orb_m = 1, n_max_occ_val_orb_for_hf! electron 1 m = list_valence_orb_for_hf(orb_m,1) - do orb_n = 1, n_max_occ_val_orb_for_hf! electron 2 + do orb_n = 1, n_max_occ_val_orb_for_hf! electron 2 n = list_valence_orb_for_hf(orb_n,1) - do orb_i = 1, n_basis_orb ! electron 1 + do orb_i = 1, n_basis_orb ! electron 1 i = list_basis(orb_i) - do orb_j = 1, n_basis_orb ! electron 2 + do orb_j = 1, n_basis_orb ! electron 2 j = list_basis(orb_j) ! 2 1 2 1 - two_e_int_hf_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) + two_e_int_hf_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) enddo enddo enddo enddo -END_PROVIDER +END_PROVIDER subroutine f_HF_valence_ab(r1,r2,f_HF_val_ab,two_bod_dens) implicit none BEGIN_DOC -! f_HF_val_ab(r1,r2) = function f_{\Psi^B}(X_1,X_2) of Eq. (22) of J. Chem. Phys. 149, 194301 (2018) -! +! f_HF_val_ab(r1,r2) = function f_{\Psi^B}(X_1,X_2) of Eq. (22) of J. Chem. Phys. 149, 194301 (2018) +! ! for alpha beta spins and an HF wave function and excluding the "core" orbitals (see Eq. 16a of Phys.Chem.Lett.2019, 10, 2931 2937) -! -! two_bod_dens = on-top pair density of the HF wave function ! -! < HF | wee_{\alpha\beta} | HF > = \int (r1,r2) f_HF_ab(r1,r2) excluding all contributions from "core" "electrons" +! two_bod_dens = on-top pair density of the HF wave function +! +! < HF | wee_{\alpha\beta} | HF > = \int (r1,r2) f_HF_ab(r1,r2) excluding all contributions from "core" "electrons" END_DOC double precision, intent(in) :: r1(3), r2(3) double precision, intent(out):: f_HF_val_ab,two_bod_dens @@ -50,8 +50,8 @@ subroutine f_HF_valence_ab(r1,r2,f_HF_val_ab,two_bod_dens) allocate(mos_array_valence_r1(n_basis_orb) , mos_array_valence_r2(n_basis_orb), mos_array_r1(mo_num), mos_array_r2(mo_num)) allocate(mos_array_valence_hf_r1(n_occ_val_orb_for_hf(1)) , mos_array_valence_hf_r2(n_occ_val_orb_for_hf(2)) ) ! You get all orbitals in r_1 and r_2 - call give_all_mos_at_r(r1,mos_array_r1) - call give_all_mos_at_r(r2,mos_array_r2) + call give_all_mos_at_r(r1,mos_array_r1) + call give_all_mos_at_r(r2,mos_array_r2) ! You extract the occupied ALPHA/BETA orbitals belonging to the space \mathcal{A} do i_m = 1, n_occ_val_orb_for_hf(1) mos_array_valence_hf_r1(i_m) = mos_array_r1(list_valence_orb_for_hf(i_m,1)) @@ -61,7 +61,7 @@ subroutine f_HF_valence_ab(r1,r2,f_HF_val_ab,two_bod_dens) enddo ! You extract the orbitals belonging to the space \mathcal{B} - do i_m = 1, n_basis_orb + do i_m = 1, n_basis_orb mos_array_valence_r1(i_m) = mos_array_r1(list_basis(i_m)) mos_array_valence_r2(i_m) = mos_array_r2(list_basis(i_m)) enddo @@ -70,24 +70,24 @@ subroutine f_HF_valence_ab(r1,r2,f_HF_val_ab,two_bod_dens) f_HF_val_ab = 0.d0 two_bod_dens = 0.d0 ! You browse all OCCUPIED ALPHA electrons in the \mathcal{A} space - do m = 1, n_occ_val_orb_for_hf(1)! electron 1 + do m = 1, n_occ_val_orb_for_hf(1)! electron 1 ! You browse all OCCUPIED BETA electrons in the \mathcal{A} space - do n = 1, n_occ_val_orb_for_hf(2)! electron 2 + do n = 1, n_occ_val_orb_for_hf(2)! electron 2 ! two_bod_dens(r_1,r_2) = n_alpha(r_1) * n_beta(r_2) - two_bod_dens += mos_array_valence_hf_r1(m) * mos_array_valence_hf_r1(m) * mos_array_valence_hf_r2(n) * mos_array_valence_hf_r2(n) - ! You browse all COUPLE OF ORBITALS in the \mathacal{B} space + two_bod_dens += mos_array_valence_hf_r1(m) * mos_array_valence_hf_r1(m) * mos_array_valence_hf_r2(n) * mos_array_valence_hf_r2(n) + ! You browse all COUPLE OF ORBITALS in the \mathacal{B} space do i = 1, n_basis_orb do j = 1, n_basis_orb ! 2 1 2 1 - f_HF_val_ab += two_e_int_hf_f(j,i,n,m) & - * mos_array_valence_r1(i) * mos_array_valence_hf_r1(m) & - * mos_array_valence_r2(j) * mos_array_valence_hf_r2(n) + f_HF_val_ab += two_e_int_hf_f(j,i,n,m) & + * mos_array_valence_r1(i) * mos_array_valence_hf_r1(m) & + * mos_array_valence_r2(j) * mos_array_valence_hf_r2(n) enddo enddo enddo enddo ! multiply by two to adapt to the N(N-1) normalization condition of the active two-rdm - f_HF_val_ab *= 2.d0 + f_HF_val_ab *= 2.d0 two_bod_dens *= 2.d0 end @@ -95,14 +95,14 @@ subroutine f_HF_valence_ab(r1,r2,f_HF_val_ab,two_bod_dens) subroutine integral_f_HF_valence_ab(r1,int_f_HF_val_ab) implicit none BEGIN_DOC -! in_f_HF_val_ab(r_1) = \int dr_2 f_{\Psi^B}(r_1,r_2) -! -! where f_{\Psi^B}(r_1,r_2) is defined by Eq. (22) of J. Chem. Phys. 149, 194301 (2018) +! in_f_HF_val_ab(r_1) = \int dr_2 f_{\Psi^B}(r_1,r_2) +! +! where f_{\Psi^B}(r_1,r_2) is defined by Eq. (22) of J. Chem. Phys. 149, 194301 (2018) ! ! for alpha beta spins and an HF wave function and excluding the "core" orbitals (see Eq. 16a of Phys.Chem.Lett.2019, 10, 2931 2937) ! -! Such function can be used to test if the f_HF_val_ab(r_1,r_2) is correctly built. -! +! Such function can be used to test if the f_HF_val_ab(r_1,r_2) is correctly built. +! ! < HF | wee_{\alpha\beta} | HF > = \int (r1) int_f_HF_val_ab(r_1) END_DOC double precision, intent(in) :: r1(3) @@ -114,28 +114,28 @@ subroutine integral_f_HF_valence_ab(r1,int_f_HF_val_ab) double precision, allocatable :: mos_array_valence_r1(:) double precision, allocatable :: mos_array_valence_hf_r1(:) double precision :: get_two_e_integral - call give_all_mos_at_r(r1,mos_array_r1) + call give_all_mos_at_r(r1,mos_array_r1) allocate(mos_array_valence_r1( n_basis_orb )) allocate(mos_array_valence_hf_r1( n_occ_val_orb_for_hf(1) ) ) do i_m = 1, n_occ_val_orb_for_hf(1) mos_array_valence_hf_r1(i_m) = mos_array_r1(list_valence_orb_for_hf(i_m,1)) enddo - do i_m = 1, n_basis_orb + do i_m = 1, n_basis_orb mos_array_valence_r1(i_m) = mos_array_r1(list_basis(i_m)) enddo int_f_HF_val_ab = 0.d0 ! You browse all OCCUPIED ALPHA electrons in the \mathcal{A} space - do m = 1, n_occ_val_orb_for_hf(1)! electron 1 + do m = 1, n_occ_val_orb_for_hf(1)! electron 1 ! You browse all OCCUPIED BETA electrons in the \mathcal{A} space - do n = 1, n_occ_val_orb_for_hf(2)! electron 2 - ! You browse all ORBITALS in the \mathacal{B} space + do n = 1, n_occ_val_orb_for_hf(2)! electron 2 + ! You browse all ORBITALS in the \mathacal{B} space do i = 1, n_basis_orb - ! due to integration in real-space and the use of orthonormal MOs, a Kronecker delta_jn shoes up + ! due to integration in real-space and the use of orthonormal MOs, a Kronecker delta_jn shoes up j = n ! 2 1 2 1 - int_f_HF_val_ab += two_e_int_hf_f(j,i,n,m) & - * mos_array_valence_r1(i) * mos_array_valence_hf_r1(m) + int_f_HF_val_ab += two_e_int_hf_f(j,i,n,m) & + * mos_array_valence_r1(i) * mos_array_valence_hf_r1(m) enddo enddo enddo diff --git a/src/mu_of_r/f_psi_i_a_v_utils.irp.f b/src/mu_of_r/f_psi_i_a_v_utils.irp.f index 69fa16ff..0d51155c 100644 --- a/src/mu_of_r/f_psi_i_a_v_utils.irp.f +++ b/src/mu_of_r/f_psi_i_a_v_utils.irp.f @@ -1,7 +1,7 @@ subroutine give_f_ii_val_ab(r1,r2,f_ii_val_ab,two_bod_dens) implicit none BEGIN_DOC -! contribution from purely inactive orbitals to f_{\Psi^B}(r_1,r_2) for a CAS wave function +! contribution from purely inactive orbitals to f_{\Psi^B}(r_1,r_2) for a CAS wave function END_DOC double precision, intent(in) :: r1(3),r2(3) double precision, intent(out):: f_ii_val_ab,two_bod_dens @@ -9,13 +9,13 @@ subroutine give_f_ii_val_ab(r1,r2,f_ii_val_ab,two_bod_dens) integer :: i_i,i_j double precision, allocatable :: mos_array_inact_r1(:),mos_array_inact_r2(:) double precision, allocatable :: mos_array_basis_r1(:),mos_array_basis_r2(:) - double precision, allocatable :: mos_array_r1(:) , mos_array_r2(:) + double precision, allocatable :: mos_array_r1(:) , mos_array_r2(:) double precision :: get_two_e_integral ! You get all orbitals in r_1 and r_2 allocate(mos_array_r1(mo_num) , mos_array_r2(mo_num) ) - call give_all_mos_at_r(r1,mos_array_r1) - call give_all_mos_at_r(r2,mos_array_r2) - ! You extract the inactive orbitals + call give_all_mos_at_r(r1,mos_array_r1) + call give_all_mos_at_r(r2,mos_array_r2) + ! You extract the inactive orbitals allocate(mos_array_inact_r1(n_inact_orb) , mos_array_inact_r2(n_inact_orb) ) do i_m = 1, n_inact_orb mos_array_inact_r1(i_m) = mos_array_r1(list_inact(i_m)) @@ -26,7 +26,7 @@ subroutine give_f_ii_val_ab(r1,r2,f_ii_val_ab,two_bod_dens) ! You extract the orbitals belonging to the space \mathcal{B} allocate(mos_array_basis_r1(n_basis_orb) , mos_array_basis_r2(n_basis_orb) ) - do i_m = 1, n_basis_orb + do i_m = 1, n_basis_orb mos_array_basis_r1(i_m) = mos_array_r1(list_basis(i_m)) mos_array_basis_r2(i_m) = mos_array_r2(list_basis(i_m)) enddo @@ -34,30 +34,30 @@ subroutine give_f_ii_val_ab(r1,r2,f_ii_val_ab,two_bod_dens) f_ii_val_ab = 0.d0 two_bod_dens = 0.d0 ! You browse all OCCUPIED ALPHA electrons in the \mathcal{A} space - do m = 1, n_inact_orb ! electron 1 + do m = 1, n_inact_orb ! electron 1 ! You browse all OCCUPIED BETA electrons in the \mathcal{A} space - do n = 1, n_inact_orb ! electron 2 + do n = 1, n_inact_orb ! electron 2 ! two_bod_dens(r_1,r_2) = n_alpha(r_1) * n_beta(r_2) - two_bod_dens += mos_array_inact_r1(m) * mos_array_inact_r1(m) * mos_array_inact_r2(n) * mos_array_inact_r2(n) - ! You browse all COUPLE OF ORBITALS in the \mathacal{B} space + two_bod_dens += mos_array_inact_r1(m) * mos_array_inact_r1(m) * mos_array_inact_r2(n) * mos_array_inact_r2(n) + ! You browse all COUPLE OF ORBITALS in the \mathacal{B} space do i = 1, n_basis_orb do j = 1, n_basis_orb ! 2 1 2 1 - f_ii_val_ab += two_e_int_ii_f(j,i,n,m) * mos_array_inact_r1(m) * mos_array_basis_r1(i) & - * mos_array_inact_r2(n) * mos_array_basis_r2(j) + f_ii_val_ab += two_e_int_ii_f(j,i,n,m) * mos_array_inact_r1(m) * mos_array_basis_r1(i) & + * mos_array_inact_r2(n) * mos_array_basis_r2(j) enddo enddo enddo enddo ! multiply by two to adapt to the N(N-1) normalization condition of the active two-rdm - f_ii_val_ab *= 2.d0 + f_ii_val_ab *= 2.d0 two_bod_dens *= 2.d0 end subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) BEGIN_DOC -! contribution from inactive and active orbitals to f_{\Psi^B}(r_1,r_2) for the "istate" state of a CAS wave function +! contribution from inactive and active orbitals to f_{\Psi^B}(r_1,r_2) for the "istate" state of a CAS wave function END_DOC implicit none integer, intent(in) :: istate @@ -65,7 +65,7 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) double precision, intent(out):: f_ia_val_ab,two_bod_dens integer :: i,orb_i,a,orb_a,n,m,b double precision :: rho - double precision, allocatable :: mos_array_r1(:) , mos_array_r2(:) + double precision, allocatable :: mos_array_r1(:) , mos_array_r2(:) double precision, allocatable :: mos_array_inact_r1(:),mos_array_inact_r2(:) double precision, allocatable :: mos_array_basis_r1(:),mos_array_basis_r2(:) double precision, allocatable :: mos_array_act_r1(:),mos_array_act_r2(:) @@ -75,10 +75,10 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) two_bod_dens = 0.d0 ! You get all orbitals in r_1 and r_2 allocate(mos_array_r1(mo_num) , mos_array_r2(mo_num) ) - call give_all_mos_at_r(r1,mos_array_r1) - call give_all_mos_at_r(r2,mos_array_r2) + call give_all_mos_at_r(r1,mos_array_r1) + call give_all_mos_at_r(r2,mos_array_r2) - ! You extract the inactive orbitals + ! You extract the inactive orbitals allocate( mos_array_inact_r1(n_inact_orb) , mos_array_inact_r2(n_inact_orb) ) do i = 1, n_inact_orb mos_array_inact_r1(i) = mos_array_r1(list_inact(i)) @@ -87,7 +87,7 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) mos_array_inact_r2(i) = mos_array_r2(list_inact(i)) enddo - ! You extract the active orbitals + ! You extract the active orbitals allocate( mos_array_act_r1(n_basis_orb) , mos_array_act_r2(n_basis_orb) ) do i= 1, n_act_orb mos_array_act_r1(i) = mos_array_r1(list_act(i)) @@ -109,11 +109,11 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) ! rho_tilde(i,a) = \sum_b rho(b,a) * phi_i(1) * phi_j(2) allocate(rho_tilde(n_inact_orb,n_act_orb)) two_bod_dens = 0.d0 - do a = 1, n_act_orb + do a = 1, n_act_orb do i = 1, n_inact_orb rho_tilde(i,a) = 0.d0 - do b = 1, n_act_orb - rho = one_e_act_dm_beta_mo_for_dft(b,a,istate) + one_e_act_dm_alpha_mo_for_dft(b,a,istate) + do b = 1, n_act_orb + rho = one_e_act_dm_beta_mo_for_dft(b,a,istate) + one_e_act_dm_alpha_mo_for_dft(b,a,istate) two_bod_dens += mos_array_inact_r1(i) * mos_array_inact_r1(i) * mos_array_act_r2(a) * mos_array_act_r2(b) * rho rho_tilde(i,a) += rho * mos_array_inact_r1(i) * mos_array_act_r2(b) enddo @@ -125,12 +125,12 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) allocate( v_tilde(n_act_orb,n_act_orb) ) allocate( integrals_array(mo_num,mo_num) ) v_tilde = 0.d0 - do a = 1, n_act_orb + do a = 1, n_act_orb orb_a = list_act(a) do i = 1, n_inact_orb v_tilde(i,a) = 0.d0 orb_i = list_inact(i) -! call get_mo_two_e_integrals_ij(orb_i,orb_a,mo_num,integrals_array,mo_integrals_map) +! call get_mo_two_e_integrals_ij(orb_i,orb_a,mo_num,integrals_array,mo_integrals_map) do m = 1, n_basis_orb do n = 1, n_basis_orb ! v_tilde(i,a) += integrals_array(n,m) * mos_array_basis_r2(n) * mos_array_basis_r1(m) @@ -146,14 +146,14 @@ subroutine give_f_ia_val_ab(r1,r2,f_ia_val_ab,two_bod_dens,istate) enddo enddo ! multiply by two to adapt to the N(N-1) normalization condition of the active two-rdm - f_ia_val_ab *= 2.d0 + f_ia_val_ab *= 2.d0 two_bod_dens *= 2.d0 end subroutine give_f_aa_val_ab(r1,r2,f_aa_val_ab,two_bod_dens,istate) BEGIN_DOC -! contribution from purely active orbitals to f_{\Psi^B}(r_1,r_2) for the "istate" state of a CAS wave function +! contribution from purely active orbitals to f_{\Psi^B}(r_1,r_2) for the "istate" state of a CAS wave function END_DOC implicit none integer, intent(in) :: istate @@ -161,7 +161,7 @@ subroutine give_f_aa_val_ab(r1,r2,f_aa_val_ab,two_bod_dens,istate) double precision, intent(out):: f_aa_val_ab,two_bod_dens integer :: i,orb_i,a,orb_a,n,m,b,c,d double precision :: rho - double precision, allocatable :: mos_array_r1(:) , mos_array_r2(:) + double precision, allocatable :: mos_array_r1(:) , mos_array_r2(:) double precision, allocatable :: mos_array_basis_r1(:),mos_array_basis_r2(:) double precision, allocatable :: mos_array_act_r1(:),mos_array_act_r2(:) double precision, allocatable :: integrals_array(:,:),rho_tilde(:,:),v_tilde(:,:) @@ -170,10 +170,10 @@ subroutine give_f_aa_val_ab(r1,r2,f_aa_val_ab,two_bod_dens,istate) two_bod_dens = 0.d0 ! You get all orbitals in r_1 and r_2 allocate(mos_array_r1(mo_num) , mos_array_r2(mo_num) ) - call give_all_mos_at_r(r1,mos_array_r1) - call give_all_mos_at_r(r2,mos_array_r2) + call give_all_mos_at_r(r1,mos_array_r1) + call give_all_mos_at_r(r2,mos_array_r2) - ! You extract the active orbitals + ! You extract the active orbitals allocate( mos_array_act_r1(n_basis_orb) , mos_array_act_r2(n_basis_orb) ) do i= 1, n_act_orb mos_array_act_r1(i) = mos_array_r1(list_act(i)) @@ -201,8 +201,8 @@ subroutine give_f_aa_val_ab(r1,r2,f_aa_val_ab,two_bod_dens,istate) do c = 1, n_act_orb ! 1 do d = 1, n_act_orb ! 2 rho = mos_array_act_r1(c) * mos_array_act_r2(d) * act_2_rdm_ab_mo(d,c,b,a,istate) - rho_tilde(b,a) += rho - two_bod_dens += rho * mos_array_act_r1(a) * mos_array_act_r2(b) + rho_tilde(b,a) += rho + two_bod_dens += rho * mos_array_act_r1(a) * mos_array_act_r2(b) enddo enddo enddo @@ -212,7 +212,7 @@ subroutine give_f_aa_val_ab(r1,r2,f_aa_val_ab,two_bod_dens,istate) ! v_tilde(i,a) = \sum_{m,n} phi_m(1) * phi_n(2) < i a | m n > allocate( v_tilde(n_act_orb,n_act_orb) ) v_tilde = 0.d0 - do a = 1, n_act_orb + do a = 1, n_act_orb do b = 1, n_act_orb v_tilde(b,a) = 0.d0 do m = 1, n_basis_orb @@ -235,92 +235,92 @@ subroutine give_f_aa_val_ab(r1,r2,f_aa_val_ab,two_bod_dens,istate) BEGIN_PROVIDER [double precision, two_e_int_aa_f, (n_basis_orb,n_basis_orb,n_act_orb,n_act_orb)] implicit none BEGIN_DOC -! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) -! -! needed to compute the function f_{ii}(r_1,r_2) +! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) +! +! needed to compute the function f_{ii}(r_1,r_2) ! ! two_e_int_aa_f(j,i,n,m) = < j i | n m > where all orbitals belong to "list_basis" END_DOC integer :: orb_i,orb_j,i,j,orb_m,orb_n,m,n double precision :: integrals_array(mo_num,mo_num),get_two_e_integral - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals - do orb_m = 1, n_act_orb ! electron 1 + PROVIDE all_mo_integrals + do orb_m = 1, n_act_orb ! electron 1 m = list_act(orb_m) - do orb_n = 1, n_act_orb ! electron 2 + do orb_n = 1, n_act_orb ! electron 2 n = list_act(orb_n) - call get_mo_two_e_integrals_ij(m,n,mo_num,integrals_array,mo_integrals_map) - do orb_i = 1, n_basis_orb ! electron 1 + call get_mo_two_e_integrals_ij(m,n,mo_num,integrals_array,mo_integrals_map) + do orb_i = 1, n_basis_orb ! electron 1 i = list_basis(orb_i) - do orb_j = 1, n_basis_orb ! electron 2 + do orb_j = 1, n_basis_orb ! electron 2 j = list_basis(orb_j) ! 2 1 2 1 - two_e_int_aa_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) -! two_e_int_aa_f(orb_j,orb_i,orb_n,orb_m) = integrals_array(j,i) + two_e_int_aa_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) +! two_e_int_aa_f(orb_j,orb_i,orb_n,orb_m) = integrals_array(j,i) enddo enddo enddo enddo -END_PROVIDER +END_PROVIDER BEGIN_PROVIDER [double precision, two_e_int_ia_f, (n_basis_orb,n_basis_orb,n_inact_orb,n_act_orb)] implicit none BEGIN_DOC -! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) -! -! needed to compute the function f_{ia}(r_1,r_2) +! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) +! +! needed to compute the function f_{ia}(r_1,r_2) ! ! two_e_int_aa_f(j,i,n,m) = < j i | n m > where all orbitals belong to "list_basis" END_DOC integer :: orb_i,orb_j,i,j,orb_m,orb_n,m,n double precision :: integrals_array(mo_num,mo_num),get_two_e_integral - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals - do orb_m = 1, n_act_orb ! electron 1 + PROVIDE all_mo_integrals + do orb_m = 1, n_act_orb ! electron 1 m = list_act(orb_m) - do orb_n = 1, n_inact_orb ! electron 2 + do orb_n = 1, n_inact_orb ! electron 2 n = list_inact(orb_n) - call get_mo_two_e_integrals_ij(m,n,mo_num,integrals_array,mo_integrals_map) - do orb_i = 1, n_basis_orb ! electron 1 + call get_mo_two_e_integrals_ij(m,n,mo_num,integrals_array,mo_integrals_map) + do orb_i = 1, n_basis_orb ! electron 1 i = list_basis(orb_i) - do orb_j = 1, n_basis_orb ! electron 2 + do orb_j = 1, n_basis_orb ! electron 2 j = list_basis(orb_j) ! 2 1 2 1 -! two_e_int_ia_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) - two_e_int_ia_f(orb_j,orb_i,orb_n,orb_m) = integrals_array(j,i) +! two_e_int_ia_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) + two_e_int_ia_f(orb_j,orb_i,orb_n,orb_m) = integrals_array(j,i) enddo enddo enddo enddo -END_PROVIDER +END_PROVIDER BEGIN_PROVIDER [double precision, two_e_int_ii_f, (n_basis_orb,n_basis_orb,n_inact_orb,n_inact_orb)] implicit none BEGIN_DOC -! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) -! -! needed to compute the function f_{ii}(r_1,r_2) +! list of two-electron integrals (built with the MOs belonging to the \mathcal{B} space) +! +! needed to compute the function f_{ii}(r_1,r_2) ! ! two_e_int_ii_f(j,i,n,m) = < j i | n m > where all orbitals belong to "list_basis" END_DOC integer :: orb_i,orb_j,i,j,orb_m,orb_n,m,n double precision :: get_two_e_integral,integrals_array(mo_num,mo_num) - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals - do orb_m = 1, n_inact_orb ! electron 1 + PROVIDE all_mo_integrals + do orb_m = 1, n_inact_orb ! electron 1 m = list_inact(orb_m) - do orb_n = 1, n_inact_orb ! electron 2 + do orb_n = 1, n_inact_orb ! electron 2 n = list_inact(orb_n) - call get_mo_two_e_integrals_ij(m,n,mo_num,integrals_array,mo_integrals_map) - do orb_i = 1, n_basis_orb ! electron 1 + call get_mo_two_e_integrals_ij(m,n,mo_num,integrals_array,mo_integrals_map) + do orb_i = 1, n_basis_orb ! electron 1 i = list_basis(orb_i) - do orb_j = 1, n_basis_orb ! electron 2 + do orb_j = 1, n_basis_orb ! electron 2 j = list_basis(orb_j) ! 2 1 2 1 -! two_e_int_ii_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) - two_e_int_ii_f(orb_j,orb_i,orb_n,orb_m) = integrals_array(j,i) +! two_e_int_ii_f(orb_j,orb_i,orb_n,orb_m) = get_two_e_integral(m,n,i,j,mo_integrals_map) + two_e_int_ii_f(orb_j,orb_i,orb_n,orb_m) = integrals_array(j,i) enddo enddo enddo enddo -END_PROVIDER +END_PROVIDER subroutine give_mu_of_r_cas(r,istate,mu_of_r,f_psi,n2_psi) @@ -343,13 +343,13 @@ subroutine give_mu_of_r_cas(r,istate,mu_of_r,f_psi,n2_psi) ! active-active part of f_psi(r1,r2) call give_f_aa_val_ab(r,r,f_aa_val_ab,two_bod_dens_aa,istate) - f_psi = f_ii_val_ab + f_ia_val_ab + f_aa_val_ab + f_psi = f_ii_val_ab + f_ia_val_ab + f_aa_val_ab n2_psi = two_bod_dens_ii + two_bod_dens_ia + two_bod_dens_aa if(n2_psi.le.1.d-12.or.f_psi.le.0.d0.or.f_psi * n2_psi.lt.0.d0)then w_psi = 1.d+10 - else + else w_psi = f_psi / n2_psi endif mu_of_r = w_psi * sqpi * 0.5d0 - + end diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index f2bb7145..88dad8c3 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -1,12 +1,12 @@ BEGIN_PROVIDER [double precision, mu_of_r_prov, (n_points_final_grid,N_states) ] - implicit none + implicit none BEGIN_DOC - ! general variable for mu(r) + ! general variable for mu(r) ! - ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) + ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) ! - ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals ! ! in the two-body density matrix are excluded END_DOC @@ -31,7 +31,7 @@ mu_of_r_prov(ipoint,istate) = mu_of_r_hf_sparse(ipoint) else if(mu_of_r_potential.EQ."cas_full".or.mu_of_r_potential.EQ."cas_truncated".or.mu_of_r_potential.EQ."pure_act")then mu_of_r_prov(ipoint,istate) = mu_of_r_psi_cas(ipoint,istate) - else + else print*,'you requested the following mu_of_r_potential' print*,mu_of_r_potential print*,'which does not correspond to any of the options for such keyword' @@ -42,23 +42,23 @@ if (write_mu_of_r) then print*,'Writing mu(r) on disk ...' - call ezfio_set_mu_of_r_io_mu_of_r('Read') - call ezfio_set_mu_of_r_mu_of_r_disk(mu_of_r_prov) + call ezfio_set_mu_of_r_io_mu_of_r('Read') + call ezfio_set_mu_of_r_mu_of_r_disk(mu_of_r_prov) endif call wall_time(wall1) print*,'Time to provide mu_of_r = ',wall1-wall0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, mu_of_r_hf, (n_points_final_grid) ] - implicit none + implicit none BEGIN_DOC ! mu(r) computed with a HF wave function (assumes that HF MOs are stored in the EZFIO) ! ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) but for \Psi^B = HF^B ! - ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals ! ! in the two-body density matrix are excluded END_DOC @@ -70,14 +70,14 @@ sqpi = dsqrt(dacos(-1.d0)) !$OMP PARALLEL DO & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (ipoint,f_hf,on_top,w_hf) & - !$OMP ShARED (n_points_final_grid,mu_of_r_hf,f_hf_cholesky,on_top_hf_grid,sqpi) + !$OMP PRIVATE (ipoint,f_hf,on_top,w_hf) & + !$OMP ShARED (n_points_final_grid,mu_of_r_hf,f_hf_cholesky,on_top_hf_grid,sqpi) do ipoint = 1, n_points_final_grid f_hf = f_hf_cholesky(ipoint) on_top = on_top_hf_grid(ipoint) if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then w_hf = 1.d+10 - else + else w_hf = f_hf / on_top endif mu_of_r_hf(ipoint) = w_hf * sqpi * 0.5d0 @@ -85,16 +85,16 @@ !$OMP END PARALLEL DO call wall_time(wall1) print*,'Time to provide mu_of_r_hf = ',wall1-wall0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, mu_of_r_hf_sparse, (n_points_final_grid) ] - implicit none + implicit none BEGIN_DOC ! mu(r) computed with a HF wave function (assumes that HF MOs are stored in the EZFIO) ! ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) but for \Psi^B = HF^B ! - ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals ! ! in the two-body density matrix are excluded END_DOC @@ -106,14 +106,14 @@ PROVIDE f_hf_cholesky_sparse on_top_hf_grid !$OMP PARALLEL DO & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (ipoint,f_hf,on_top,w_hf) & - !$OMP ShARED (n_points_final_grid,mu_of_r_hf_sparse,f_hf_cholesky_sparse,on_top_hf_grid,sqpi) + !$OMP PRIVATE (ipoint,f_hf,on_top,w_hf) & + !$OMP ShARED (n_points_final_grid,mu_of_r_hf_sparse,f_hf_cholesky_sparse,on_top_hf_grid,sqpi) do ipoint = 1, n_points_final_grid f_hf = f_hf_cholesky_sparse(ipoint) on_top = on_top_hf_grid(ipoint) if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then w_hf = 1.d+10 - else + else w_hf = f_hf / on_top endif mu_of_r_hf_sparse(ipoint) = w_hf * sqpi * 0.5d0 @@ -121,36 +121,36 @@ !$OMP END PARALLEL DO call wall_time(wall1) print*,'Time to provide mu_of_r_hf_sparse = ',wall1-wall0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, mu_of_r_hf_old, (n_points_final_grid) ] - implicit none + implicit none BEGIN_DOC ! mu(r) computed with a HF wave function (assumes that HF MOs are stored in the EZFIO) ! ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) but for \Psi^B = HF^B ! - ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals ! ! in the two-body density matrix are excluded END_DOC integer :: ipoint double precision :: wall0,wall1,f_hf,on_top,w_hf,sqpi - PROVIDE mo_two_e_integrals_in_map mo_integrals_map big_array_exchange_integrals + PROVIDE all_mo_integrals print*,'providing mu_of_r_hf_old ...' call wall_time(wall0) sqpi = dsqrt(dacos(-1.d0)) - provide f_psi_hf_ab + provide f_psi_hf_ab !$OMP PARALLEL DO & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (ipoint,f_hf,on_top,w_hf) & - !$OMP ShARED (n_points_final_grid,mu_of_r_hf_old,f_psi_hf_ab,on_top_hf_mu_r,sqpi) + !$OMP PRIVATE (ipoint,f_hf,on_top,w_hf) & + !$OMP ShARED (n_points_final_grid,mu_of_r_hf_old,f_psi_hf_ab,on_top_hf_mu_r,sqpi) do ipoint = 1, n_points_final_grid f_hf = f_psi_hf_ab(ipoint) on_top = on_top_hf_mu_r(ipoint) if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then w_hf = 1.d+10 - else + else w_hf = f_hf / on_top endif mu_of_r_hf_old(ipoint) = w_hf * sqpi * 0.5d0 @@ -158,17 +158,17 @@ !$OMP END PARALLEL DO call wall_time(wall1) print*,'Time to provide mu_of_r_hf_old = ',wall1-wall0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, mu_of_r_psi_cas, (n_points_final_grid,N_states) ] - implicit none + implicit none BEGIN_DOC ! mu(r) computed with a wave function developped in an active space ! - ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) + ! corresponds to Eq. (37) of J. Chem. Phys. 149, 194301 (2018) ! - ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals ! ! in the one- and two-body density matrix are excluded END_DOC @@ -181,15 +181,15 @@ provide f_psi_cas_ab !$OMP PARALLEL DO & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (ipoint,f_psi,on_top,w_psi,istate) & - !$OMP SHARED (n_points_final_grid,mu_of_r_psi_cas,f_psi_cas_ab,on_top_cas_mu_r,sqpi,N_states) + !$OMP PRIVATE (ipoint,f_psi,on_top,w_psi,istate) & + !$OMP SHARED (n_points_final_grid,mu_of_r_psi_cas,f_psi_cas_ab,on_top_cas_mu_r,sqpi,N_states) do istate = 1, N_states do ipoint = 1, n_points_final_grid - f_psi = f_psi_cas_ab(ipoint,istate) - on_top = on_top_cas_mu_r(ipoint,istate) + f_psi = f_psi_cas_ab(ipoint,istate) + on_top = on_top_cas_mu_r(ipoint,istate) if(on_top.le.1.d-12.or.f_psi.le.0.d0.or.f_psi * on_top.lt.0.d0)then w_psi = 1.d+10 - else + else w_psi = f_psi / on_top endif mu_of_r_psi_cas(ipoint,istate) = w_psi * sqpi * 0.5d0 @@ -198,15 +198,15 @@ !$OMP END PARALLEL DO call wall_time(wall1) print*,'Time to provide mu_of_r_psi_cas = ',wall1-wall0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, mu_average_prov, (N_states)] implicit none BEGIN_DOC - ! average value of mu(r) weighted with the total one-e density and divided by the number of electrons + ! average value of mu(r) weighted with the total one-e density and divided by the number of electrons ! - ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals ! ! in the one- and two-body density matrix are excluded END_DOC @@ -216,12 +216,12 @@ do istate = 1, N_states do ipoint = 1, n_points_final_grid weight =final_weight_at_r_vector(ipoint) - density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle mu_average_prov(istate) += mu_of_r_prov(ipoint,istate) * weight * density enddo mu_average_prov(istate) = mu_average_prov(istate) / elec_num_grid_becke(istate) enddo - END_PROVIDER + END_PROVIDER diff --git a/src/tools/fcidump.irp.f b/src/tools/fcidump.irp.f index bf4d07fb..df050218 100644 --- a/src/tools/fcidump.irp.f +++ b/src/tools/fcidump.irp.f @@ -41,7 +41,7 @@ program fcidump integer(key_kind), allocatable :: keys(:) double precision, allocatable :: values(:) integer(cache_map_size_kind) :: n_elements, n_elements_max - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals double precision :: get_two_e_integral, integral diff --git a/src/tools/fcidump_pyscf.irp.f b/src/tools/fcidump_pyscf.irp.f index aaa552b4..e6962a60 100644 --- a/src/tools/fcidump_pyscf.irp.f +++ b/src/tools/fcidump_pyscf.irp.f @@ -41,7 +41,7 @@ program fcidump_pyscf integer(key_kind), allocatable :: keys(:) double precision, allocatable :: values(:) integer(cache_map_size_kind) :: n_elements, n_elements_max - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals double precision :: get_two_e_integral, integral diff --git a/src/tools/four_idx_transform.irp.f b/src/tools/four_idx_transform.irp.f index fc6bface..cd1db0c0 100644 --- a/src/tools/four_idx_transform.irp.f +++ b/src/tools/four_idx_transform.irp.f @@ -18,6 +18,6 @@ program four_idx_transform io_mo_two_e_integrals = 'Write' SOFT_TOUCH io_mo_two_e_integrals if (.true.) then - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals endif end diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index 5bc44880..0774bcd9 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -505,7 +505,7 @@ subroutine export_trexio(update,full_path) if (export_mo_two_e_ints) then print *, 'MO two-e integrals' - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals double precision, external :: mo_two_e_integral diff --git a/src/two_body_rdm/act_2_rdm.irp.f b/src/two_body_rdm/act_2_rdm.irp.f index c550e991..9e2ea018 100644 --- a/src/two_body_rdm/act_2_rdm.irp.f +++ b/src/two_body_rdm/act_2_rdm.irp.f @@ -4,34 +4,34 @@ BEGIN_DOC ! 12 12 ! 1 2 1 2 == -! act_2_rdm_ab_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM of alpha/beta+beta/alpha electrons -! +! act_2_rdm_ab_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM of alpha/beta+beta/alpha electrons +! ! ! ! + ! -! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" +! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" ! ! THE NORMALIZATION (i.e. sum of diagonal elements) IS SET TO N_{\alpha}^{act} * N_{\beta}^{act} * 2 ! -! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" +! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" ! - END_DOC + END_DOC integer :: ispin double precision :: wall_1, wall_2 - character*(128) :: name_file + character*(128) :: name_file name_file = 'act_2_rdm_ab_mo' ! condition for alpha/beta spin print*,'' print*,'Providing act_2_rdm_ab_mo ' - ispin = 3 + ispin = 3 act_2_rdm_ab_mo = 0.d0 - provide mo_two_e_integrals_in_map + provide all_mo_integrals call wall_time(wall_1) if(read_two_body_rdm_ab)then print*,'Reading act_2_rdm_ab_mo from disk ...' call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_ab_mo,name_file) - else + else call orb_range_2_rdm_openmp(act_2_rdm_ab_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1)) endif if(write_two_body_rdm_ab)then @@ -42,36 +42,36 @@ call wall_time(wall_2) print*,'Wall time to provide act_2_rdm_ab_mo',wall_2 - wall_1 act_2_rdm_ab_mo *= 2.d0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, act_2_rdm_aa_mo, (n_act_orb,n_act_orb,n_act_orb,n_act_orb,N_states)] implicit none BEGIN_DOC -! act_2_rdm_aa_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM of ALPHA/ALPHA electrons -! +! act_2_rdm_aa_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM of ALPHA/ALPHA electrons +! ! ! -! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" +! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" ! ! THE NORMALIZATION (i.e. sum of diagonal elements) IS SET TO N_{\alpha}^{act} * (N_{\alpha}^{act} - 1) ! -! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" - END_DOC +! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" + END_DOC integer :: ispin double precision :: wall_1, wall_2 ! condition for alpha/beta spin print*,'' print*,'Providing act_2_rdm_aa_mo ' - character*(128) :: name_file + character*(128) :: name_file name_file = 'act_2_rdm_aa_mo' - ispin = 1 + ispin = 1 act_2_rdm_aa_mo = 0.d0 call wall_time(wall_1) if(read_two_body_rdm_aa)then print*,'Reading act_2_rdm_aa_mo from disk ...' call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_aa_mo,name_file) - else + else call orb_range_2_rdm_openmp(act_2_rdm_aa_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1)) endif if(write_two_body_rdm_aa)then @@ -83,36 +83,36 @@ call wall_time(wall_2) print*,'Wall time to provide act_2_rdm_aa_mo',wall_2 - wall_1 act_2_rdm_aa_mo *= 2.d0 - END_PROVIDER - + END_PROVIDER + BEGIN_PROVIDER [double precision, act_2_rdm_bb_mo, (n_act_orb,n_act_orb,n_act_orb,n_act_orb,N_states)] implicit none BEGIN_DOC -! act_2_rdm_bb_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM of BETA/BETA electrons -! +! act_2_rdm_bb_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM of BETA/BETA electrons +! ! ! -! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" +! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" ! ! THE NORMALIZATION (i.e. sum of diagonal elements) IS SET TO N_{\beta}^{act} * (N_{\beta}^{act} - 1) ! -! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" - END_DOC +! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" + END_DOC integer :: ispin double precision :: wall_1, wall_2 ! condition for beta/beta spin print*,'' print*,'Providing act_2_rdm_bb_mo ' - character*(128) :: name_file + character*(128) :: name_file name_file = 'act_2_rdm_bb_mo' - ispin = 2 + ispin = 2 act_2_rdm_bb_mo = 0.d0 call wall_time(wall_1) if(read_two_body_rdm_bb)then print*,'Reading act_2_rdm_bb_mo from disk ...' call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_bb_mo,name_file) - else + else call orb_range_2_rdm_openmp(act_2_rdm_bb_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1)) endif if(write_two_body_rdm_bb)then @@ -124,35 +124,35 @@ call wall_time(wall_2) print*,'Wall time to provide act_2_rdm_bb_mo',wall_2 - wall_1 act_2_rdm_bb_mo *= 2.d0 - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, act_2_rdm_spin_trace_mo, (n_act_orb,n_act_orb,n_act_orb,n_act_orb,N_states)] implicit none BEGIN_DOC -! act_2_rdm_spin_trace_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM -! +! act_2_rdm_spin_trace_mo(i,j,k,l,istate) = STATE SPECIFIC physicist notation for 2RDM +! ! \sum_{\sigma,\sigma'} ! -! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" +! WHERE ALL ORBITALS (i,j,k,l) BELONGS TO AN ACTIVE SPACE DEFINED BY "list_act" ! ! THE NORMALIZATION (i.e. sum of diagonal elements) IS SET TO N_{elec}^{act} * (N_{elec}^{act} - 1) ! -! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" - END_DOC +! !!!!! WARNING !!!!! ALL SLATER DETERMINANTS IN PSI_DET MUST BELONG TO AN ACTIVE SPACE DEFINED BY "list_act" + END_DOC integer :: ispin double precision :: wall_1, wall_2 ! condition for beta/beta spin print*,'' print*,'Providing act_2_rdm_spin_trace_mo ' - character*(128) :: name_file + character*(128) :: name_file name_file = 'act_2_rdm_spin_trace_mo' - ispin = 4 + ispin = 4 act_2_rdm_spin_trace_mo = 0.d0 call wall_time(wall_1) if(read_two_body_rdm_spin_trace)then print*,'Reading act_2_rdm_spin_trace_mo from disk ...' call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_spin_trace_mo,name_file) - else + else call orb_range_2_rdm_openmp(act_2_rdm_spin_trace_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1)) endif if(write_two_body_rdm_spin_trace)then @@ -164,4 +164,4 @@ act_2_rdm_spin_trace_mo *= 2.d0 call wall_time(wall_2) print*,'Wall time to provide act_2_rdm_spin_trace_mo',wall_2 - wall_1 - END_PROVIDER + END_PROVIDER diff --git a/src/two_rdm_routines/davidson_like_2rdm.irp.f b/src/two_rdm_routines/davidson_like_2rdm.irp.f index ad7a3b21..09436663 100644 --- a/src/two_rdm_routines/davidson_like_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_2rdm.irp.f @@ -2,9 +2,9 @@ subroutine orb_range_2_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N_st,sz use bitmasks implicit none BEGIN_DOC - ! if ispin == 1 :: alpha/alpha 2rdm - ! == 2 :: beta /beta 2rdm - ! == 3 :: alpha/beta + beta/alpha 2rdm + ! if ispin == 1 :: alpha/alpha 2rdm + ! == 2 :: beta /beta 2rdm + ! == 3 :: alpha/beta + beta/alpha 2rdm ! == 4 :: spin traced 2rdm :: aa + bb + ab + ba ! ! Assumes that the determinants are in psi_det @@ -19,7 +19,7 @@ subroutine orb_range_2_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N_st,sz integer :: k double precision, allocatable :: u_t(:,:) !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: u_t - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals allocate(u_t(N_st,N_det)) do k=1,N_st call dset_order(u_0(1,k),psi_bilinear_matrix_order,N_det) @@ -30,14 +30,14 @@ subroutine orb_range_2_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N_st,sz u_t, & size(u_t, 1), & N_det, N_st) - + call orb_range_2_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,1,N_det,0,1) deallocate(u_t) - + do k=1,N_st call dset_order(u_0(1,k),psi_bilinear_matrix_order_reverse,N_det) enddo - + end subroutine orb_range_2_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) @@ -52,11 +52,11 @@ subroutine orb_range_2_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_ integer, intent(in) :: dim1,norb,list_orb(norb),ispin double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1) double precision, intent(in) :: u_t(N_st,N_det) - + integer :: k - + PROVIDE N_int - + select case (N_int) case (1) call orb_range_2_rdm_openmp_work_1(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) @@ -70,9 +70,9 @@ subroutine orb_range_2_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_ call orb_range_2_rdm_openmp_work_N_int(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) end select end - - - + + + BEGIN_TEMPLATE subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) @@ -81,9 +81,9 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin implicit none BEGIN_DOC ! Computes the two rdm for the N_st vectors |u_t> - ! if ispin == 1 :: alpha/alpha 2rdm - ! == 2 :: beta /beta 2rdm - ! == 3 :: alpha/beta 2rdm + ! if ispin == 1 :: alpha/alpha 2rdm + ! == 2 :: beta /beta 2rdm + ! == 3 :: alpha/beta 2rdm ! == 4 :: spin traced 2rdm :: aa + bb + 0.5 (ab + ba)) ! The 2rdm will be computed only on the list of orbitals list_orb, which contains norb ! Default should be 1,N_det,0,1 for istart,iend,ishift,istep @@ -92,7 +92,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin double precision, intent(in) :: u_t(N_st,N_det) integer, intent(in) :: dim1,norb,list_orb(norb),ispin double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1) - + integer(omp_lock_kind) :: lock_2rdm integer :: i,j,k,l integer :: k_a, k_b, l_a, l_b @@ -116,7 +116,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin integer, allocatable :: keys(:,:) double precision, allocatable :: values(:,:) integer :: nkeys,sze_buff - alpha_alpha = .False. + alpha_alpha = .False. beta_beta = .False. alpha_beta = .False. spin_trace = .False. @@ -134,27 +134,27 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin stop endif - + PROVIDE N_int call list_to_bitstring( orb_bitmask, list_orb, norb, N_int) - sze_buff = 6 * norb + elec_alpha_num * elec_alpha_num * 60 - list_orb_reverse = -1000 + sze_buff = 6 * norb + elec_alpha_num * elec_alpha_num * 60 + list_orb_reverse = -1000 do i = 1, norb - list_orb_reverse(list_orb(i)) = i + list_orb_reverse(list_orb(i)) = i enddo maxab = max(N_det_alpha_unique, N_det_beta_unique)+1 allocate(idx0(maxab)) - + do i=1,maxab idx0(i) = i enddo call omp_init_lock(lock_2rdm) - + ! Prepare the array of all alpha single excitations ! ------------------------------------------------- - - PROVIDE N_int nthreads_davidson elec_alpha_num + + PROVIDE N_int nthreads_davidson elec_alpha_num !$OMP PARALLEL DEFAULT(NONE) NUM_THREADS(nthreads_davidson) & !$OMP SHARED(psi_bilinear_matrix_rows, N_det,lock_2rdm,& !$OMP psi_bilinear_matrix_columns, & @@ -166,7 +166,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin !$OMP psi_bilinear_matrix_order_transp_reverse, & !$OMP psi_bilinear_matrix_columns_loc, & !$OMP psi_bilinear_matrix_transp_rows_loc,elec_alpha_num, & - !$OMP istart, iend, istep, irp_here,list_orb_reverse, n_states, dim1, & + !$OMP istart, iend, istep, irp_here,list_orb_reverse, n_states, dim1, & !$OMP ishift, idx0, u_t, maxab, alpha_alpha,beta_beta,alpha_beta,spin_trace,ispin,big_array,sze_buff,orb_bitmask) & !$OMP PRIVATE(krow, kcol, tmp_det, spindet, k_a, k_b, i,c_1, & !$OMP lcol, lrow, l_a, l_b, & @@ -174,35 +174,35 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin !$OMP tmp_det2, idx, l, kcol_prev, & !$OMP singles_a, n_singles_a, singles_b, & !$OMP n_singles_b, nkeys, keys, values) - + ! Alpha/Beta double excitations ! ============================= nkeys = 0 - allocate( keys(4,sze_buff), values(n_st,sze_buff)) + allocate( keys(4,sze_buff), values(n_st,sze_buff)) allocate( buffer($N_int,maxab), & singles_a(maxab), & singles_b(maxab), & doubles(maxab), & idx(maxab)) - + kcol_prev=-1 - + ASSERT (iend <= N_det) ASSERT (istart > 0) ASSERT (istep > 0) - + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep - + krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) - + kcol = psi_bilinear_matrix_columns(k_a) ASSERT (kcol <= N_det_beta_unique) - + 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) - + if (kcol /= kcol_prev) then call get_all_spin_singles_$N_int( & psi_det_beta_unique, idx0, & @@ -210,58 +210,58 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin singles_b, n_singles_b) endif kcol_prev = kcol - + ! Loop over singly excited beta columns ! ------------------------------------- - + do i=1,n_singles_b lcol = singles_b(i) - + tmp_det2(1:$N_int,2) = psi_det_beta_unique(1:$N_int, lcol) - + l_a = psi_bilinear_matrix_columns_loc(lcol) ASSERT (l_a <= N_det) - + do j=1,psi_bilinear_matrix_columns_loc(lcol+1) - l_a lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + buffer(1:$N_int,j) = psi_det_alpha_unique(1:$N_int, lrow) - + ASSERT (l_a <= N_det) idx(j) = l_a l_a = l_a+1 enddo j = j-1 - + call get_all_spin_singles_$N_int( & buffer, idx, tmp_det(1,1), j, & singles_a, n_singles_a ) - + ! Loop over alpha singles ! ----------------------- - + if(alpha_beta.or.spin_trace)then do k = 1,n_singles_a l_a = singles_a(k) ASSERT (l_a <= N_det) - + lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) ! print*,'nkeys before = ',nkeys do l= 1, N_states c_1(l) = u_t(l,l_a) * u_t(l,k_a) enddo if(alpha_beta)then - ! only ONE contribution + ! only ONE contribution if (nkeys+1 .ge. sze_buff) then call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 endif else if (spin_trace)then - ! TWO contributions + ! TWO contributions if (nkeys+2 .ge. sze_buff) then call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 @@ -271,42 +271,42 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin enddo endif - + call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 enddo - + enddo !$OMP END DO - + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep - - + + ! Single and double alpha exitations ! =================================== - - + + ! Initial determinant is at k_a in alpha-major representation ! ----------------------------------------------------------------------- - + krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) - + kcol = psi_bilinear_matrix_columns(k_a) ASSERT (kcol <= N_det_beta_unique) - + 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) - + ! Initial determinant is at k_b in beta-major representation ! ---------------------------------------------------------------------- - + k_b = psi_bilinear_matrix_order_transp_reverse(k_a) ASSERT (k_b <= N_det) - + spindet(1:$N_int) = tmp_det(1:$N_int,1) - + ! Loop inside the beta column to gather all the connected alphas lcol = psi_bilinear_matrix_columns(k_a) l_a = psi_bilinear_matrix_columns_loc(lcol) @@ -316,28 +316,28 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin if (lcol /= kcol) exit lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + buffer(1:$N_int,i) = psi_det_alpha_unique(1:$N_int, lrow) idx(i) = l_a l_a = l_a+1 enddo i = i-1 - + call get_all_spin_singles_and_doubles_$N_int( & buffer, idx, spindet, i, & singles_a, doubles, n_singles_a, n_doubles ) - + ! Compute Hij for all alpha singles ! ---------------------------------- - + tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, kcol) do i=1,n_singles_a l_a = singles_a(i) ASSERT (l_a <= N_det) - + lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) do l= 1, N_states c_1(l) = u_t(l,l_a) * u_t(l,k_a) @@ -356,23 +356,23 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin endif call orb_range_off_diag_single_to_all_states_aa_dm_buffer(tmp_det,tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) endif - + enddo - + call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 - + ! Compute Hij for all alpha doubles ! ---------------------------------- - + if(alpha_alpha.or.spin_trace)then do i=1,n_doubles l_a = doubles(i) ASSERT (l_a <= N_det) - + lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + do l= 1, N_states c_1(l) = u_t(l,l_a) * u_t(l,k_a) enddo @@ -385,29 +385,29 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin endif call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 - - + + ! Single and double beta excitations ! ================================== - - + + ! Initial determinant is at k_a in alpha-major representation ! ----------------------------------------------------------------------- - + krow = psi_bilinear_matrix_rows(k_a) kcol = psi_bilinear_matrix_columns(k_a) - + 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) - + spindet(1:$N_int) = tmp_det(1:$N_int,2) - + ! Initial determinant is at k_b in beta-major representation ! ----------------------------------------------------------------------- - + k_b = psi_bilinear_matrix_order_transp_reverse(k_a) ASSERT (k_b <= N_det) - + ! Loop inside the alpha row to gather all the connected betas lrow = psi_bilinear_matrix_transp_rows(k_b) l_b = psi_bilinear_matrix_transp_rows_loc(lrow) @@ -417,28 +417,28 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin if (lrow /= krow) exit lcol = psi_bilinear_matrix_transp_columns(l_b) ASSERT (lcol <= N_det_beta_unique) - + buffer(1:$N_int,i) = psi_det_beta_unique(1:$N_int, lcol) idx(i) = l_b l_b = l_b+1 enddo i = i-1 - + call get_all_spin_singles_and_doubles_$N_int( & buffer, idx, spindet, i, & singles_b, doubles, n_singles_b, n_doubles ) - + ! Compute Hij for all beta singles ! ---------------------------------- - + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, krow) do i=1,n_singles_b l_b = singles_b(i) ASSERT (l_b <= N_det) - + lcol = psi_bilinear_matrix_transp_columns(l_b) ASSERT (lcol <= N_det_beta_unique) - + tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol) l_a = psi_bilinear_matrix_transp_order(l_b) do l= 1, N_states @@ -461,18 +461,18 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin enddo call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 - + ! Compute Hij for all beta doubles ! ---------------------------------- - + if(beta_beta.or.spin_trace)then do i=1,n_doubles l_b = doubles(i) ASSERT (l_b <= N_det) - + lcol = psi_bilinear_matrix_transp_columns(l_b) ASSERT (lcol <= N_det_beta_unique) - + l_a = psi_bilinear_matrix_transp_order(l_b) do l= 1, N_states c_1(l) = u_t(l,l_a) * u_t(l,k_a) @@ -484,59 +484,59 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin call orb_range_off_diag_double_to_all_states_bb_dm_buffer(tmp_det(1,2),psi_det_beta_unique(1, lcol),c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) ! print*,'to do orb_range_off_diag_double_to_2_rdm_bb_dm_buffer' ASSERT (l_a <= N_det) - + enddo endif call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 - - + + ! Diagonal contribution ! ===================== - - + + ! Initial determinant is at k_a in alpha-major representation ! ----------------------------------------------------------------------- - + krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) - + kcol = psi_bilinear_matrix_columns(k_a) ASSERT (kcol <= N_det_beta_unique) - + 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_wee_mat_elem, diag_S_mat_elem - + double precision :: c_1(N_states) do l = 1, N_states c_1(l) = u_t(l,k_a) * u_t(l,k_a) enddo - + call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 call orb_range_diag_to_all_states_2_rdm_dm_buffer(tmp_det,c_1,N_states,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) nkeys = 0 - + end do !$OMP END DO deallocate(buffer, singles_a, singles_b, doubles, idx, keys, values) !$OMP END PARALLEL - + end - + SUBST [ N_int ] - + 1;; 2;; 3;; 4;; N_int;; - + END_TEMPLATE - + subroutine update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) use omp_lib @@ -545,7 +545,7 @@ subroutine update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,loc integer, intent(in) :: keys(4,nkeys) double precision, intent(in) :: values(n_st,nkeys) double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,n_st) - + integer(omp_lock_kind),intent(inout):: lock_2rdm integer :: istate diff --git a/src/two_rdm_routines/davidson_like_trans_2rdm.irp.f b/src/two_rdm_routines/davidson_like_trans_2rdm.irp.f index 9e68a0e1..7f6b9459 100644 --- a/src/two_rdm_routines/davidson_like_trans_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_trans_2rdm.irp.f @@ -2,12 +2,12 @@ subroutine orb_range_2_trans_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N use bitmasks implicit none BEGIN_DOC - ! if ispin == 1 :: alpha/alpha 2_rdm - ! == 2 :: beta /beta 2_rdm - ! == 3 :: alpha/beta + beta/alpha 2trans_rdm + ! if ispin == 1 :: alpha/alpha 2_rdm + ! == 2 :: beta /beta 2_rdm + ! == 3 :: alpha/beta + beta/alpha 2trans_rdm ! == 4 :: spin traced 2_rdm :: aa + bb + ab + ba ! - ! notice that here it is the TRANSITION RDM THAT IS COMPUTED + ! notice that here it is the TRANSITION RDM THAT IS COMPUTED ! ! THE DIAGONAL PART IS THE USUAL ONE FOR A GIVEN STATE ! Assumes that the determinants are in psi_det @@ -22,7 +22,7 @@ subroutine orb_range_2_trans_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N integer :: k double precision, allocatable :: u_t(:,:) !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: u_t - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals allocate(u_t(N_st,N_det)) do k=1,N_st call dset_order(u_0(1,k),psi_bilinear_matrix_order,N_det) @@ -33,14 +33,14 @@ subroutine orb_range_2_trans_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N u_t, & size(u_t, 1), & N_det, N_st) - + call orb_range_2_trans_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,1,N_det,0,1) deallocate(u_t) - + do k=1,N_st call dset_order(u_0(1,k),psi_bilinear_matrix_order_reverse,N_det) enddo - + end subroutine orb_range_2_trans_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) @@ -55,11 +55,11 @@ subroutine orb_range_2_trans_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin, integer, intent(in) :: dim1,norb,list_orb(norb),ispin double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,N_st,N_st) double precision, intent(in) :: u_t(N_st,N_det) - + integer :: k - + PROVIDE N_int - + select case (N_int) case (1) call orb_range_2_trans_rdm_openmp_work_1(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) @@ -73,8 +73,8 @@ subroutine orb_range_2_trans_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin, call orb_range_2_trans_rdm_openmp_work_N_int(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) end select end - - + + BEGIN_TEMPLATE subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin,u_t,N_st,sze,istart,iend,ishift,istep) use bitmasks @@ -82,9 +82,9 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb implicit none BEGIN_DOC ! Computes the two trans_rdm for the N_st vectors |u_t> - ! if ispin == 1 :: alpha/alpha 2trans_rdm - ! == 2 :: beta /beta 2trans_rdm - ! == 3 :: alpha/beta 2trans_rdm + ! if ispin == 1 :: alpha/alpha 2trans_rdm + ! == 2 :: beta /beta 2trans_rdm + ! == 3 :: alpha/beta 2trans_rdm ! == 4 :: spin traced 2trans_rdm :: aa + bb + 0.5 (ab + ba)) ! The 2trans_rdm will be computed only on the list of orbitals list_orb, which contains norb ! Default should be 1,N_det,0,1 for istart,iend,ishift,istep @@ -93,7 +93,7 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb double precision, intent(in) :: u_t(N_st,N_det) integer, intent(in) :: dim1,norb,list_orb(norb),ispin double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,N_st,N_st) - + integer(omp_lock_kind) :: lock_2trans_rdm integer :: i,j,k,l integer :: k_a, k_b, l_a, l_b @@ -118,7 +118,7 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb double precision, allocatable :: values(:,:,:) integer :: nkeys,sze_buff integer :: ll - alpha_alpha = .False. + alpha_alpha = .False. beta_beta = .False. alpha_beta = .False. spin_trace = .False. @@ -136,27 +136,27 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb stop endif - + PROVIDE N_int call list_to_bitstring( orb_bitmask, list_orb, norb, N_int) - sze_buff = 6 * norb + elec_alpha_num * elec_alpha_num * 60 - list_orb_reverse = -1000 + sze_buff = 6 * norb + elec_alpha_num * elec_alpha_num * 60 + list_orb_reverse = -1000 do i = 1, norb - list_orb_reverse(list_orb(i)) = i + list_orb_reverse(list_orb(i)) = i enddo maxab = max(N_det_alpha_unique, N_det_beta_unique)+1 allocate(idx0(maxab)) - + do i=1,maxab idx0(i) = i enddo call omp_init_lock(lock_2trans_rdm) - + ! Prepare the array of all alpha single excitations ! ------------------------------------------------- - - PROVIDE N_int nthreads_davidson elec_alpha_num + + PROVIDE N_int nthreads_davidson elec_alpha_num !$OMP PARALLEL DEFAULT(NONE) NUM_THREADS(nthreads_davidson) & !$OMP SHARED(psi_bilinear_matrix_rows, N_det,lock_2trans_rdm,& !$OMP psi_bilinear_matrix_columns, & @@ -168,7 +168,7 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb !$OMP psi_bilinear_matrix_order_transp_reverse, & !$OMP psi_bilinear_matrix_columns_loc, & !$OMP psi_bilinear_matrix_transp_rows_loc,elec_alpha_num, & - !$OMP istart, iend, istep, irp_here,list_orb_reverse, n_states, dim1, & + !$OMP istart, iend, istep, irp_here,list_orb_reverse, n_states, dim1, & !$OMP ishift, idx0, u_t, maxab, alpha_alpha,beta_beta,alpha_beta,spin_trace,ispin,big_array,sze_buff,orb_bitmask) & !$OMP PRIVATE(krow, kcol, tmp_det, spindet, k_a, k_b, i,c_1, & !$OMP lcol, lrow, l_a, l_b, & @@ -176,35 +176,35 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb !$OMP tmp_det2, idx, l, kcol_prev, & !$OMP singles_a, n_singles_a, singles_b, & !$OMP n_singles_b, nkeys, keys, values) - + ! Alpha/Beta double excitations ! ============================= nkeys = 0 - allocate( keys(4,sze_buff), values(n_st,n_st,sze_buff)) + allocate( keys(4,sze_buff), values(n_st,n_st,sze_buff)) allocate( buffer($N_int,maxab), & singles_a(maxab), & singles_b(maxab), & doubles(maxab), & idx(maxab)) - + kcol_prev=-1 - + ASSERT (iend <= N_det) ASSERT (istart > 0) ASSERT (istep > 0) - + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep - + krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) - + kcol = psi_bilinear_matrix_columns(k_a) ASSERT (kcol <= N_det_beta_unique) - + 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) - + if (kcol /= kcol_prev) then call get_all_spin_singles_$N_int( & psi_det_beta_unique, idx0, & @@ -212,45 +212,45 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb singles_b, n_singles_b) endif kcol_prev = kcol - + ! Loop over singly excited beta columns ! ------------------------------------- - + do i=1,n_singles_b lcol = singles_b(i) - + tmp_det2(1:$N_int,2) = psi_det_beta_unique(1:$N_int, lcol) - + l_a = psi_bilinear_matrix_columns_loc(lcol) ASSERT (l_a <= N_det) - + do j=1,psi_bilinear_matrix_columns_loc(lcol+1) - l_a lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + buffer(1:$N_int,j) = psi_det_alpha_unique(1:$N_int, lrow) - + ASSERT (l_a <= N_det) idx(j) = l_a l_a = l_a+1 enddo j = j-1 - + call get_all_spin_singles_$N_int( & buffer, idx, tmp_det(1,1), j, & singles_a, n_singles_a ) - + ! Loop over alpha singles ! ----------------------- - + if(alpha_beta.or.spin_trace)then do k = 1,n_singles_a l_a = singles_a(k) ASSERT (l_a <= N_det) - + lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) ! print*,'nkeys before = ',nkeys do ll = 1, N_states @@ -259,13 +259,13 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb enddo enddo if(alpha_beta)then - ! only ONE contribution + ! only ONE contribution if (nkeys+1 .ge. sze_buff) then call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 endif else if (spin_trace)then - ! TWO contributions + ! TWO contributions if (nkeys+2 .ge. sze_buff) then call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 @@ -275,42 +275,42 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb enddo endif - + call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 enddo - + enddo !$OMP END DO - + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep - - + + ! Single and double alpha exitations ! =================================== - - + + ! Initial determinant is at k_a in alpha-major representation ! ----------------------------------------------------------------------- - + krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) - + kcol = psi_bilinear_matrix_columns(k_a) ASSERT (kcol <= N_det_beta_unique) - + 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) - + ! Initial determinant is at k_b in beta-major representation ! ---------------------------------------------------------------------- - + k_b = psi_bilinear_matrix_order_transp_reverse(k_a) ASSERT (k_b <= N_det) - + spindet(1:$N_int) = tmp_det(1:$N_int,1) - + ! Loop inside the beta column to gather all the connected alphas lcol = psi_bilinear_matrix_columns(k_a) l_a = psi_bilinear_matrix_columns_loc(lcol) @@ -320,28 +320,28 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb if (lcol /= kcol) exit lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + buffer(1:$N_int,i) = psi_det_alpha_unique(1:$N_int, lrow) idx(i) = l_a l_a = l_a+1 enddo i = i-1 - + call get_all_spin_singles_and_doubles_$N_int( & buffer, idx, spindet, i, & singles_a, doubles, n_singles_a, n_doubles ) - + ! Compute Hij for all alpha singles ! ---------------------------------- - + tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, kcol) do i=1,n_singles_a l_a = singles_a(i) ASSERT (l_a <= N_det) - + lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) do ll= 1, N_states do l= 1, N_states @@ -362,23 +362,23 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb endif call orb_range_off_diag_single_to_all_states_aa_trans_rdm_buffer(tmp_det,tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) endif - + enddo - + call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 - + ! Compute Hij for all alpha doubles ! ---------------------------------- - + if(alpha_alpha.or.spin_trace)then do i=1,n_doubles l_a = doubles(i) ASSERT (l_a <= N_det) - + lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - + do ll= 1, N_states do l= 1, N_states c_1(l,ll) = u_t(ll,l_a) * u_t(l,k_a) @@ -393,29 +393,29 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb endif call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 - - + + ! Single and double beta excitations ! ================================== - - + + ! Initial determinant is at k_a in alpha-major representation ! ----------------------------------------------------------------------- - + krow = psi_bilinear_matrix_rows(k_a) kcol = psi_bilinear_matrix_columns(k_a) - + 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) - + spindet(1:$N_int) = tmp_det(1:$N_int,2) - + ! Initial determinant is at k_b in beta-major representation ! ----------------------------------------------------------------------- - + k_b = psi_bilinear_matrix_order_transp_reverse(k_a) ASSERT (k_b <= N_det) - + ! Loop inside the alpha row to gather all the connected betas lrow = psi_bilinear_matrix_transp_rows(k_b) l_b = psi_bilinear_matrix_transp_rows_loc(lrow) @@ -425,28 +425,28 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb if (lrow /= krow) exit lcol = psi_bilinear_matrix_transp_columns(l_b) ASSERT (lcol <= N_det_beta_unique) - + buffer(1:$N_int,i) = psi_det_beta_unique(1:$N_int, lcol) idx(i) = l_b l_b = l_b+1 enddo i = i-1 - + call get_all_spin_singles_and_doubles_$N_int( & buffer, idx, spindet, i, & singles_b, doubles, n_singles_b, n_doubles ) - + ! Compute Hij for all beta singles ! ---------------------------------- - + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, krow) do i=1,n_singles_b l_b = singles_b(i) ASSERT (l_b <= N_det) - + lcol = psi_bilinear_matrix_transp_columns(l_b) ASSERT (lcol <= N_det_beta_unique) - + tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol) l_a = psi_bilinear_matrix_transp_order(l_b) do ll= 1, N_states @@ -471,18 +471,18 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb enddo call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 - + ! Compute Hij for all beta doubles ! ---------------------------------- - + if(beta_beta.or.spin_trace)then do i=1,n_doubles l_b = doubles(i) ASSERT (l_b <= N_det) - + lcol = psi_bilinear_matrix_transp_columns(l_b) ASSERT (lcol <= N_det_beta_unique) - + l_a = psi_bilinear_matrix_transp_order(l_b) do ll= 1, N_states do l= 1, N_states @@ -496,61 +496,61 @@ subroutine orb_range_2_trans_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb call orb_range_off_diag_double_to_all_states_trans_rdm_bb_buffer(tmp_det(1,2),psi_det_beta_unique(1, lcol),c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) ! print*,'to do orb_range_off_diag_double_to_2_trans_rdm_bb_dm_buffer' ASSERT (l_a <= N_det) - + enddo endif call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 - - + + ! Diagonal contribution ! ===================== - - + + ! Initial determinant is at k_a in alpha-major representation ! ----------------------------------------------------------------------- - + krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) - + kcol = psi_bilinear_matrix_columns(k_a) ASSERT (kcol <= N_det_beta_unique) - + 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_wee_mat_elem, diag_S_mat_elem - + double precision :: c_1(N_states,N_states) do ll = 1, N_states do l = 1, N_states c_1(l,ll) = u_t(ll,k_a) * u_t(l,k_a) enddo enddo - + call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 call orb_range_diag_to_all_states_2_rdm_trans_buffer(tmp_det,c_1,N_states,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) call update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2trans_rdm) nkeys = 0 - + end do !$OMP END DO deallocate(buffer, singles_a, singles_b, doubles, idx, keys, values) !$OMP END PARALLEL - + end - + SUBST [ N_int ] - + 1;; 2;; 3;; 4;; N_int;; - + END_TEMPLATE - + subroutine update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) use omp_lib implicit none @@ -558,7 +558,7 @@ subroutine update_keys_values_n_states_trans(keys,values,nkeys,dim1,n_st,big_arr integer, intent(in) :: keys(4,nkeys) double precision, intent(in) :: values(n_st,n_st,nkeys) double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,n_st,n_st) - + integer(omp_lock_kind),intent(inout):: lock_2rdm integer :: i,h1,h2,p1,p2,istate,jstate diff --git a/src/utils_cc/mo_integrals_cc.irp.f b/src/utils_cc/mo_integrals_cc.irp.f index b2b68d05..6f21c316 100644 --- a/src/utils_cc/mo_integrals_cc.irp.f +++ b/src/utils_cc/mo_integrals_cc.irp.f @@ -77,7 +77,7 @@ subroutine gen_v_space(n1,n2,n3,n4,list1,list2,list3,list4,v) else double precision :: get_two_e_integral - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals !$OMP PARALLEL & !$OMP SHARED(n1,n2,n3,n4,list1,list2,list3,list4,v,mo_integrals_map) & @@ -161,7 +161,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i,j,k,l double precision :: get_two_e_integral - PROVIDE mo_two_e_integrals_in_map + PROVIDE all_mo_integrals !$OMP PARALLEL & !$OMP SHARED(cc_space_v,mo_num,mo_integrals_map) & @@ -194,7 +194,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_oooo,1) n2 = size(cc_space_v_oooo,2) n3 = size(cc_space_v_oooo,3) @@ -237,7 +237,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_vooo,1) n2 = size(cc_space_v_vooo,2) n3 = size(cc_space_v_vooo,3) @@ -281,7 +281,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_ovoo,1) n2 = size(cc_space_v_ovoo,2) n3 = size(cc_space_v_ovoo,3) @@ -315,7 +315,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_oovo,1) n2 = size(cc_space_v_oovo,2) n3 = size(cc_space_v_oovo,3) @@ -349,7 +349,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_oovo,1) n2 = size(cc_space_v_oovo,2) n3 = size(cc_space_v_oovo,3) @@ -383,7 +383,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_vvoo,1) n2 = size(cc_space_v_vvoo,2) n3 = size(cc_space_v_vvoo,3) @@ -426,7 +426,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_vovo,1) n2 = size(cc_space_v_vovo,2) n3 = size(cc_space_v_vovo,3) @@ -469,7 +469,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_voov,1) n2 = size(cc_space_v_voov,2) n3 = size(cc_space_v_voov,3) @@ -503,7 +503,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_ovvo,1) n2 = size(cc_space_v_ovvo,2) n3 = size(cc_space_v_ovvo,3) @@ -537,7 +537,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_ovov,1) n2 = size(cc_space_v_ovov,2) n3 = size(cc_space_v_ovov,3) @@ -571,7 +571,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 - + n1 = size(cc_space_v_oovv,1) n2 = size(cc_space_v_oovv,2) n3 = size(cc_space_v_oovv,3) From a7bf04962be7f52fe292a07e239e6f1ac9742a23 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 20 Jan 2025 19:21:30 +0100 Subject: [PATCH 047/175] Fixed size of mo_integrals_cache --- src/mo_two_e_ints/map_integrals.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 06300666..9f485b79 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -62,7 +62,7 @@ subroutine insert_into_mo_integrals_map(n_integrals, & END_PROVIDER -BEGIN_PROVIDER [ double precision, mo_integrals_cache, (0_8:mo_integrals_cache_size_8**4_8) ] +BEGIN_PROVIDER [ double precision, mo_integrals_cache, (0_8:mo_integrals_cache_size_8) ] implicit none BEGIN_DOC ! Cache of MO integrals for fast access From 360aae7a104abfc086e269afd23c057702c06bfd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 20 Jan 2025 19:35:24 +0100 Subject: [PATCH 048/175] Bug axes fixed --- src/scf_utils/roothaan_hall_scf.irp.f | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index 947917af..274f08d6 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -222,13 +222,13 @@ subroutine Roothaan_Hall_SCF endif - ! Identify degenerate MOs and force them on the axes + ! Identify degenerate MOs and force them to be on the axes allocate(S(ao_num,ao_num)) i=1 do while (i Date: Tue, 21 Jan 2025 16:04:20 +0100 Subject: [PATCH 049/175] Fixed TREXIO norm problems --- ocaml/Input_ao_basis.ml | 44 ------------------------- scripts/qp_import_trexio.py | 10 +++--- src/ao_basis/EZFIO.cfg | 12 ------- src/ao_basis/aos.irp.f | 3 +- src/basis/EZFIO.cfg | 12 +++++++ src/basis/basis.irp.f | 17 ++++++++-- src/trexio/export_trexio_routines.irp.f | 27 ++++++--------- 7 files changed, 44 insertions(+), 81 deletions(-) diff --git a/ocaml/Input_ao_basis.ml b/ocaml/Input_ao_basis.ml index d9e28e04..343a4ae0 100644 --- a/ocaml/Input_ao_basis.ml +++ b/ocaml/Input_ao_basis.ml @@ -13,8 +13,6 @@ module Ao_basis : sig ao_coef : AO_coef.t array; ao_expo : AO_expo.t array; ao_cartesian : bool; - ao_normalized : bool; - primitives_normalized : bool; } [@@deriving sexp] ;; val read : unit -> t option @@ -36,8 +34,6 @@ end = struct ao_coef : AO_coef.t array; ao_expo : AO_expo.t array; ao_cartesian : bool; - ao_normalized : bool; - primitives_normalized : bool; } [@@deriving sexp] ;; @@ -133,24 +129,6 @@ end = struct Ezfio.get_ao_basis_ao_cartesian () ;; - let read_ao_normalized () = - if not (Ezfio.has_ao_basis_ao_normalized()) then - get_default "ao_normalized" - |> bool_of_string - |> Ezfio.set_ao_basis_ao_normalized - ; - Ezfio.get_ao_basis_ao_normalized () - ;; - - let read_primitives_normalized () = - if not (Ezfio.has_ao_basis_primitives_normalized()) then - get_default "primitives_normalized" - |> bool_of_string - |> Ezfio.set_ao_basis_primitives_normalized - ; - Ezfio.get_ao_basis_primitives_normalized () - ;; - let to_long_basis b = let ao_num = AO_number.to_int b.ao_num in let gto_array = Array.init (AO_number.to_int b.ao_num) @@ -213,8 +191,6 @@ end = struct ao_coef ; ao_expo ; ao_cartesian ; - ao_normalized ; - primitives_normalized ; } = b in write_md5 b ; @@ -247,8 +223,6 @@ end = struct ~rank:2 ~dim:[| ao_num ; 3 |] ~data:ao_power) ; Ezfio.set_ao_basis_ao_cartesian(ao_cartesian); - Ezfio.set_ao_basis_ao_normalized(ao_normalized); - Ezfio.set_ao_basis_primitives_normalized(primitives_normalized); let ao_coef = Array.to_list ao_coef @@ -280,8 +254,6 @@ end = struct ao_coef = read_ao_coef () ; ao_expo = read_ao_expo () ; ao_cartesian = read_ao_cartesian () ; - ao_normalized = read_ao_normalized () ; - primitives_normalized = read_primitives_normalized () ; } in to_md5 result @@ -392,8 +364,6 @@ end = struct { ao_basis = name ; ao_num ; ao_prim_num ; ao_prim_num_max ; ao_nucl ; ao_power ; ao_coef ; ao_expo ; ao_cartesian ; - ao_normalized = bool_of_string @@ get_default "ao_normalized"; - primitives_normalized = bool_of_string @@ get_default "primitives_normalized"; } ;; @@ -448,14 +418,6 @@ Cartesian coordinates (6d,10f,...) :: ao_cartesian = %s -Use normalized primitive functions :: - - primitives_normalized = %s - -Use normalized basis functions :: - - ao_normalized = %s - Basis set (read-only) :: %s @@ -469,8 +431,6 @@ Basis set (read-only) :: " (AO_basis_name.to_string b.ao_basis) (string_of_bool b.ao_cartesian) - (string_of_bool b.primitives_normalized) - (string_of_bool b.ao_normalized) (Basis.to_string short_basis |> String_ext.split ~on:'\n' |> list_map (fun x-> " "^x) @@ -507,8 +467,6 @@ ao_power = %s ao_coef = %s ao_expo = %s ao_cartesian = %s -ao_normalized = %s -primitives_normalized = %s md5 = %s " (AO_basis_name.to_string b.ao_basis) @@ -525,8 +483,6 @@ md5 = %s (b.ao_expo |> Array.to_list |> list_map AO_expo.to_string |> String.concat ", ") (b.ao_cartesian |> string_of_bool) - (b.ao_normalized |> string_of_bool) - (b.primitives_normalized |> string_of_bool) (to_md5 b |> MD5.to_string ) ;; diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index fc76f8de..ef4ac12a 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -193,9 +193,11 @@ def write_ezfio(trexio_filename, filename): shell_factor = trexio.read_basis_shell_factor(trexio_file) prim_factor = trexio.read_basis_prim_factor(trexio_file) - for i,p in enumerate(prim_factor): - coefficient[i] *= prim_factor[i] - ezfio.set_ao_basis_primitives_normalized(False) + ezfio.set_basis_prim_normalization_factor(prim_factor) + ezfio.set_basis_primitives_normalized(True) + ezfio.set_basis_ao_normalized(False) + for i, shell_idx in enumerate(shell_index): + coefficient[i] *= shell_factor[shell_idx] ezfio.set_basis_prim_coef(coefficient) elif basis_type.lower() == "numerical": @@ -391,7 +393,7 @@ def write_ezfio(trexio_filename, filename): # Renormalize MO coefs if needed if trexio.has_ao_normalization(trexio_file_cart): - ezfio.set_ao_basis_ao_normalized(False) + ezfio.set_basis_ao_normalized(False) norm = trexio.read_ao_normalization(trexio_file_cart) # for j in range(mo_num): # for i,f in enumerate(norm): diff --git a/src/ao_basis/EZFIO.cfg b/src/ao_basis/EZFIO.cfg index bd716383..c22f8029 100644 --- a/src/ao_basis/EZFIO.cfg +++ b/src/ao_basis/EZFIO.cfg @@ -55,18 +55,6 @@ doc: If |true|, use |AOs| in Cartesian coordinates (6d,10f,...) interface: ezfio, provider default: false -[ao_normalized] -type: logical -doc: Use normalized basis functions -interface: ezfio, provider -default: true - -[primitives_normalized] -type: logical -doc: Use normalized primitive functions -interface: ezfio, provider -default: true - [use_cgtos] type: logical doc: If true, use cgtos for AO integrals diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index 34853398..d718e935 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -82,10 +82,11 @@ enddo ao_coef_normalization_factor(i) = 1.d0/dsqrt(norm) - if (.not.ao_normalized) then + if (ao_normalized) then do j=1,ao_prim_num(i) ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i) enddo + else ao_coef_normalization_factor(i) = 1.d0 endif enddo diff --git a/src/basis/EZFIO.cfg b/src/basis/EZFIO.cfg index a6864418..03e224e4 100644 --- a/src/basis/EZFIO.cfg +++ b/src/basis/EZFIO.cfg @@ -73,3 +73,15 @@ size: (basis.prim_num) interface: ezfio, provider +[primitives_normalized] +type: logical +doc: If true, assume primitive basis functions are normalized +interface: ezfio, provider, ocaml +default: true + +[ao_normalized] +type: logical +doc: If true, normalize the basis functions +interface: ezfio, provider, ocaml +default: false + diff --git a/src/basis/basis.irp.f b/src/basis/basis.irp.f index b750d75a..5374e5be 100644 --- a/src/basis/basis.irp.f +++ b/src/basis/basis.irp.f @@ -6,6 +6,11 @@ logical :: has PROVIDE ezfio_filename + if (.not.ao_normalized) then + shell_normalization_factor = 1.d0 + return + endif + if (mpi_master) then if (size(shell_normalization_factor) == 0) return @@ -70,6 +75,12 @@ logical :: has PROVIDE ezfio_filename + + if (.not.primitives_normalized) then + prim_normalization_factor(:) = 1.d0 + return + endif + if (mpi_master) then if (size(prim_normalization_factor) == 0) return @@ -95,9 +106,9 @@ do k=1, prim_num if (shell_index(k) /= i) cycle - call overlap_gaussian_xyz(C_A,C_A,prim_expo(k),prim_expo(k), & - powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) - prim_normalization_factor(k) = 1.d0/dsqrt(norm) + call overlap_gaussian_xyz(C_A,C_A,prim_expo(k),prim_expo(k), & + powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) + prim_normalization_factor(k) = 1.d0/dsqrt(norm) enddo enddo diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index 0774bcd9..c60b1aa0 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -271,11 +271,7 @@ subroutine export_trexio(update,full_path) call trexio_assert(rc, TREXIO_SUCCESS) allocate(factor(shell_num)) -! if (ao_normalized) then - factor(1:shell_num) = shell_normalization_factor(1:shell_num) -! else -! factor(1:shell_num) = 1.d0 -! endif + factor(1:shell_num) = shell_normalization_factor(1:shell_num) rc = trexio_write_basis_shell_factor(f(1), factor) call trexio_assert(rc, TREXIO_SUCCESS) @@ -291,11 +287,12 @@ subroutine export_trexio(update,full_path) call trexio_assert(rc, TREXIO_SUCCESS) allocate(factor(prim_num)) -! if (primitives_normalized) then + if (primitives_normalized) then factor(1:prim_num) = prim_normalization_factor(1:prim_num) -! else -! factor(1:prim_num) = 1.d0 -! endif + else + factor(1:prim_num) = 1.d0 + endif + rc = trexio_write_basis_prim_factor(f(1), factor) call trexio_assert(rc, TREXIO_SUCCESS) deallocate(factor) @@ -324,14 +321,10 @@ subroutine export_trexio(update,full_path) C_A(3) = 0.d0 allocate(factor(ao_num)) - if (ao_normalized) then - do i=1,ao_num - l = ao_first_of_shell(ao_shell(i)) - factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0)) - enddo - else - factor(:) = 1.d0 - endif + do i=1,ao_num + l = ao_first_of_shell(ao_shell(i)) + factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0)) + enddo rc = trexio_write_ao_normalization(f(1), factor) call trexio_assert(rc, TREXIO_SUCCESS) deallocate(factor) From 1a5f0b3e38c4f32f345c547f5bbd3a69af08e0f2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 21 Jan 2025 17:48:37 +0100 Subject: [PATCH 050/175] Accelerated cholesky integrals in pt2 --- src/mo_two_e_ints/map_integrals.irp.f | 48 +++++++++++++++++++++------ 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 9f485b79..a1471a1c 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -143,7 +143,7 @@ double precision function get_two_e_integral(i,j,k,l,map) END_DOC integer, intent(in) :: i,j,k,l integer(key_kind) :: idx - integer :: ii + integer :: ii, kk type(map_type), intent(inout) :: map real(integral_kind) :: tmp @@ -177,10 +177,10 @@ double precision function get_two_e_integral(i,j,k,l,map) if (do_mo_cholesky) then - double precision, external :: ddot - get_two_e_integral = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, cholesky_mo_transp(1,j,l), 1) -! double precision, external :: get_from_mo_cholesky_cache -! get_two_e_integral = get_from_mo_cholesky_cache(i,j,k,l,.False.) + get_two_e_integral = 0.d0 + do kk=1,cholesky_mo_num + get_two_e_integral = get_two_e_integral + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) + enddo else @@ -516,11 +516,39 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) if (do_mo_cholesky) then - double precision, external :: ddot - do i=1,sze - out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & - cholesky_mo_transp(1,i,l), 1) - enddo + if ( (k>=mo_integrals_cache_min).and.(k<=mo_integrals_cache_max).and. & + (l>=mo_integrals_cache_min).and.(l<=mo_integrals_cache_max) ) then + + integer :: kk + + do i=1,mo_integrals_cache_min-1 + out_val(i) = 0.d0 + do kk=1,cholesky_mo_num + out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) + enddo + enddo + + do i=mo_integrals_cache_min,mo_integrals_cache_max + out_val(i) = get_two_e_integral_cache(i,i,k,l) + enddo + + do i=mo_integrals_cache_max, sze + out_val(i) = 0.d0 + do kk=1,cholesky_mo_num + out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) + enddo + enddo + + else + + do i=1,sze + out_val(i) = 0.d0 + do kk=1,cholesky_mo_num + out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) + enddo + enddo + + endif else From db443e0a5af02d2fca237f58e3a78bf64560a3cd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 21 Jan 2025 18:20:43 +0100 Subject: [PATCH 051/175] Put back ddot for AMD --- src/mo_two_e_ints/map_integrals.irp.f | 42 +++++++++++++++++---------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index a1471a1c..76f169b4 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -177,10 +177,13 @@ double precision function get_two_e_integral(i,j,k,l,map) if (do_mo_cholesky) then - get_two_e_integral = 0.d0 - do kk=1,cholesky_mo_num - get_two_e_integral = get_two_e_integral + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) - enddo + double precision, external :: ddot + get_two_e_integral = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, cholesky_mo_transp(1,j,l), 1) + +! get_two_e_integral = 0.d0 +! do kk=1,cholesky_mo_num +! get_two_e_integral = get_two_e_integral + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) +! enddo else @@ -519,13 +522,16 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) if ( (k>=mo_integrals_cache_min).and.(k<=mo_integrals_cache_max).and. & (l>=mo_integrals_cache_min).and.(l<=mo_integrals_cache_max) ) then + double precision, external :: ddot integer :: kk do i=1,mo_integrals_cache_min-1 - out_val(i) = 0.d0 - do kk=1,cholesky_mo_num - out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) - enddo + out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & + cholesky_mo_transp(1,i,l), 1) +! out_val(i) = 0.d0 +! do kk=1,cholesky_mo_num +! out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) +! enddo enddo do i=mo_integrals_cache_min,mo_integrals_cache_max @@ -533,19 +539,23 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) enddo do i=mo_integrals_cache_max, sze - out_val(i) = 0.d0 - do kk=1,cholesky_mo_num - out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) - enddo + out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & + cholesky_mo_transp(1,i,l), 1) +! out_val(i) = 0.d0 +! do kk=1,cholesky_mo_num +! out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) +! enddo enddo else do i=1,sze - out_val(i) = 0.d0 - do kk=1,cholesky_mo_num - out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) - enddo + out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & + cholesky_mo_transp(1,i,l), 1) +! out_val(i) = 0.d0 +! do kk=1,cholesky_mo_num +! out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) +! enddo enddo endif From ef234305e701ae50bf600127631fc9a8d84f4792 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 22 Jan 2025 11:06:53 +0100 Subject: [PATCH 052/175] Fixed ao_normalization. CP2K OK --- scripts/qp_import_trexio.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index ef4ac12a..23f48eef 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -191,11 +191,12 @@ def write_ezfio(trexio_filename, filename): ezfio.set_basis_nucleus_shell_num(nucl_shell_num) - shell_factor = trexio.read_basis_shell_factor(trexio_file) prim_factor = trexio.read_basis_prim_factor(trexio_file) ezfio.set_basis_prim_normalization_factor(prim_factor) ezfio.set_basis_primitives_normalized(True) ezfio.set_basis_ao_normalized(False) + + shell_factor = trexio.read_basis_shell_factor(trexio_file) for i, shell_idx in enumerate(shell_index): coefficient[i] *= shell_factor[shell_idx] ezfio.set_basis_prim_coef(coefficient) @@ -249,7 +250,6 @@ def write_ezfio(trexio_filename, filename): ezfio.set_basis_shell_index([x+1 for x in shell_index]) ezfio.set_basis_nucleus_shell_num(nucl_shell_num) - shell_factor = trexio.read_basis_shell_factor(trexio_file) else: raise TypeError @@ -319,13 +319,18 @@ def write_ezfio(trexio_filename, filename): exponent.append(expo[i]) num_prim.append(num_prim0[i]) - print (len(coefficient), ao_num) assert (len(coefficient) == ao_num) + ezfio.set_ao_basis_ao_power(power_x + power_y + power_z) ezfio.set_ao_basis_ao_prim_num(num_prim) prim_num_max = max( [ len(x) for x in coefficient ] ) + ao_normalization = trexio.read_ao_normalization(trexio_file_cart) + for i, coef in enumerate(coefficient): + for j in range(len(coef)): + coef[j] *= ao_normalization[i] + for i in range(ao_num): coefficient[i] += [0. for j in range(len(coefficient[i]), prim_num_max)] exponent [i] += [0. for j in range(len(exponent[i]), prim_num_max)] @@ -340,7 +345,6 @@ def write_ezfio(trexio_filename, filename): coef.append(coefficient[j]) expo.append(exponent[j]) -# ezfio.set_ao_basis_ao_prim_num_max(prim_num_max) ezfio.set_ao_basis_ao_coef(coef) ezfio.set_ao_basis_ao_expo(expo) @@ -390,14 +394,6 @@ def write_ezfio(trexio_filename, filename): # Read coefs from temporary cartesian file created in the AO section MoMatrix = trexio.read_mo_coefficient(trexio_file_cart) - - # Renormalize MO coefs if needed - if trexio.has_ao_normalization(trexio_file_cart): - ezfio.set_basis_ao_normalized(False) - norm = trexio.read_ao_normalization(trexio_file_cart) -# for j in range(mo_num): -# for i,f in enumerate(norm): -# MoMatrix[i,j] *= f ezfio.set_mo_basis_mo_coef(MoMatrix) mo_occ = [ 0. for i in range(mo_num) ] From fd6807eaa50a5014ca5dd9736e5b74a71dec65ec Mon Sep 17 00:00:00 2001 From: eginer Date: Thu, 23 Jan 2025 12:55:11 +0100 Subject: [PATCH 053/175] modified mol properties with transition dipole with DFT grid --- src/determinants/tr_density_matrix.irp.f | 15 +++++- src/dft_utils_in_r/dipole_becke.irp.f | 23 ++++++++ src/mol_properties/EZFIO.cfg | 7 +++ src/mol_properties/NEED | 1 + src/mol_properties/mo_dipole_properties.irp.f | 14 +++++ .../multi_s_dipole_moment.irp.f | 53 ++++++++++--------- 6 files changed, 88 insertions(+), 25 deletions(-) create mode 100644 src/dft_utils_in_r/dipole_becke.irp.f create mode 100644 src/mol_properties/mo_dipole_properties.irp.f diff --git a/src/determinants/tr_density_matrix.irp.f b/src/determinants/tr_density_matrix.irp.f index 6faef219..856e1dc0 100644 --- a/src/determinants/tr_density_matrix.irp.f +++ b/src/determinants/tr_density_matrix.irp.f @@ -1,5 +1,5 @@ BEGIN_PROVIDER [double precision, one_e_tr_dm_mo, (mo_num, mo_num, N_states, N_states)] - + use OMP_LIB implicit none BEGIN_DOC @@ -16,6 +16,19 @@ double precision, allocatable :: tmp_a(:,:,:,:), tmp_b(:,:,:,:) integer :: krow, kcol, lrow, lcol + double precision :: mem_tot_tr_dm + integer :: nthreads + nthreads = OMP_GET_MAX_THREADS() + mem_tot_tr_dm = 8.d0*mo_num*mo_num*n_states*n_states*1d-9*(nthreads+1) + if(mem_tot_tr_dm .gt. 0.9d0 * qp_max_mem) then + print*,'Warning ! you are providing one_e_tr_dm_mo in parallel ! ' + print*,'Using that amount of threads ',nthreads + print*,'Each thread needs that amount of Gb ',8.d0*mo_num*mo_num*n_states*n_states*1d-9 + print*,'So it takes in total that amount of Gb ',mem_tot_tr_dm + print*,'The max memory for the calculation is ',qp_max_mem + print*,'It may crash because of lack of memory ...' + endif + PROVIDE psi_det_alpha_unique psi_det_beta_unique one_e_tr_dm_mo = 0d0 diff --git a/src/dft_utils_in_r/dipole_becke.irp.f b/src/dft_utils_in_r/dipole_becke.irp.f new file mode 100644 index 00000000..f82faf90 --- /dev/null +++ b/src/dft_utils_in_r/dipole_becke.irp.f @@ -0,0 +1,23 @@ + BEGIN_PROVIDER [ double precision, mo_dipole_x_becke, (mo_num,mo_num)] +&BEGIN_PROVIDER [ double precision, mo_dipole_y_becke, (mo_num,mo_num)] +&BEGIN_PROVIDER [ double precision, mo_dipole_z_becke, (mo_num,mo_num)] + implicit none + integer :: i,j,ipoint + double precision :: r(3), weight + mo_dipole_x_becke=0.d0 + mo_dipole_y_becke=0.d0 + mo_dipole_z_becke=0.d0 + do i = 1, mo_num + do j = 1, mo_num + do ipoint = 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) + weight = final_weight_at_r_vector(i) + mo_dipole_x_becke(j,i) += r(1) * weight * mos_in_r_array_transp(ipoint,i) * mos_in_r_array_transp(ipoint,j) + mo_dipole_y_becke(j,i) += r(2) * weight * mos_in_r_array_transp(ipoint,i) * mos_in_r_array_transp(ipoint,j) + mo_dipole_z_becke(j,i) += r(3) * weight * mos_in_r_array_transp(ipoint,i) * mos_in_r_array_transp(ipoint,j) + enddo + enddo + enddo +END_PROVIDER diff --git a/src/mol_properties/EZFIO.cfg b/src/mol_properties/EZFIO.cfg index 3ddba227..be1c74f4 100644 --- a/src/mol_properties/EZFIO.cfg +++ b/src/mol_properties/EZFIO.cfg @@ -1,3 +1,10 @@ + +[dft_grid_mo_dipole] +type: logical +doc: If true, you compute the MO x/y/z dipole with DFT's grid +interface: ezfio,provider,ocaml +default: false + [print_all_transitions] type: logical doc: If true, print the transition between all the states diff --git a/src/mol_properties/NEED b/src/mol_properties/NEED index 8d89a452..50cf3a74 100644 --- a/src/mol_properties/NEED +++ b/src/mol_properties/NEED @@ -1,2 +1,3 @@ determinants davidson_undressed +dft_utils_in_r diff --git a/src/mol_properties/mo_dipole_properties.irp.f b/src/mol_properties/mo_dipole_properties.irp.f new file mode 100644 index 00000000..d60fb39a --- /dev/null +++ b/src/mol_properties/mo_dipole_properties.irp.f @@ -0,0 +1,14 @@ + BEGIN_PROVIDER [double precision, mo_prop_dipole_x , (mo_num,mo_num)] +&BEGIN_PROVIDER [double precision, mo_prop_dipole_y , (mo_num,mo_num)] +&BEGIN_PROVIDER [double precision, mo_prop_dipole_z , (mo_num,mo_num)] + implicit none + if(dft_grid_mo_dipole)then + mo_prop_dipole_x=mo_dipole_x_becke + mo_prop_dipole_y=mo_dipole_y_becke + mo_prop_dipole_z=mo_dipole_z_becke + else + mo_prop_dipole_x=mo_dipole_x + mo_prop_dipole_y=mo_dipole_y + mo_prop_dipole_z=mo_dipole_z + endif +END_PROVIDER diff --git a/src/mol_properties/multi_s_dipole_moment.irp.f b/src/mol_properties/multi_s_dipole_moment.irp.f index 8aae3bf4..798a620d 100644 --- a/src/mol_properties/multi_s_dipole_moment.irp.f +++ b/src/mol_properties/multi_s_dipole_moment.irp.f @@ -39,24 +39,28 @@ ! p,q: general spatial MOs ! gamma^{nm}: density matrix \bra{\Psi^n} a^{\dagger}_a a_i \ket{\Psi^m} END_DOC - + USE OMP_LIB integer :: istate, jstate ! States integer :: i, j ! general spatial MOs double precision :: nuclei_part_x, nuclei_part_y, nuclei_part_z + double precision :: mem_tot_tr_dm + integer :: nthreads + nthreads = OMP_GET_MAX_THREADS() + mem_tot_tr_dm = 8.d0*mo_num*mo_num*n_states*n_states*1d-9*(nthreads+1) multi_s_x_dipole_moment = 0.d0 multi_s_y_dipole_moment = 0.d0 multi_s_z_dipole_moment = 0.d0 - if(8.d0*mo_num*mo_num*n_states*n_states*1d-9 .lt. 200.d0) then + if(mem_tot_tr_dm .lt. 0.9d0 * qp_max_mem) then do jstate = 1, N_states do istate = 1, N_states do i = 1, mo_num do j = 1, mo_num - multi_s_x_dipole_moment(istate,jstate) -= one_e_tr_dm_mo(j,i,istate,jstate) * mo_dipole_x(j,i) - multi_s_y_dipole_moment(istate,jstate) -= one_e_tr_dm_mo(j,i,istate,jstate) * mo_dipole_y(j,i) - multi_s_z_dipole_moment(istate,jstate) -= one_e_tr_dm_mo(j,i,istate,jstate) * mo_dipole_z(j,i) + multi_s_x_dipole_moment(istate,jstate) -= one_e_tr_dm_mo(j,i,istate,jstate) * mo_prop_dipole_x(j,i) + multi_s_y_dipole_moment(istate,jstate) -= one_e_tr_dm_mo(j,i,istate,jstate) * mo_prop_dipole_y(j,i) + multi_s_z_dipole_moment(istate,jstate) -= one_e_tr_dm_mo(j,i,istate,jstate) * mo_prop_dipole_z(j,i) enddo enddo enddo @@ -66,6 +70,7 @@ ! no enouph memory ! on the fly scheme + print*,'Computing on the fly the various dipole matrix elements ' PROVIDE psi_det_alpha_unique psi_det_beta_unique @@ -85,7 +90,7 @@ !$OMP psi_bilinear_matrix_transp_rows, psi_bilinear_matrix_transp_columns, & !$OMP psi_det_alpha_unique, psi_det_beta_unique, & !$OMP psi_bilinear_matrix_values, psi_bilinear_matrix_transp_values, & - !$OMP mo_dipole_x, mo_dipole_y, mo_dipole_z, & + !$OMP mo_prop_dipole_x, mo_prop_dipole_y, mo_prop_dipole_z, & !$OMP multi_s_x_dipole_moment, multi_s_y_dipole_moment, multi_s_z_dipole_moment) !$OMP DO COLLAPSE(2) do istate = 1, N_states @@ -103,9 +108,9 @@ ck = psi_bilinear_matrix_values(k_a,istate)*psi_bilinear_matrix_values(k_a,jstate) do l = 1, elec_alpha_num j = occ(l,1) - multi_s_x_dipole_moment(istate,jstate) -= ck * mo_dipole_x(j,j) - multi_s_y_dipole_moment(istate,jstate) -= ck * mo_dipole_y(j,j) - multi_s_z_dipole_moment(istate,jstate) -= ck * mo_dipole_z(j,j) + multi_s_x_dipole_moment(istate,jstate) -= ck * mo_prop_dipole_x(j,j) + multi_s_y_dipole_moment(istate,jstate) -= ck * mo_prop_dipole_y(j,j) + multi_s_z_dipole_moment(istate,jstate) -= ck * mo_prop_dipole_z(j,j) enddo if (k_a == N_det) cycle @@ -121,13 +126,13 @@ call get_single_excitation_spin(tmp_det(1,1), tmp_det2, exc, phase, N_int) call decode_exc_spin(exc, h1, p1, h2, p2) ckl = psi_bilinear_matrix_values(k_a,istate)*psi_bilinear_matrix_values(l,jstate) * phase - multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_dipole_x(h1,p1) - multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_dipole_y(h1,p1) - multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_dipole_z(h1,p1) + multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_x(h1,p1) + multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_y(h1,p1) + multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_z(h1,p1) ckl = psi_bilinear_matrix_values(k_a,jstate)*psi_bilinear_matrix_values(l,istate) * phase - multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_dipole_x(p1,h1) - multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_dipole_y(p1,h1) - multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_dipole_z(p1,h1) + multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_x(p1,h1) + multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_y(p1,h1) + multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_z(p1,h1) endif l = l+1 if (l > N_det) exit @@ -148,9 +153,9 @@ ck = psi_bilinear_matrix_transp_values(k_b,istate)*psi_bilinear_matrix_transp_values(k_b,jstate) do l = 1, elec_beta_num j = occ(l,2) - multi_s_x_dipole_moment(istate,jstate) -= ck * mo_dipole_x(j,j) - multi_s_y_dipole_moment(istate,jstate) -= ck * mo_dipole_y(j,j) - multi_s_z_dipole_moment(istate,jstate) -= ck * mo_dipole_z(j,j) + multi_s_x_dipole_moment(istate,jstate) -= ck * mo_prop_dipole_x(j,j) + multi_s_y_dipole_moment(istate,jstate) -= ck * mo_prop_dipole_y(j,j) + multi_s_z_dipole_moment(istate,jstate) -= ck * mo_prop_dipole_z(j,j) enddo if (k_b == N_det) cycle @@ -166,13 +171,13 @@ call get_single_excitation_spin(tmp_det(1,2), tmp_det2, exc, phase, N_int) call decode_exc_spin(exc, h1, p1, h2, p2) ckl = psi_bilinear_matrix_transp_values(k_b,istate)*psi_bilinear_matrix_transp_values(l,jstate) * phase - multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_dipole_x(h1,p1) - multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_dipole_y(h1,p1) - multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_dipole_z(h1,p1) + multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_x(h1,p1) + multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_y(h1,p1) + multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_z(h1,p1) ckl = psi_bilinear_matrix_transp_values(k_b,jstate)*psi_bilinear_matrix_transp_values(l,istate) * phase - multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_dipole_x(p1,h1) - multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_dipole_y(p1,h1) - multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_dipole_z(p1,h1) + multi_s_x_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_x(p1,h1) + multi_s_y_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_y(p1,h1) + multi_s_z_dipole_moment(istate,jstate) -= ckl * mo_prop_dipole_z(p1,h1) endif l = l+1 if (l > N_det) exit From dc0851d008e4b3f0281e0aaeb1817a7d8d4132b3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 24 Jan 2025 11:18:07 +0100 Subject: [PATCH 054/175] print_energy uses only CI energy now --- src/tools/print_energy.irp.f | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tools/print_energy.irp.f b/src/tools/print_energy.irp.f index 485a0910..d94a7156 100644 --- a/src/tools/print_energy.irp.f +++ b/src/tools/print_energy.irp.f @@ -17,19 +17,19 @@ subroutine run call print_mol_properties print *, psi_energy + nuclear_repulsion call print_energy_components - print *, 'E(HF) = ', HF_energy +! print *, 'E(HF) = ', HF_energy print *, 'E(CI) = ', psi_energy + nuclear_repulsion - print *, '' - print *, 'E_kin(CI) = ', ref_bitmask_kinetic_energy - print *, 'E_kin(HF) = ', HF_kinetic_energy - print *, '' - print *, 'E_ne (CI) = ', ref_bitmask_n_e_energy - print *, 'E_ne (HF) = ', HF_n_e_energy - print *, '' - print *, 'E_1e (CI) = ', ref_bitmask_one_e_energy - print *, 'E_1e (HF) = ', HF_one_electron_energy - print *, '' - print *, 'E_2e (CI) = ', ref_bitmask_two_e_energy - print *, 'E_2e (HF) = ', HF_two_electron_energy +! print *, '' +! print *, 'E_kin(CI) = ', ref_bitmask_kinetic_energy +! print *, 'E_kin(HF) = ', HF_kinetic_energy +! print *, '' +! print *, 'E_ne (CI) = ', ref_bitmask_n_e_energy +! print *, 'E_ne (HF) = ', HF_n_e_energy +! print *, '' +! print *, 'E_1e (CI) = ', ref_bitmask_one_e_energy +! print *, 'E_1e (HF) = ', HF_one_electron_energy +! print *, '' +! print *, 'E_2e (CI) = ', ref_bitmask_two_e_energy +! print *, 'E_2e (HF) = ', HF_two_electron_energy end From 0c6d513bbf126e2ae92643a1e3cbfc94dbceab95 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 24 Jan 2025 19:07:16 +0100 Subject: [PATCH 055/175] Implemented single precision for cholesky mo --- src/ao_two_e_ints/cholesky.irp.f | 3 +- src/fci/pt2.irp.f | 2 +- src/mo_two_e_ints/cholesky.irp.f | 59 +++++++- src/mo_two_e_ints/map_integrals.irp.f | 192 +++++++++++++++++++------- src/mp2/mp2.irp.f | 2 +- 5 files changed, 200 insertions(+), 58 deletions(-) diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index 69b18900..fdc729d5 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -466,10 +466,11 @@ double precision function get_ao_integ_chol(i,j,k,l) endif + ! Reverse order of Cholesky vectors to increase precision in dot products !$OMP PARALLEL DO PRIVATE(k,j) do k=1,rank do j=1,ao_num - cholesky_ao(1:ao_num,j,k) = L((j-1_8)*ao_num+1_8:1_8*j*ao_num,k) + cholesky_ao(1:ao_num,j,rank-k+1) = L((j-1_8)*ao_num+1_8:1_8*j*ao_num,rank-k+1) enddo enddo !$OMP END PARALLEL DO diff --git a/src/fci/pt2.irp.f b/src/fci/pt2.irp.f index 53bf1699..186f1ff6 100644 --- a/src/fci/pt2.irp.f +++ b/src/fci/pt2.irp.f @@ -15,11 +15,11 @@ program pt2 ! sampling. ! END_DOC + PROVIDE all_mo_integrals if (.not. is_zmq_slave) then read_wf = .True. threshold_generators = 1.d0 SOFT_TOUCH read_wf threshold_generators - PROVIDE all_mo_integrals PROVIDE psi_energy call run else diff --git a/src/mo_two_e_ints/cholesky.irp.f b/src/mo_two_e_ints/cholesky.irp.f index 1fed949d..835110de 100644 --- a/src/mo_two_e_ints/cholesky.irp.f +++ b/src/mo_two_e_ints/cholesky.irp.f @@ -7,7 +7,8 @@ ! do_mo_cholesky = .False. END_PROVIDER -BEGIN_PROVIDER [ integer, cholesky_mo_num ] + BEGIN_PROVIDER [ integer, cholesky_mo_num ] +&BEGIN_PROVIDER [ integer, cholesky_mo_num_split, (1:5)] implicit none BEGIN_DOC ! Number of Cholesky vectors in MO basis @@ -21,6 +22,12 @@ else cholesky_mo_num = cholesky_ao_num endif + cholesky_mo_num_split(1) = 0 + cholesky_mo_num_split(2) = cholesky_mo_num/4 + cholesky_mo_num_split(3) = 2*cholesky_mo_num_split(2) + cholesky_mo_num_split(4) = 3*cholesky_mo_num_split(2) + cholesky_mo_num_split(5) = cholesky_mo_num + cholesky_mo_num_split += 1 END_PROVIDER BEGIN_PROVIDER [ double precision, cholesky_mo, (mo_num, mo_num, cholesky_mo_num) ] @@ -49,7 +56,7 @@ BEGIN_DOC ! Cholesky vectors in MO basis. Warning: it is transposed wrt cholesky_ao: ! - ! - cholesky_ao is (ao_num^2 x cholesky_ao_num) + ! - cholesky_ao is (ao_num^2 x cholesky_ao_num) ! ! - cholesky_mo_transp is (cholesky_mo_num x mo_num^2) END_DOC @@ -132,3 +139,51 @@ END_PROVIDER + + + +BEGIN_PROVIDER [ real, cholesky_mo_sp, (mo_num, mo_num, cholesky_mo_num) ] + implicit none + BEGIN_DOC + ! Cholesky vectors in MO basis in stored in single precision + END_DOC + + integer :: k, i, j + + call set_multiple_levels_omp(.False.) + !$OMP PARALLEL DO PRIVATE(k) + do k=1,cholesky_mo_num + do j=1,mo_num + do i=1,mo_num + cholesky_mo_sp(i,j,k) = cholesky_mo_transp_sp(k,i,j) + enddo + enddo + enddo + !$OMP END PARALLEL DO + +END_PROVIDER + +BEGIN_PROVIDER [ real, cholesky_mo_transp_sp, (cholesky_mo_num, mo_num, mo_num) ] + implicit none + BEGIN_DOC + ! Cholesky vectors in MO basis in s. Warning: it is transposed wrt cholesky_ao: + ! + ! - cholesky_ao is (ao_num^2 x cholesky_ao_num) + ! + ! - cholesky_mo_transp is (cholesky_mo_num x mo_num^2) + END_DOC + + integer :: i,j,k + !$OMP PARALLEL DO PRIVATE(k) + do k=1,cholesky_mo_num + do j=1,mo_num + do i=1,mo_num + cholesky_mo_transp_sp(k,i,j) = cholesky_mo_transp(k,i,j) + enddo + enddo + enddo + !$OMP END PARALLEL DO + +END_PROVIDER + + diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 76f169b4..6040842e 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -9,6 +9,14 @@ PROVIDE mo_two_e_integrals_in_map mo_integrals_cache mo_two_e_integrals_jj_exchange mo_two_e_integrals_jj_anti mo_two_e_integrals_jj big_array_exchange_integrals big_array_coulomb_integrals mo_one_e_integrals END_PROVIDER +BEGIN_PROVIDER [ logical, mo_cholesky_double ] + implicit none + BEGIN_DOC +! If true, use double precision to compute integrals from cholesky vectors + END_DOC + mo_cholesky_double = .True. +END_PROVIDER + !! MO Map !! ====== @@ -147,7 +155,7 @@ double precision function get_two_e_integral(i,j,k,l,map) type(map_type), intent(inout) :: map real(integral_kind) :: tmp - PROVIDE mo_two_e_integrals_in_map mo_integrals_cache do_mo_cholesky + PROVIDE mo_two_e_integrals_in_map mo_integrals_cache do_mo_cholesky mo_cholesky_double cholesky_mo_transp_sp cholesky_mo_transp if (use_banned_excitation) then if (banned_excitation(i,k)) then @@ -178,12 +186,19 @@ double precision function get_two_e_integral(i,j,k,l,map) if (do_mo_cholesky) then double precision, external :: ddot - get_two_e_integral = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, cholesky_mo_transp(1,j,l), 1) - -! get_two_e_integral = 0.d0 -! do kk=1,cholesky_mo_num -! get_two_e_integral = get_two_e_integral + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) -! enddo + real, external :: sdot + integer :: isplit + if (mo_cholesky_double) then + get_two_e_integral = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, cholesky_mo_transp(1,j,l), 1) + else + get_two_e_integral = 0.d0 + do isplit=1,4 + get_two_e_integral = get_two_e_integral + & + sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1) + enddo + endif else @@ -214,7 +229,8 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) real(integral_kind) :: tmp integer(key_kind) :: i1, idx integer(key_kind) :: p,q,r,s,i2 - PROVIDE mo_two_e_integrals_in_map mo_integrals_cache + real, allocatable :: out_val_sp(:) + PROVIDE mo_two_e_integrals_in_map mo_integrals_cache cholesky_mo_transp cholesky_mo_transp_sp if (banned_excitation(j,l)) then out_val(1:sze) = 0.d0 @@ -225,6 +241,10 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) ii = ior(ii, k-mo_integrals_cache_min) ii = ior(ii, j-mo_integrals_cache_min) + if (do_mo_cholesky.and. .not.mo_cholesky_double) then + allocate(out_val_sp(sze)) + endif + if (iand(ii, -mo_integrals_cache_size) == 0) then ! Some integrals are in the cache @@ -232,11 +252,24 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) if (do_mo_cholesky) then - !TODO: here - call dgemv('T', cholesky_mo_num, mo_integrals_cache_min-1, 1.d0, & - cholesky_mo_transp(1,1,k), cholesky_mo_num, & - cholesky_mo_transp(1,j,l), 1, 0.d0, & - out_val, 1) + !TODO: bottleneck here + if (mo_cholesky_double) then + call dgemv('T', cholesky_mo_num, mo_integrals_cache_min-1, 1.d0, & + cholesky_mo_transp(1,1,k), cholesky_mo_num, & + cholesky_mo_transp(1,j,l), 1, 0.d0, & + out_val, 1) + else + integer :: isplit + out_val = 0.d0 + do isplit=1,4 + call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + mo_integrals_cache_min-1, 1., & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & + out_val_sp, 1) + out_val(1:mo_integrals_cache_min-1) += out_val_sp(1:mo_integrals_cache_min-1) + enddo + endif else @@ -270,11 +303,23 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) if (do_mo_cholesky) then - !TODO: here - call dgemv('T', cholesky_mo_num, mo_num-mo_integrals_cache_max, 1.d0, & - cholesky_mo_transp(1,mo_integrals_cache_max+1,k), cholesky_mo_num, & - cholesky_mo_transp(1,j,l), 1, 0.d0, & - out_val(mo_integrals_cache_max+1), 1) + !TODO: bottleneck here + if (mo_cholesky_double) then + call dgemv('T', cholesky_mo_num, mo_num-mo_integrals_cache_max, 1.d0, & + cholesky_mo_transp(1,mo_integrals_cache_max+1,k), cholesky_mo_num, & + cholesky_mo_transp(1,j,l), 1, 0.d0, & + out_val(mo_integrals_cache_max+1), 1) + else + out_val = 0.d0 + do isplit=1,4 + call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + mo_num-mo_integrals_cache_max, 1., & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),mo_integrals_cache_max+1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & + out_val_sp(mo_integrals_cache_max+1), 1) + out_val(mo_integrals_cache_max+1:sze) += out_val_sp(mo_integrals_cache_max+1:sze) + enddo + endif else @@ -306,11 +351,23 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) if (do_mo_cholesky) then - !TODO: here - call dgemv('T', cholesky_mo_num, mo_num, 1.d0, & - cholesky_mo_transp(1,1,k), cholesky_mo_num, & - cholesky_mo_transp(1,j,l), 1, 0.d0, & - out_val, 1) + !TODO: bottleneck here + if (mo_cholesky_double) then + call dgemv('T', cholesky_mo_num, sze, 1.d0, & + cholesky_mo_transp(1,1,k), cholesky_mo_num, & + cholesky_mo_transp(1,j,l), 1, 0.d0, & + out_val, 1) + else + out_val = 0.d0 + do isplit=1,4 + call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + sze, 1., & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & + out_val_sp, 1) + out_val(1:sze) += out_val_sp(1:sze) + enddo + endif else @@ -513,7 +570,7 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) type(map_type), intent(inout) :: map integer :: i double precision, external :: get_two_e_integral - PROVIDE mo_two_e_integrals_in_map + PROVIDE mo_two_e_integrals_in_map mo_cholesky_double cholesky_mo_transp cholesky_mo_transp_sp if ( (mo_integrals_cache_min>1).or.(mo_integrals_cache_max=mo_integrals_cache_min).and.(l<=mo_integrals_cache_max) ) then double precision, external :: ddot + real, external :: sdot integer :: kk - do i=1,mo_integrals_cache_min-1 - out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & - cholesky_mo_transp(1,i,l), 1) -! out_val(i) = 0.d0 -! do kk=1,cholesky_mo_num -! out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) -! enddo - enddo - - do i=mo_integrals_cache_min,mo_integrals_cache_max - out_val(i) = get_two_e_integral_cache(i,i,k,l) - enddo - - do i=mo_integrals_cache_max, sze - out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & - cholesky_mo_transp(1,i,l), 1) -! out_val(i) = 0.d0 -! do kk=1,cholesky_mo_num -! out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) -! enddo - enddo + if (mo_cholesky_double) then + + do i=1,mo_integrals_cache_min-1 + out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & + cholesky_mo_transp(1,i,l), 1) + enddo + + do i=mo_integrals_cache_min,mo_integrals_cache_max + out_val(i) = get_two_e_integral_cache(i,i,k,l) + enddo + + do i=mo_integrals_cache_max, sze + out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & + cholesky_mo_transp(1,i,l), 1) + enddo + + else + + integer :: isplit + do i=1,mo_integrals_cache_min-1 + out_val(i) = 0.d0 + do isplit=1,4 + out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) + enddo + enddo + + do i=mo_integrals_cache_min,mo_integrals_cache_max + out_val(i) = get_two_e_integral_cache(i,i,k,l) + enddo + + do i=mo_integrals_cache_max, sze + out_val(i) = 0.d0 + do isplit=1,4 + out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) + enddo + enddo + + endif else - do i=1,sze - out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & - cholesky_mo_transp(1,i,l), 1) -! out_val(i) = 0.d0 -! do kk=1,cholesky_mo_num -! out_val(i) = out_val(i) + cholesky_mo_transp(kk,i,k)*cholesky_mo_transp(kk,i,l) -! enddo - enddo + if (mo_cholesky_double) then + do i=1,sze + out_val(i) = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, & + cholesky_mo_transp(1,i,l), 1) + enddo + else + do i=1,sze + out_val(i) = 0.d0 + do isplit=1,4 + out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) + enddo + enddo + endif endif diff --git a/src/mp2/mp2.irp.f b/src/mp2/mp2.irp.f index b8e0cc4a..ecf2da1b 100644 --- a/src/mp2/mp2.irp.f +++ b/src/mp2/mp2.irp.f @@ -7,7 +7,7 @@ subroutine run double precision, allocatable :: pt2(:), norm_pert(:) double precision :: H_pert_diag, E_old integer :: N_st, iter - PROVIDE Fock_matrix_diag_mo H_apply_buffer_allocated + PROVIDE all_mo_integrals Fock_matrix_diag_mo H_apply_buffer_allocated N_st = N_states allocate (pt2(N_st), norm_pert(N_st)) E_old = HF_energy From 11b65259969aa612464e2b24fbd7b3b21f980627 Mon Sep 17 00:00:00 2001 From: Yann Damour <77277447+Ydrnan@users.noreply.github.com> Date: Fri, 24 Jan 2025 19:08:38 +0100 Subject: [PATCH 056/175] Fix deallocation pt2_serialized --- src/cipsi_utils/run_pt2_slave.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cipsi_utils/run_pt2_slave.irp.f b/src/cipsi_utils/run_pt2_slave.irp.f index cb1dd1f5..90c0e086 100644 --- a/src/cipsi_utils/run_pt2_slave.irp.f +++ b/src/cipsi_utils/run_pt2_slave.irp.f @@ -350,7 +350,6 @@ subroutine push_pt2_results_async_send(zmq_socket_push, index, pt2_data, b, task enddo rc = f77_zmq_send( zmq_socket_push, pt2_serialized, size(pt2_serialized)*8, ZMQ_SNDMORE) - deallocate(pt2_serialized) if (rc == -1) then print *, irp_here, ': error sending result' stop 3 @@ -358,6 +357,7 @@ subroutine push_pt2_results_async_send(zmq_socket_push, index, pt2_data, b, task else if(rc /= size(pt2_serialized)*8) then stop 'push' endif + deallocate(pt2_serialized) rc = f77_zmq_send( zmq_socket_push, task_id, n_tasks*4, ZMQ_SNDMORE) From 5a591f52405d5dd32f4597ee9cfd5bed8477fa5b Mon Sep 17 00:00:00 2001 From: Yann Damour <77277447+Ydrnan@users.noreply.github.com> Date: Fri, 24 Jan 2025 20:13:32 +0100 Subject: [PATCH 057/175] Fix segfault in scf --- src/scf_utils/roothaan_hall_scf.irp.f | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index 274f08d6..9e2ca4bc 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -228,9 +228,10 @@ subroutine Roothaan_Hall_SCF do while (i mo_num) exit enddo if (m>1) then call dgemm('N','T',ao_num,ao_num,m,1.d0,mo_coef(1,i),size(mo_coef,1),mo_coef(1,i),size(mo_coef,1),0.d0,S,size(S,1)) From d102c0f54f222b4ccbcc242951686f42da9e42c2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 27 Jan 2025 13:29:42 +0100 Subject: [PATCH 058/175] Fix Cholesky H2O 6-31G --- src/ao_two_e_ints/cholesky.irp.f | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index 69b18900..3178a5f1 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -194,14 +194,11 @@ double precision function get_ao_integ_chol(i,j,k,l) + (np+1)*memory_of_double(block_size) ! Ltmp_p(np,block_size) + Ltmp_q(nq,block_size) ! call check_mem(mem) - ! 5. do while ( (Dmax > tau).and.(np > 0) ) ! a. i = i+1 - - block_size = max(N,24) ! Determine nq so that Delta fits in memory @@ -308,6 +305,8 @@ double precision function get_ao_integ_chol(i,j,k,l) Qmax = max(Qmax, D(Dset(q))) enddo + if (Qmax <= Dmin) exit + ! g. iblock = 0 From d01e24c30287f71886da6f8b04370fe7075fbfce Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 27 Jan 2025 16:22:31 +0100 Subject: [PATCH 059/175] Fixed Pointer argument 'map' is not associated --- src/utils/map_module.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/map_module.f90 b/src/utils/map_module.f90 index ceaec874..9ebcbc6d 100644 --- a/src/utils/map_module.f90 +++ b/src/utils/map_module.f90 @@ -157,7 +157,7 @@ subroutine cache_map_reallocate(map,sze) stop 2 endif if (associated(map%value)) then - do i=1_8,min(size(map%key),map%n_elements) + do i=1_8,min(size(map%value),map%n_elements) value_new(i) = map%value(i) enddo deallocate(map%value) From 7d46b5ce3451d33d65ca457963dd3d436ca9668d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 27 Jan 2025 16:36:35 +0100 Subject: [PATCH 060/175] Removed ZeroMQ from AO integrals calculation --- src/ao_two_e_ints/NEED | 1 - .../integrals_erf_in_map_slave.irp.f | 194 -------------- .../integrals_in_map_slave.irp.f | 244 ------------------ src/ao_two_e_ints/providers_ao_erf.irp.f | 51 ++-- src/ao_two_e_ints/two_e_integrals.irp.f | 112 ++++---- 5 files changed, 66 insertions(+), 536 deletions(-) delete mode 100644 src/ao_two_e_ints/integrals_erf_in_map_slave.irp.f delete mode 100644 src/ao_two_e_ints/integrals_in_map_slave.irp.f diff --git a/src/ao_two_e_ints/NEED b/src/ao_two_e_ints/NEED index 542962ec..34b4a641 100644 --- a/src/ao_two_e_ints/NEED +++ b/src/ao_two_e_ints/NEED @@ -2,5 +2,4 @@ hamiltonian ao_one_e_ints pseudo bitmask -zmq ao_basis diff --git a/src/ao_two_e_ints/integrals_erf_in_map_slave.irp.f b/src/ao_two_e_ints/integrals_erf_in_map_slave.irp.f deleted file mode 100644 index ded49233..00000000 --- a/src/ao_two_e_ints/integrals_erf_in_map_slave.irp.f +++ /dev/null @@ -1,194 +0,0 @@ -subroutine ao_two_e_integrals_erf_in_map_slave_tcp(i) - implicit none - integer, intent(in) :: i - BEGIN_DOC -! Computes a buffer of integrals. i is the ID of the current thread. - END_DOC - call ao_two_e_integrals_erf_in_map_slave(0,i) -end - - -subroutine ao_two_e_integrals_erf_in_map_slave_inproc(i) - implicit none - integer, intent(in) :: i - BEGIN_DOC -! Computes a buffer of integrals. i is the ID of the current thread. - END_DOC - call ao_two_e_integrals_erf_in_map_slave(1,i) -end - - - - - -subroutine ao_two_e_integrals_erf_in_map_slave(thread,iproc) - use map_module - use f77_zmq - implicit none - BEGIN_DOC -! Computes a buffer of integrals - END_DOC - - integer, intent(in) :: thread, iproc - - integer :: j,l,n_integrals - integer :: rc - real(integral_kind), allocatable :: buffer_value(:) - integer(key_kind), allocatable :: buffer_i(:) - - integer :: worker_id, task_id - character*(512) :: task - - integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket - integer(ZMQ_PTR) :: zmq_to_qp_run_socket - - integer(ZMQ_PTR), external :: new_zmq_push_socket - integer(ZMQ_PTR) :: zmq_socket_push - - character*(64) :: state - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - - integer, external :: connect_to_taskserver - if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - return - endif - - zmq_socket_push = new_zmq_push_socket(thread) - - allocate ( buffer_i(ao_num*ao_num), buffer_value(ao_num*ao_num) ) - - - do - integer, external :: get_task_from_taskserver - if (get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task) == -1) then - exit - endif - if (task_id == 0) exit - read(task,*) j, l - integer, external :: task_done_to_taskserver - call compute_ao_integrals_erf_jl(j,l,n_integrals,buffer_i,buffer_value) - if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) == -1) then - stop 'Unable to send task_done' - endif - call push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id) - enddo - - integer, external :: disconnect_from_taskserver - if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then - continue - endif - deallocate( buffer_i, buffer_value ) - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - call end_zmq_push_socket(zmq_socket_push,thread) - -end - - -subroutine ao_two_e_integrals_erf_in_map_collector(zmq_socket_pull) - use map_module - use f77_zmq - implicit none - BEGIN_DOC -! Collects results from the AO integral calculation - END_DOC - - integer(ZMQ_PTR), intent(in) :: zmq_socket_pull - integer :: j,l,n_integrals - integer :: rc - - real(integral_kind), allocatable :: buffer_value(:) - integer(key_kind), allocatable :: buffer_i(:) - - integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket - integer(ZMQ_PTR) :: zmq_to_qp_run_socket - - integer(ZMQ_PTR), external :: new_zmq_pull_socket - - integer*8 :: control, accu, sze - integer :: task_id, more - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - - sze = ao_num*ao_num - allocate ( buffer_i(sze), buffer_value(sze) ) - - accu = 0_8 - more = 1 - do while (more == 1) - - rc = f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0) - if (rc == -1) then - n_integrals = 0 - return - endif - if (rc /= 4) then - print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0)' - stop 'error' - endif - - if (n_integrals >= 0) then - - if (n_integrals > sze) then - deallocate (buffer_value, buffer_i) - sze = n_integrals - allocate (buffer_value(sze), buffer_i(sze)) - endif - - rc = f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0) - if (rc /= key_kind*n_integrals) then - print *, rc, key_kind, n_integrals - print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0)' - stop 'error' - endif - - rc = f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0) - if (rc /= integral_kind*n_integrals) then - print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0)' - stop 'error' - endif - - rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0) - -IRP_IF ZMQ_PUSH -IRP_ELSE - rc = f77_zmq_send( zmq_socket_pull, 0, 4, 0) - if (rc /= 4) then - print *, irp_here, ' : f77_zmq_send (zmq_socket_pull,...' - stop 'error' - endif -IRP_ENDIF - - - call insert_into_ao_integrals_erf_map(n_integrals,buffer_i,buffer_value) - accu += n_integrals - if (task_id /= 0) then - integer, external :: zmq_delete_task - if (zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more) == -1) then - stop 'Unable to delete task' - endif - endif - endif - - enddo - - deallocate( buffer_i, buffer_value ) - - integer (map_size_kind) :: get_ao_erf_map_size - control = get_ao_erf_map_size(ao_integrals_erf_map) - - if (control /= accu) then - print *, '' - print *, irp_here - print *, 'Control : ', control - print *, 'Accu : ', accu - print *, 'Some integrals were lost during the parallel computation.' - print *, 'Try to reduce the number of threads.' - stop - endif - - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - -end - diff --git a/src/ao_two_e_ints/integrals_in_map_slave.irp.f b/src/ao_two_e_ints/integrals_in_map_slave.irp.f deleted file mode 100644 index 122fa2ac..00000000 --- a/src/ao_two_e_ints/integrals_in_map_slave.irp.f +++ /dev/null @@ -1,244 +0,0 @@ -subroutine ao_two_e_integrals_in_map_slave_tcp(i) - implicit none - integer, intent(in) :: i - BEGIN_DOC -! Computes a buffer of integrals. i is the ID of the current thread. - END_DOC - call ao_two_e_integrals_in_map_slave(0,i) -end - - -subroutine ao_two_e_integrals_in_map_slave_inproc(i) - implicit none - integer, intent(in) :: i - BEGIN_DOC -! Computes a buffer of integrals. i is the ID of the current thread. - END_DOC - call ao_two_e_integrals_in_map_slave(1,i) -end - - -subroutine push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id) - use f77_zmq - use map_module - implicit none - BEGIN_DOC -! Push integrals in the push socket - END_DOC - integer(ZMQ_PTR), intent(in) :: zmq_socket_push - integer, intent(in) :: n_integrals - integer(key_kind), intent(in) :: buffer_i(*) - real(integral_kind), intent(in) :: buffer_value(*) - integer, intent(in) :: task_id - integer :: rc - - rc = f77_zmq_send( zmq_socket_push, n_integrals, 4, ZMQ_SNDMORE) - if (rc /= 4) then - print *, irp_here, ': f77_zmq_send( zmq_socket_push, n_integrals, 4, ZMQ_SNDMORE)' - stop 'error' - endif - - rc = f77_zmq_send( zmq_socket_push, buffer_i, key_kind*n_integrals, ZMQ_SNDMORE) - if (rc /= key_kind*n_integrals) then - print *, irp_here, ': f77_zmq_send( zmq_socket_push, buffer_i, key_kind*n_integrals, ZMQ_SNDMORE)' - stop 'error' - endif - - rc = f77_zmq_send( zmq_socket_push, buffer_value, integral_kind*n_integrals, ZMQ_SNDMORE) - if (rc /= integral_kind*n_integrals) then - print *, irp_here, ': f77_zmq_send( zmq_socket_push, buffer_value, integral_kind*n_integrals, 0)' - stop 'error' - endif - - rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0) - if (rc /= 4) then - print *, irp_here, ': f77_zmq_send( zmq_socket_push, task_id, 4, 0)' - stop 'error' - endif - -IRP_IF ZMQ_PUSH -IRP_ELSE - integer :: idummy - rc = f77_zmq_recv( zmq_socket_push, idummy, 4, 0) - if (rc /= 4) then - print *, irp_here, ': f77_zmq_send( zmq_socket_push, idummy, 4, 0)' - stop 'error' - endif -IRP_ENDIF -end - - - - - -subroutine ao_two_e_integrals_in_map_slave(thread,iproc) - use map_module - use f77_zmq - implicit none - BEGIN_DOC -! Computes a buffer of integrals - END_DOC - - integer, intent(in) :: thread, iproc - - integer :: j,l,n_integrals - integer :: rc - real(integral_kind), allocatable :: buffer_value(:) - integer(key_kind), allocatable :: buffer_i(:) - - integer :: worker_id, task_id - character*(512) :: task - - integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket - integer(ZMQ_PTR) :: zmq_to_qp_run_socket - - integer(ZMQ_PTR), external :: new_zmq_push_socket - integer(ZMQ_PTR) :: zmq_socket_push - - character*(64) :: state - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - - integer, external :: connect_to_taskserver - if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - return - endif - - zmq_socket_push = new_zmq_push_socket(thread) - - allocate ( buffer_i(ao_num*ao_num), buffer_value(ao_num*ao_num) ) - - - do - integer, external :: get_task_from_taskserver - if (get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task) == -1) then - exit - endif - if (task_id == 0) exit - call sscanf_dd(task, j, l) - integer, external :: task_done_to_taskserver - call compute_ao_integrals_jl(j,l,n_integrals,buffer_i,buffer_value) - if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) == -1) then - stop 'Unable to send task_done' - endif - call push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id) - enddo - - integer, external :: disconnect_from_taskserver - if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then - continue - endif - deallocate( buffer_i, buffer_value ) - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - call end_zmq_push_socket(zmq_socket_push,thread) - -end - - -subroutine ao_two_e_integrals_in_map_collector(zmq_socket_pull) - use map_module - use f77_zmq - implicit none - BEGIN_DOC -! Collects results from the AO integral calculation - END_DOC - - integer(ZMQ_PTR), intent(in) :: zmq_socket_pull - integer :: j,l,n_integrals - integer :: rc - - real(integral_kind), allocatable :: buffer_value(:) - integer(key_kind), allocatable :: buffer_i(:) - - integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket - integer(ZMQ_PTR) :: zmq_to_qp_run_socket - - integer(ZMQ_PTR), external :: new_zmq_pull_socket - - integer*8 :: control, accu, sze - integer :: task_id, more - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - - sze = ao_num*ao_num - allocate ( buffer_i(sze), buffer_value(sze) ) - - accu = 0_8 - more = 1 - do while (more == 1) - - rc = f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0) - if (rc == -1) then - n_integrals = 0 - return - endif - if (rc /= 4) then - print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0)' - stop 'error' - endif - - if (n_integrals >= 0) then - - if (n_integrals > sze) then - deallocate (buffer_value, buffer_i) - sze = n_integrals - allocate (buffer_value(sze), buffer_i(sze)) - endif - - rc = f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0) - if (rc /= key_kind*n_integrals) then - print *, rc, key_kind, n_integrals - print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0)' - stop 'error' - endif - - rc = f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0) - if (rc /= integral_kind*n_integrals) then - print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0)' - stop 'error' - endif - - rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0) - -IRP_IF ZMQ_PUSH -IRP_ELSE - rc = f77_zmq_send( zmq_socket_pull, 0, 4, 0) - if (rc /= 4) then - print *, irp_here, ' : f77_zmq_send (zmq_socket_pull,...' - stop 'error' - endif -IRP_ENDIF - - - call insert_into_ao_integrals_map(n_integrals,buffer_i,buffer_value) - accu += n_integrals - if (task_id /= 0) then - integer, external :: zmq_delete_task - if (zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more) == -1) then - stop 'Unable to delete task' - endif - endif - endif - - enddo - - deallocate( buffer_i, buffer_value ) - - integer (map_size_kind) :: get_ao_map_size - control = get_ao_map_size(ao_integrals_map) - - if (control /= accu) then - print *, '' - print *, irp_here - print *, 'Control : ', control - print *, 'Accu : ', accu - print *, 'Some integrals were lost during the parallel computation.' - print *, 'Try to reduce the number of threads.' - stop - endif - - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - -end - diff --git a/src/ao_two_e_ints/providers_ao_erf.irp.f b/src/ao_two_e_ints/providers_ao_erf.irp.f index ff8c31a2..8468fb0a 100644 --- a/src/ao_two_e_ints/providers_ao_erf.irp.f +++ b/src/ao_two_e_ints/providers_ao_erf.irp.f @@ -1,7 +1,5 @@ - BEGIN_PROVIDER [ logical, ao_two_e_integrals_erf_in_map ] implicit none - use f77_zmq use map_module BEGIN_DOC ! Map of Atomic integrals @@ -15,17 +13,16 @@ ! For integrals file integer(key_kind),allocatable :: buffer_i(:) - integer,parameter :: size_buffer = 1024*64 + integer :: size_buffer real(integral_kind),allocatable :: buffer_value(:) integer :: n_integrals, rc integer :: kk, m, j1, i1, lmax character*(64) :: fmt - integral = ao_two_e_integral_erf(1,1,1,1) - double precision :: map_mb - PROVIDE read_ao_two_e_integrals_erf io_ao_two_e_integrals_erf + PROVIDE read_ao_two_e_integrals_erf io_ao_two_e_integrals_erf ao_integrals_erf_map + if (read_ao_two_e_integrals_erf) then print*,'Reading the AO ERF integrals' call map_load_from_disk(trim(ezfio_filename)//'/work/ao_ints_erf',ao_integrals_erf_map) @@ -39,37 +36,27 @@ call wall_time(wall_1) call cpu_time(cpu_1) - integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull - call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'ao_integrals_erf') + if (.True.) then + ! Avoid openMP + integral = ao_two_e_integral_erf(1,1,1,1) + endif - character(len=:), allocatable :: task - allocate(character(len=ao_num*12) :: task) - write(fmt,*) '(', ao_num, '(I5,X,I5,''|''))' + size_buffer = ao_num*ao_num + !$OMP PARALLEL DEFAULT(shared) private(j,l) & + !$OMP PRIVATE(buffer_i, buffer_value, n_integrals) + allocate(buffer_i(size_buffer), buffer_value(size_buffer)) + n_integrals = 0 + !$OMP DO COLLAPSE(1) SCHEDULE(dynamic) do l=1,ao_num - write(task,fmt) (i,l, i=1,l) - integer, external :: add_task_to_taskserver - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task)) == -1) then - stop 'Unable to add task to server' - endif + do j=1,l + call compute_ao_integrals_erf_jl(j,l,n_integrals,buffer_i,buffer_value) + call insert_into_ao_integrals_erf_map(n_integrals,buffer_i,buffer_value) + enddo enddo - deallocate(task) - - integer, external :: zmq_set_running - if (zmq_set_running(zmq_to_qp_run_socket) == -1) then - print *, irp_here, ': Failed in zmq_set_running' - endif - - PROVIDE nproc - !$OMP PARALLEL DEFAULT(shared) private(i) num_threads(nproc+1) - i = omp_get_thread_num() - if (i==0) then - call ao_two_e_integrals_erf_in_map_collector(zmq_socket_pull) - else - call ao_two_e_integrals_erf_in_map_slave_inproc(i) - endif + !$OMP END DO + deallocate(buffer_i, buffer_value) !$OMP END PARALLEL - call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'ao_integrals_erf') print*, 'Sorting the map' diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index e4bd9d1d..fb376ce1 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -397,7 +397,6 @@ subroutine compute_ao_two_e_integrals(j,k,l,sze,buffer_value) BEGIN_PROVIDER [ logical, ao_two_e_integrals_in_map ] implicit none - use f77_zmq use map_module BEGIN_DOC ! Map of Atomic integrals @@ -411,7 +410,7 @@ subroutine compute_ao_two_e_integrals(j,k,l,sze,buffer_value) ! For integrals file integer(key_kind),allocatable :: buffer_i(:) - integer,parameter :: size_buffer = 1024*64 + integer :: size_buffer real(integral_kind),allocatable :: buffer_value(:) integer :: n_integrals, rc @@ -419,78 +418,61 @@ subroutine compute_ao_two_e_integrals(j,k,l,sze,buffer_value) character*(64) :: fmt double precision :: map_mb - PROVIDE read_ao_two_e_integrals io_ao_two_e_integrals + PROVIDE read_ao_two_e_integrals io_ao_two_e_integrals ao_integrals_map + if (read_ao_two_e_integrals) then print*,'Reading the AO integrals' call map_load_from_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map) print*, 'AO integrals provided' ao_two_e_integrals_in_map = .True. - else + return + endif - print*, 'Providing the AO integrals' - call wall_time(wall_0) - call wall_time(wall_1) - call cpu_time(cpu_1) + print*, 'Providing the AO integrals' + call wall_time(wall_0) + call wall_time(wall_1) + call cpu_time(cpu_1) - if (.True.) then - ! Avoid openMP - integral = ao_two_e_integral(1,1,1,1) - endif + if (.True.) then + ! Avoid openMP + integral = ao_two_e_integral(1,1,1,1) + endif - integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull - call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'ao_integrals') - - character(len=:), allocatable :: task - allocate(character(len=ao_num*12) :: task) - write(fmt,*) '(', ao_num, '(I5,X,I5,''|''))' - do l=1,ao_num - write(task,fmt) (i,l, i=1,l) - integer, external :: add_task_to_taskserver - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task)) == -1) then - stop 'Unable to add task to server' - endif + size_buffer = ao_num*ao_num + !$OMP PARALLEL DEFAULT(shared) private(j,l) & + !$OMP PRIVATE(buffer_i, buffer_value, n_integrals) + allocate(buffer_i(size_buffer), buffer_value(size_buffer)) + n_integrals = 0 + !$OMP DO COLLAPSE(1) SCHEDULE(dynamic) + do l=1,ao_num + do j=1,l + call compute_ao_integrals_jl(j,l,n_integrals,buffer_i,buffer_value) + call insert_into_ao_integrals_map(n_integrals,buffer_i,buffer_value) enddo - deallocate(task) - - integer, external :: zmq_set_running - if (zmq_set_running(zmq_to_qp_run_socket) == -1) then - print *, irp_here, ': Failed in zmq_set_running' - endif - - PROVIDE nproc - !$OMP PARALLEL DEFAULT(shared) private(i) num_threads(nproc+1) - i = omp_get_thread_num() - if (i==0) then - call ao_two_e_integrals_in_map_collector(zmq_socket_pull) - else - call ao_two_e_integrals_in_map_slave_inproc(i) - endif - !$OMP END PARALLEL - - call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'ao_integrals') - - - print*, 'Sorting the map' - call map_sort(ao_integrals_map) - call cpu_time(cpu_2) - call wall_time(wall_2) - integer(map_size_kind) :: get_ao_map_size, ao_map_size - ao_map_size = get_ao_map_size() - - print*, 'AO integrals provided:' - print*, ' Size of AO map : ', map_mb(ao_integrals_map) ,'MB' - print*, ' Number of AO integrals :', ao_map_size - print*, ' cpu time :',cpu_2 - cpu_1, 's' - print*, ' wall time :',wall_2 - wall_1, 's ( x ', (cpu_2-cpu_1)/(wall_2-wall_1+tiny(1.d0)), ' )' - - ao_two_e_integrals_in_map = .True. - - if (write_ao_two_e_integrals.and.mpi_master) then - call ezfio_set_work_empty(.False.) - call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map) - call ezfio_set_ao_two_e_ints_io_ao_two_e_integrals('Read') - endif - + enddo + !$OMP END DO + deallocate(buffer_i, buffer_value) + !$OMP END PARALLEL + + print*, 'Sorting the map' + call map_sort(ao_integrals_map) + call cpu_time(cpu_2) + call wall_time(wall_2) + integer(map_size_kind) :: get_ao_map_size, ao_map_size + ao_map_size = get_ao_map_size() + + print*, 'AO integrals provided:' + print*, ' Size of AO map : ', map_mb(ao_integrals_map) ,'MB' + print*, ' Number of AO integrals :', ao_map_size + print*, ' cpu time :',cpu_2 - cpu_1, 's' + print*, ' wall time :',wall_2 - wall_1, 's ( x ', (cpu_2-cpu_1)/(wall_2-wall_1+tiny(1.d0)), ' )' + + ao_two_e_integrals_in_map = .True. + + if (write_ao_two_e_integrals.and.mpi_master) then + call ezfio_set_work_empty(.False.) + call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_map) + call ezfio_set_ao_two_e_ints_io_ao_two_e_integrals('Read') endif END_PROVIDER From 3478e741a4c332b7373ad00aa3c443d9f4dbd2d2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 30 Jan 2025 13:13:34 +0100 Subject: [PATCH 061/175] Updated EZFIO --- external/ezfio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 From e1523c492941cd8a9d290743956b6b2a20f589bf Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 31 Jan 2025 11:40:49 +0100 Subject: [PATCH 062/175] Removed irrelevent dependency on cholesky --- src/mo_two_e_ints/map_integrals.irp.f | 4 ++-- src/tools/print_energy.irp.f | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 6040842e..5b233899 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -155,7 +155,7 @@ double precision function get_two_e_integral(i,j,k,l,map) type(map_type), intent(inout) :: map real(integral_kind) :: tmp - PROVIDE mo_two_e_integrals_in_map mo_integrals_cache do_mo_cholesky mo_cholesky_double cholesky_mo_transp_sp cholesky_mo_transp + PROVIDE mo_two_e_integrals_in_map mo_integrals_cache do_mo_cholesky if (use_banned_excitation) then if (banned_excitation(i,k)) then @@ -570,7 +570,7 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) type(map_type), intent(inout) :: map integer :: i double precision, external :: get_two_e_integral - PROVIDE mo_two_e_integrals_in_map mo_cholesky_double cholesky_mo_transp cholesky_mo_transp_sp + PROVIDE mo_two_e_integrals_in_map mo_cholesky_double if ( (mo_integrals_cache_min>1).or.(mo_integrals_cache_max Date: Fri, 31 Jan 2025 17:14:49 +0100 Subject: [PATCH 063/175] Stabilize PT2 when expected accuracy is low --- external/ezfio | 2 +- src/cipsi_utils/pt2_stoch_routines.irp.f | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/ezfio b/external/ezfio index d02132ea..dba01c4f 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 +Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 diff --git a/src/cipsi_utils/pt2_stoch_routines.irp.f b/src/cipsi_utils/pt2_stoch_routines.irp.f index 144d052d..162ab02c 100644 --- a/src/cipsi_utils/pt2_stoch_routines.irp.f +++ b/src/cipsi_utils/pt2_stoch_routines.irp.f @@ -530,7 +530,7 @@ subroutine pt2_collector(zmq_socket_pull, E, relative_error, pt2_data, pt2_data_ avg = E0 + pt2_data_S(t) % pt2(pt2_stoch_istate) / dble(c) avg2 = v0 + pt2_data_S(t) % variance(pt2_stoch_istate) / dble(c) avg3(:) = n0(:) + pt2_data_S(t) % overlap(:,pt2_stoch_istate) / dble(c) - if ((avg /= 0.d0) .or. (n == N_det_generators) ) then + if (((c>=10).and.(avg /= 0.d0)) .or. (n == N_det_generators) ) then do_exit = .true. endif if (qp_stop()) then From 4b9939e738fbecf831847c9047a8bd11b99abd9b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 3 Feb 2025 13:41:46 +0100 Subject: [PATCH 064/175] Fix qp_exc_energy.py:195: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated --- scripts/qp_exc_energy.py | 12 ++++++++++-- src/davidson/u0_hs2_u0.irp.f | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/qp_exc_energy.py b/scripts/qp_exc_energy.py index 44136311..e08866e3 100755 --- a/scripts/qp_exc_energy.py +++ b/scripts/qp_exc_energy.py @@ -157,11 +157,15 @@ def compute(data): B = np.array( [ [ data[-1][0] ], [ data[-2][0] ] ] ) E0 = np.linalg.solve(A,B)[1] +E0 = E0[0] + A = np.array( [ [ data[-1][4], 1. ], [ data[-2][4], 1. ] ] ) B = np.array( [ [ data[-1][3] ], [ data[-2][3] ] ] ) E1 = np.linalg.solve(A,B)[1] +E1 = E1[0] + average_2 = (E1-E0)*to_eV A = np.array( [ [ data[-1][1], 1. ], @@ -170,14 +174,18 @@ def compute(data): B = np.array( [ [ data[-1][0] ], [ data[-2][0] ], [ data[-3][0] ] ] ) -E0 = np.linalg.lstsq(A,B,rcond=None)[0][1] +E0 = np.linalg.lstsq(A,B,rcond=None)[0] +E0 = E0[0][0] + A = np.array( [ [ data[-1][4], 1. ], [ data[-2][4], 1. ], [ data[-3][4], 1. ] ] ) B = np.array( [ [ data[-1][3] ], [ data[-2][3] ], [ data[-3][3] ] ] ) -E1 = np.linalg.lstsq(A,B,rcond=None)[0][1] +E1 = np.linalg.lstsq(A,B,rcond=None)[0] +E1 = E1[0][0] + average_3 = (E1-E0)*to_eV exc = ((data[-1][3] + data[-1][4]) - (data[-1][0] + data[-1][1])) * to_eV diff --git a/src/davidson/u0_hs2_u0.irp.f b/src/davidson/u0_hs2_u0.irp.f index 3afe4ec6..f2ce7aa9 100644 --- a/src/davidson/u0_hs2_u0.irp.f +++ b/src/davidson/u0_hs2_u0.irp.f @@ -291,7 +291,7 @@ subroutine H_S2_u_0_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart,iend, ASSERT (istart > 0) ASSERT (istep > 0) - !$OMP DO SCHEDULE(guided,64) + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep krow = psi_bilinear_matrix_rows(k_a) @@ -469,7 +469,7 @@ subroutine H_S2_u_0_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart,iend, enddo !$OMP END DO - !$OMP DO SCHEDULE(guided,64) + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep From dc75f495001a13dd38209a220d7230fb5ad3e450 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 3 Feb 2025 14:05:28 +0100 Subject: [PATCH 065/175] Added selected MRCI module --- src/cipsi_utils/pt2_stoch_routines.irp.f | 1 + src/mo_basis/utils.irp.f | 2 +- src/mrci/EZFIO.cfg | 24 +++++++++ src/mrci/NEED | 4 ++ src/mrci/README.rst | 17 +++++++ src/mrci/class.irp.f | 8 +++ src/mrci/mrci.irp.f | 64 ++++++++++++++++++++++++ src/mrci/save_energy.irp.f | 10 ++++ 8 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 src/mrci/EZFIO.cfg create mode 100644 src/mrci/NEED create mode 100644 src/mrci/README.rst create mode 100644 src/mrci/class.irp.f create mode 100644 src/mrci/mrci.irp.f create mode 100644 src/mrci/save_energy.irp.f diff --git a/src/cipsi_utils/pt2_stoch_routines.irp.f b/src/cipsi_utils/pt2_stoch_routines.irp.f index 162ab02c..68a3c9fc 100644 --- a/src/cipsi_utils/pt2_stoch_routines.irp.f +++ b/src/cipsi_utils/pt2_stoch_routines.irp.f @@ -212,6 +212,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in) ipos += 1 endif enddo + call write_int(6,pt2_stoch_istate,'State') call write_int(6,sum(pt2_F),'Number of tasks') call write_int(6,ipos,'Number of fragmented tasks') diff --git a/src/mo_basis/utils.irp.f b/src/mo_basis/utils.irp.f index 987c394a..3f83b518 100644 --- a/src/mo_basis/utils.irp.f +++ b/src/mo_basis/utils.irp.f @@ -228,7 +228,7 @@ subroutine mo_as_svd_vectors_of_mo_matrix_eig(matrix,lda,m,n,eig,label) call dgemm('N','N',ao_num,m,m,1.d0,mo_coef_new,size(mo_coef_new,1),U,size(U,1),0.d0,mo_coef,size(mo_coef,1)) do i=1,m - if (eig(i) > 1.d-20) then + if (D(i) > 1.d-20) then eig(i) = D(i) else eig(i) = 0.d0 diff --git a/src/mrci/EZFIO.cfg b/src/mrci/EZFIO.cfg new file mode 100644 index 00000000..c8efd4b9 --- /dev/null +++ b/src/mrci/EZFIO.cfg @@ -0,0 +1,24 @@ +[energy] +type: double precision +doc: Calculated Selected CASSD energy +interface: ezfio +size: (determinants.n_states) + +[energy_pt2] +type: double precision +doc: Calculated CASSD energy + PT2 +interface: ezfio +size: (determinants.n_states) + + +[do_ddci] +type: logical +doc: If true, remove purely inactive double excitations +interface: ezfio,provider,ocaml +default: False + +[do_only_1h1p] +type: logical +doc: If true, do only one hole/one particle excitations +interface: ezfio,provider,ocaml +default: False diff --git a/src/mrci/NEED b/src/mrci/NEED new file mode 100644 index 00000000..ad99293f --- /dev/null +++ b/src/mrci/NEED @@ -0,0 +1,4 @@ +cipsi +generators_cas +selectors_full +davidson_undressed diff --git a/src/mrci/README.rst b/src/mrci/README.rst new file mode 100644 index 00000000..ac3c0139 --- /dev/null +++ b/src/mrci/README.rst @@ -0,0 +1,17 @@ +==== +mrci +==== + + +|CIPSI| algorithm in the multi-reference CI space (CAS + Singles and Doubles). + + +This module is the same as the :ref:`fci` module, except for the choice of the +generator and selector determinants. + +The inactive, active and virtual |MOs| will need to be set with the +:ref:`qp_set_mo_class` program. + +.. seealso:: + + The documentation of the :ref:`fci` module. diff --git a/src/mrci/class.irp.f b/src/mrci/class.irp.f new file mode 100644 index 00000000..271eb930 --- /dev/null +++ b/src/mrci/class.irp.f @@ -0,0 +1,8 @@ +BEGIN_PROVIDER [ logical, do_only_cas ] + implicit none + BEGIN_DOC + ! In the CAS+SD case, always false + END_DOC + do_only_cas = .False. +END_PROVIDER + diff --git a/src/mrci/mrci.irp.f b/src/mrci/mrci.irp.f new file mode 100644 index 00000000..ef4a2454 --- /dev/null +++ b/src/mrci/mrci.irp.f @@ -0,0 +1,64 @@ +program mrci + implicit none + BEGIN_DOC +! Selected CAS+Singles and Doubles with stochastic selection +! and PT2. +! +! This program performs a |CIPSI|-like selected |CI| using a +! stochastic scheme for both the selection of the important Slater +! determinants and the computation of the |PT2| correction. This +! |CIPSI|-like algorithm will be performed for the lowest states of +! the variational space (see :option:`determinants n_states`). The +! program will stop when reaching at least one the two following +! conditions: +! +! * number of Slater determinants > :option:`determinants n_det_max` +! * |PT2| < :option:`perturbation pt2_max` +! +! The following other options can be of interest: +! +! :option:`determinants read_wf` +! When set to |false|, the program starts with a ROHF-like Slater +! determinant as a guess wave function. When set to |true|, the +! program starts with the wave function(s) stored in the |EZFIO| +! directory as guess wave function(s). +! +! :option:`determinants s2_eig` +! When set to |true|, the selection will systematically add all the +! necessary Slater determinants in order to have a pure spin wave +! function with an |S^2| value corresponding to +! :option:`determinants expected_s2`. +! +! For excited states calculations, it is recommended to start with +! :ref:`.cis.` or :ref:`.cisd.` guess wave functions, eventually in +! a restricted set of |MOs|, and to set :option:`determinants s2_eig` +! to |true|. +! + END_DOC + + PROVIDE all_mo_integrals + if (.not.is_zmq_slave) then + PROVIDE psi_det psi_coef + + write(json_unit,json_array_open_fmt) 'fci' + + double precision, allocatable :: Ev(:),PT2(:) + allocate(Ev(N_states), PT2(N_states)) + if (do_pt2) then + call run_stochastic_cipsi(Ev,PT2) + else + call run_cipsi + endif + + write(json_unit,json_dict_uopen_fmt) + write(json_unit,json_dict_close_fmtx) + write(json_unit,json_array_close_fmtx) + call json_close + + else + PROVIDE pt2_min_parallel_tasks + + call run_slave_cipsi + + endif +end diff --git a/src/mrci/save_energy.irp.f b/src/mrci/save_energy.irp.f new file mode 100644 index 00000000..28840b6c --- /dev/null +++ b/src/mrci/save_energy.irp.f @@ -0,0 +1,10 @@ +subroutine save_energy(E,pt2) + implicit none + BEGIN_DOC +! Saves the energy in |EZFIO|. + END_DOC + double precision, intent(in) :: E(N_states), pt2(N_states) + call ezfio_set_mrci_energy(E(1:N_states)) + call ezfio_set_mrci_energy_pt2(E(1:N_states)+pt2(1:N_states)) +end + From 6611722d32aad4ac8852de6eba7adef3834bfb49 Mon Sep 17 00:00:00 2001 From: eginer Date: Tue, 4 Feb 2025 11:31:11 +0100 Subject: [PATCH 066/175] put more explicit print in print_su_pbe_ot.irp.f --- plugins/local/basis_correction/print_su_pbe_ot.irp.f | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/local/basis_correction/print_su_pbe_ot.irp.f b/plugins/local/basis_correction/print_su_pbe_ot.irp.f index 49f90ade..0f196e60 100644 --- a/plugins/local/basis_correction/print_su_pbe_ot.irp.f +++ b/plugins/local/basis_correction/print_su_pbe_ot.irp.f @@ -18,6 +18,7 @@ program basis_corr_su_pbe_ot subroutine print_su_pbe_ot implicit none integer :: istate + print*,'Two flavours of PBE functionals :' do istate = 1, N_states write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate) enddo From 0647a9db5f7173189cf38451a7032436b21f0d57 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Feb 2025 14:49:39 +0100 Subject: [PATCH 067/175] Starting optimization of open-shell ccsd --- src/ccsd/ccsd_space_orb.irp.f | 5 +- src/ccsd/ccsd_spin_orb.irp.f | 2 - src/ccsd/ccsd_spin_orb_sub.irp.f | 444 ++++++++++++++--------------- src/utils_cc/mo_integrals_cc.irp.f | 16 ++ 4 files changed, 229 insertions(+), 238 deletions(-) diff --git a/src/ccsd/ccsd_space_orb.irp.f b/src/ccsd/ccsd_space_orb.irp.f index 53028ec0..91f703a0 100644 --- a/src/ccsd/ccsd_space_orb.irp.f +++ b/src/ccsd/ccsd_space_orb.irp.f @@ -1,9 +1,10 @@ -! Code - program ccsd implicit none + BEGIN_DOC + ! Closed-shell CCSD + END_DOC read_wf = .True. touch read_wf diff --git a/src/ccsd/ccsd_spin_orb.irp.f b/src/ccsd/ccsd_spin_orb.irp.f index 6f2de11c..04344fbb 100644 --- a/src/ccsd/ccsd_spin_orb.irp.f +++ b/src/ccsd/ccsd_spin_orb.irp.f @@ -1,5 +1,3 @@ -! Prog - program ccsd implicit none diff --git a/src/ccsd/ccsd_spin_orb_sub.irp.f b/src/ccsd/ccsd_spin_orb_sub.irp.f index 09d6a0fe..fe202ebf 100644 --- a/src/ccsd/ccsd_spin_orb_sub.irp.f +++ b/src/ccsd/ccsd_spin_orb_sub.irp.f @@ -11,9 +11,9 @@ subroutine run_ccsd_spin_orb double precision, allocatable :: t1(:,:), t2(:,:,:,:), tau(:,:,:,:), tau_t(:,:,:,:) double precision, allocatable :: r1(:,:), r2(:,:,:,:) double precision, allocatable :: cF_oo(:,:), cF_ov(:,:), cF_vv(:,:) - double precision, allocatable :: cW_oooo(:,:,:,:), cW_ovvo(:,:,:,:), cW_vvvv(:,:,:,:) - - double precision, allocatable :: f_oo(:,:), f_ov(:,:), f_vv(:,:), f_o(:), f_v(:) + double precision, allocatable :: cW_oooo(:,:,:,:), cW_ovvo(:,:,:,:) !, cW_vvvv(:,:,:,:) + + double precision, allocatable :: f_o(:), f_v(:) double precision, allocatable :: v_oooo(:,:,:,:), v_vooo(:,:,:,:), v_ovoo(:,:,:,:) double precision, allocatable :: v_oovo(:,:,:,:), v_ooov(:,:,:,:), v_vvoo(:,:,:,:) double precision, allocatable :: v_vovo(:,:,:,:), v_voov(:,:,:,:), v_ovvo(:,:,:,:) @@ -24,8 +24,7 @@ subroutine run_ccsd_spin_orb double precision, allocatable :: all_err(:,:), all_t(:,:) logical :: not_converged - integer, allocatable :: list_occ(:,:), list_vir(:,:) - integer :: nO,nV,nOa,nOb,nVa,nVb,nO_m,nV_m,nO_S(2),nV_S(2),n_spin(4) + integer :: nOa,nOb,nVa,nVb,nO_m,nV_m,nO_S(2),nV_S(2),n_spin(4) integer :: nb_iter, i,j,a,b double precision :: uncorr_energy, energy, max_r, max_r1, max_r2, cc, ta, tb,ti,tf,tbi,tfi integer(bit_kind) :: det(N_int,2) @@ -33,7 +32,7 @@ subroutine run_ccsd_spin_orb det = psi_det(:,:,cc_ref) print*,'Reference determinant:' call print_det(det,N_int) - + ! Extract number of occ/vir alpha/beta spin orbitals !call extract_n_spin(det,n_spin) nOa = cc_nOa !n_spin(1) @@ -41,107 +40,83 @@ subroutine run_ccsd_spin_orb nVa = cc_nVa !n_spin(3) nVb = cc_nVb !n_spin(4) - ! Total number of occ/vir spin orb - nO = cc_nOab !nOa + nOb - nV = cc_nVab !nVa + nVb - ! Debug - !print*,nO,nV - ! Number of occ/vir spin orb per spin nO_S = cc_nO_S !(/nOa,nOb/) nV_S = cc_nV_S !(/nVa,nVb/) ! Debug !print*,nO_S,nV_S - ! Maximal number of occ/vir + ! Maximal number of occ/vir nO_m = cc_nO_m !max(nOa, nOb) nV_m = cc_nV_m !max(nVa, nVb) ! Debug !print*,nO_m,nV_m - - allocate(list_occ(nO_m,2), list_vir(nV_m,2)) - list_occ = cc_list_occ_spin - list_vir = cc_list_vir_spin - ! Debug - !call extract_list_orb_spin(det,nO_m,nV_m,list_occ,list_vir) - !print*,list_occ(:,1) - !print*,list_occ(:,2) - !print*,list_vir(:,1) - !print*,list_vir(:,2) ! Allocation - allocate(t1(nO,nV), t2(nO,nO,nV,nV), tau(nO,nO,nV,nV), tau_t(nO,nO,nV,nV)) - allocate(r1(nO,nV), r2(nO,nO,nV,nV)) - allocate(cF_oo(nO,nO), cF_ov(nO,nV), cF_vv(nV,nV)) - allocate(cW_oooo(nO,nO,nO,nO), cW_ovvo(nO,nV,nV,nO))!, cW_vvvv(nV,nV,nV,nV)) - allocate(v_oooo(nO,nO,nO,nO)) - !allocate(v_vooo(nV,nO,nO,nO)) - allocate(v_ovoo(nO,nV,nO,nO)) - allocate(v_oovo(nO,nO,nV,nO)) - allocate(v_ooov(nO,nO,nO,nV)) - allocate(v_vvoo(nV,nV,nO,nO)) - !allocate(v_vovo(nV,nO,nV,nO)) - !allocate(v_voov(nV,nO,nO,nV)) - allocate(v_ovvo(nO,nV,nV,nO)) - allocate(v_ovov(nO,nV,nO,nV)) - allocate(v_oovv(nO,nO,nV,nV)) - !allocate(v_vvvo(nV,nV,nV,nO)) - !allocate(v_vvov(nV,nV,nO,nV)) - !allocate(v_vovv(nV,nO,nV,nV)) - !allocate(v_ovvv(nO,nV,nV,nV)) - !allocate(v_vvvv(nV,nV,nV,nV)) - allocate(f_o(nO), f_v(nV)) - allocate(f_oo(nO, nO)) - allocate(f_ov(nO, nV)) - allocate(f_vv(nV, nV)) - + allocate(t1(cc_nOab,cc_nVab), t2(cc_nOab,cc_nOab,cc_nVab,cc_nVab), tau(cc_nOab,cc_nOab,cc_nVab,cc_nVab), tau_t(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) + allocate(r1(cc_nOab,cc_nVab), r2(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) + allocate(cF_oo(cc_nOab,cc_nOab), cF_ov(cc_nOab,cc_nVab), cF_vv(cc_nVab,cc_nVab)) + allocate(cW_oooo(cc_nOab,cc_nOab,cc_nOab,cc_nOab), cW_ovvo(cc_nOab,cc_nVab,cc_nVab,cc_nOab))!, cW_vvvv(cc_nVab,cc_nVab,cc_nVab,cc_nVab)) + allocate(v_oooo(cc_nOab,cc_nOab,cc_nOab,cc_nOab)) + !allocate(v_vooo(cc_nVab,cc_nOab,cc_nOab,cc_nOab)) + allocate(v_ovoo(cc_nOab,cc_nVab,cc_nOab,cc_nOab)) + allocate(v_oovo(cc_nOab,cc_nOab,cc_nVab,cc_nOab)) + allocate(v_ooov(cc_nOab,cc_nOab,cc_nOab,cc_nVab)) + allocate(v_vvoo(cc_nVab,cc_nVab,cc_nOab,cc_nOab)) + !allocate(v_vovo(cc_nVab,cc_nOab,cc_nVab,cc_nOab)) + !allocate(v_voov(cc_nVab,cc_nOab,cc_nOab,cc_nVab)) + allocate(v_ovvo(cc_nOab,cc_nVab,cc_nVab,cc_nOab)) + allocate(v_ovov(cc_nOab,cc_nVab,cc_nOab,cc_nVab)) + allocate(v_oovv(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) + !allocate(v_vvvo(cc_nVab,cc_nVab,cc_nVab,cc_nOab)) + !allocate(v_vvov(cc_nVab,cc_nVab,cc_nOab,cc_nVab)) + !allocate(v_vovv(cc_nVab,cc_nOab,cc_nVab,cc_nVab)) + !allocate(v_ovvv(cc_nOab,cc_nVab,cc_nVab,cc_nVab)) + !allocate(v_vvvv(cc_nVab,cc_nVab,cc_nVab,cc_nVab)) + allocate(f_o(cc_nOab), f_v(cc_nVab)) + ! Allocation for the diis if (cc_update_method == 'diis') then - allocate(all_err(nO*nV+nO*nO*nV*nV,cc_diis_depth), all_t(nO*nV+nO*nO*nV*nV,cc_diis_depth)) + allocate(all_err(cc_nOab*cc_nVab+cc_nOab*cc_nOab*cc_nVab*cc_nVab,cc_diis_depth), all_t(cc_nOab*cc_nVab+cc_nOab*cc_nOab*cc_nVab*cc_nVab,cc_diis_depth)) all_err = 0d0 all_t = 0d0 endif - ! Fock elements - call gen_f_spin(det, nO_m,nO_m, nO_S,nO_S, list_occ,list_occ, nO,nO, f_oo) - call gen_f_spin(det, nO_m,nV_m, nO_S,nV_S, list_occ,list_vir, nO,nV, f_ov) - call gen_f_spin(det, nV_m,nV_m, nV_S,nV_S, list_vir,list_vir, nV,nV, f_vv) - ! Diag elements - do i = 1, nO - f_o(i) = f_oo(i,i) + do i = 1, cc_nOab + f_o(i) = cc_spin_f_oo(i,i) enddo - do i = 1, nV - f_v(i) = f_vv(i,i) + do i = 1, cc_nVab + f_v(i) = cc_spin_f_vv(i,i) enddo ! Bi electronic integrals from list call wall_time(ti) ! OOOO - call gen_v_spin(nO_m,nO_m,nO_m,nO_m, nO_S,nO_S,nO_S,nO_S, list_occ,list_occ,list_occ,list_occ, nO,nO,nO,nO, v_oooo) + call gen_v_spin(nO_m,nO_m,nO_m,nO_m, nO_S,nO_S,nO_S,nO_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nOab,cc_nOab,cc_nOab,cc_nOab, v_oooo) ! OOO V - !call gen_v_spin(nV_m,nO_m,nO_m,nO_m, nV_S,nO_S,nO_S,nO_S, list_vir,list_occ,list_occ,list_occ, nV,nO,nO,nO, v_vooo) - call gen_v_spin(nO_m,nV_m,nO_m,nO_m, nO_S,nV_S,nO_S,nO_S, list_occ,list_vir,list_occ,list_occ, nO,nV,nO,nO, v_ovoo) - call gen_v_spin(nO_m,nO_m,nV_m,nO_m, nO_S,nO_S,nV_S,nO_S, list_occ,list_occ,list_vir,list_occ, nO,nO,nV,nO, v_oovo) - call gen_v_spin(nO_m,nO_m,nO_m,nV_m, nO_S,nO_S,nO_S,nV_S, list_occ,list_occ,list_occ,list_vir, nO,nO,nO,nV, v_ooov) + !call gen_v_spin(nV_m,nO_m,nO_m,nO_m, nV_S,nO_S,nO_S,nO_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nVab,cc_nOab,cc_nOab,cc_nOab, v_vooo) + call gen_v_spin(nO_m,nV_m,nO_m,nO_m, nO_S,nV_S,nO_S,nO_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nOab,cc_nVab,cc_nOab,cc_nOab, v_ovoo) + call gen_v_spin(nO_m,nO_m,nV_m,nO_m, nO_S,nO_S,nV_S,nO_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nOab,cc_nOab,cc_nVab,cc_nOab, v_oovo) + call gen_v_spin(nO_m,nO_m,nO_m,nV_m, nO_S,nO_S,nO_S,nV_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nOab,cc_nOab,cc_nOab,cc_nVab, v_ooov) ! OO VV - call gen_v_spin(nV_m,nV_m,nO_m,nO_m, nV_S,nV_S,nO_S,nO_S, list_vir,list_vir,list_occ,list_occ, nV,nV,nO,nO, v_vvoo) - !call gen_v_spin(nV_m,nO_m,nV_m,nO_m, nV_S,nO_S,nV_S,nO_S, list_vir,list_occ,list_vir,list_occ, nV,nO,nV,nO, v_vovo) - !call gen_v_spin(nV_m,nO_m,nO_m,nV_m, nV_S,nO_S,nO_S,nV_S, list_vir,list_occ,list_occ,list_vir, nV,nO,nO,nV, v_voov) - call gen_v_spin(nO_m,nV_m,nV_m,nO_m, nO_S,nV_S,nV_S,nO_S, list_occ,list_vir,list_vir,list_occ, nO,nV,nV,nO, v_ovvo) - call gen_v_spin(nO_m,nV_m,nO_m,nV_m, nO_S,nV_S,nO_S,nV_S, list_occ,list_vir,list_occ,list_vir, nO,nV,nO,nV, v_ovov) - call gen_v_spin(nO_m,nO_m,nV_m,nV_m, nO_S,nO_S,nV_S,nV_S, list_occ,list_occ,list_vir,list_vir, nO,nO,nV,nV, v_oovv) + call gen_v_spin(nV_m,nV_m,nO_m,nO_m, nV_S,nV_S,nO_S,nO_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nVab,cc_nVab,cc_nOab,cc_nOab, v_vvoo) + !call gen_v_spin(nV_m,nO_m,nV_m,nO_m, nV_S,nO_S,nV_S,nO_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nVab,cc_nOab,cc_nVab,cc_nOab, v_vovo) + !call gen_v_spin(nV_m,nO_m,nO_m,nV_m, nV_S,nO_S,nO_S,nV_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nVab,cc_nOab,cc_nOab,cc_nVab, v_voov) + call gen_v_spin(nO_m,nV_m,nV_m,nO_m, nO_S,nV_S,nV_S,nO_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nOab,cc_nVab,cc_nVab,cc_nOab, v_ovvo) + call gen_v_spin(nO_m,nV_m,nO_m,nV_m, nO_S,nV_S,nO_S,nV_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nOab,cc_nVab,cc_nOab,cc_nVab, v_ovov) + call gen_v_spin(nO_m,nO_m,nV_m,nV_m, nO_S,nO_S,nV_S,nV_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nOab,cc_nOab,cc_nVab,cc_nVab, v_oovv) ! O VVV - !call gen_v_spin(nV_m,nV_m,nV_m,nO_m, nV_S,nV_S,nV_S,nO_S, list_vir,list_vir,list_vir,list_occ, nV,nV,nV,nO, v_vvvo) - !call gen_v_spin(nV_m,nV_m,nO_m,nV_m, nV_S,nV_S,nO_S,nV_S, list_vir,list_vir,list_occ,list_vir, nV,nV,nO,nV, v_vvov) - !call gen_v_spin(nV_m,nO_m,nV_m,nV_m, nV_S,nO_S,nV_S,nV_S, list_vir,list_occ,list_vir,list_vir, nV,nO,nV,nV, v_vovv) - !call gen_v_spin(nO_m,nV_m,nV_m,nV_m, nO_S,nV_S,nV_S,nV_S, list_occ,list_vir,list_vir,list_vir, nO,nV,nV,nV, v_ovvv) + !call gen_v_spin(nV_m,nV_m,nV_m,nO_m, nV_S,nV_S,nV_S,nO_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nVab,cc_nVab,cc_nVab,cc_nOab, v_vvvo) + !call gen_v_spin(nV_m,nV_m,nO_m,nV_m, nV_S,nV_S,nO_S,nV_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nVab,cc_nVab,cc_nOab,cc_nVab, v_vvov) + !call gen_v_spin(nV_m,nO_m,nV_m,nV_m, nV_S,nO_S,nV_S,nV_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nVab,cc_nOab,cc_nVab,cc_nVab, v_vovv) + !call gen_v_spin(nO_m,nV_m,nV_m,nV_m, nO_S,nV_S,nV_S,nV_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nOab,cc_nVab,cc_nVab,cc_nVab, v_ovvv) ! VVVV - !call gen_v_spin(nV_m,nV_m,nV_m,nV_m, nV_S,nV_S,nV_S,nV_S, list_vir,list_vir,list_vir,list_vir, nV,nV,nV,nV, v_vvvv) + !call gen_v_spin(nV_m,nV_m,nV_m,nV_m, nV_S,nV_S,nV_S,nV_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nVab,cc_nVab,cc_nVab,cc_nVab, v_vvvv) call wall_time(tf) if (cc_dev) then print*,'Load bi elec int:',tf-ti,'s' @@ -149,11 +124,11 @@ subroutine run_ccsd_spin_orb ! Init of T t1 = 0d0 - call guess_t1(nO,nV,f_o,f_v,f_ov,t1) - call guess_t2(nO,nV,f_o,f_v,v_oovv,t2) - call compute_tau_spin(nO,nV,t1,t2,tau) - call compute_tau_t_spin(nO,nV,t1,t2,tau_t) - + call guess_t1(cc_nOab,cc_nVab,f_o,f_v,cc_spin_f_ov,t1) + call guess_t2(cc_nOab,cc_nVab,f_o,f_v,v_oovv,t2) + call compute_tau_spin(cc_nOab,cc_nVab,t1,t2,tau) + call compute_tau_t_spin(cc_nOab,cc_nVab,t1,t2,tau_t) + ! Loop init nb_iter = 0 not_converged = .True. @@ -164,9 +139,9 @@ subroutine run_ccsd_spin_orb call det_energy(det,uncorr_energy) print*,'Det energy', uncorr_energy - call ccsd_energy_spin(nO,nV,t1,t2,F_ov,v_oovv,energy) + call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,v_oovv,energy) print*,'guess energy', uncorr_energy+energy, energy - + write(*,'(A77)') ' -----------------------------------------------------------------------------' write(*,'(A77)') ' | It. | E(CCSD) (Ha) | Correlation (Ha) | Conv. T1 | Conv. T2 |' write(*,'(A77)') ' -----------------------------------------------------------------------------' @@ -179,18 +154,18 @@ subroutine run_ccsd_spin_orb ! Intermediates call wall_time(tbi) call wall_time(ti) - call compute_cF_oo(nO,nV,t1,tau_t,F_oo,F_ov,v_ooov,v_oovv,cF_oo) - call compute_cF_ov(nO,nV,t1,F_ov,v_oovv,cF_ov) - call compute_cF_vv(nO,nV,t1,tau_t,F_ov,F_vv,v_oovv,cF_vv) + call compute_cF_oo(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_oo,cc_spin_F_ov,v_ooov,v_oovv,cF_oo) + call compute_cF_ov(cc_nOab,cc_nVab,t1,cc_spin_F_ov,v_oovv,cF_ov) + call compute_cF_vv(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_ov,cc_spin_F_vv,v_oovv,cF_vv) call wall_time(tf) if (cc_dev) then print*,'Compute cFs:',tf-ti,'s' endif - + call wall_time(ti) - call compute_cW_oooo(nO,nV,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) - call compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) - !call compute_cW_vvvv(nO,nV,t1,t2,tau,v_vvvv,v_vovv,v_oovv,cW_vvvv) + call compute_cW_oooo(cc_nOab,cc_nVab,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) + call compute_cW_ovvo(cc_nOab,cc_nVab,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) + !call compute_cW_vvvv(cc_nOab,cc_nVab,t1,t2,tau,v_vvvv,v_vovv,v_oovv,cW_vvvv) call wall_time(tf) if (cc_dev) then print*,'Compute cFs:',tf-ti,'s' @@ -198,13 +173,13 @@ subroutine run_ccsd_spin_orb ! Residuals call wall_time(ti) - call compute_r1_spin(nO,nV,t1,t2,f_o,f_v,F_ov,cF_oo,cF_ov,cF_vv,v_oovo,v_ovov,r1) + call compute_r1_spin(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_F_ov,cF_oo,cF_ov,cF_vv,v_oovo,v_ovov,r1) call wall_time(tf) if (cc_dev) then print*,'Compute r1:',tf-ti,'s' endif call wall_time(ti) - call compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ovvo,v_ovoo,v_oovv,v_ovvo,r2) + call compute_r2_spin(cc_nOab,cc_nVab,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ovvo,v_ovoo,v_oovv,v_ovvo,r2) call wall_time(tf) if (cc_dev) then print*,'Compute r2:',tf-ti,'s' @@ -218,29 +193,29 @@ subroutine run_ccsd_spin_orb call wall_time(ti) ! Update if (cc_update_method == 'diis') then - !call update_t_ccsd(nO,nV,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err1,all_err2,all_t1,all_t2) - !call update_t_ccsd_diis(nO,nV,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err1,all_err2,all_t1,all_t2) - call update_t_ccsd_diis_v3(nO,nV,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err,all_t) + !call update_t_ccsd(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err1,all_err2,all_t1,all_t2) + !call update_t_ccsd_diis(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err1,all_err2,all_t1,all_t2) + call update_t_ccsd_diis_v3(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err,all_t) ! Standard update as T = T - Delta elseif (cc_update_method == 'none') then - call update_t1(nO,nV,f_o,f_v,r1,t1) - call update_t2(nO,nV,f_o,f_v,r2,t2) + call update_t1(cc_nOab,cc_nVab,f_o,f_v,r1,t1) + call update_t2(cc_nOab,cc_nVab,f_o,f_v,r2,t2) else print*,'Unkonw cc_method_method: '//cc_update_method endif - call compute_tau_spin(nO,nV,t1,t2,tau) - call compute_tau_t_spin(nO,nV,t1,t2,tau_t) + call compute_tau_spin(cc_nOab,cc_nVab,t1,t2,tau) + call compute_tau_t_spin(cc_nOab,cc_nVab,t1,t2,tau_t) call wall_time(tf) if (cc_dev) then print*,'Update:',tf-ti,'s' endif ! Print - call ccsd_energy_spin(nO,nV,t1,t2,F_ov,v_oovv,energy) + call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,v_oovv,energy) call wall_time(tfi) - + write(*,'(A3,I6,A3,F18.12,A3,F16.12,A3,ES10.2,A3,ES10.2,A2)') ' | ',nb_iter,' | ', & uncorr_energy+energy,' | ', energy,' | ', max_r1,' | ', max_r2,' |' if (cc_dev) then @@ -270,8 +245,8 @@ subroutine run_ccsd_spin_orb print*,'' if (write_amplitudes) then - call write_t1(nO,nV,t1) - call write_t2(nO,nV,t2) + call write_t1(cc_nOab,cc_nVab,t1) + call write_t2(cc_nOab,cc_nVab,t2) call ezfio_set_utils_cc_io_amplitudes('Read') endif @@ -286,20 +261,20 @@ subroutine run_ccsd_spin_orb deallocate(v_oooo) deallocate(v_ovoo,v_oovo) deallocate(v_ovvo,v_ovov,v_oovv) - + double precision :: t_corr t_corr = 0.d0 if (cc_par_t .and. elec_alpha_num +elec_beta_num > 2) then print*,'CCSD(T) calculation...' call wall_time(ta) - !allocate(v_vvvo(nV,nV,nV,nO)) + !allocate(v_vvvo(cc_nVab,cc_nVab,cc_nVab,cc_nOab)) !call gen_v_spin(cc_nV_m,cc_nV_m,cc_nV_m,cc_nO_m, & ! cc_nV_S,cc_nV_S,cc_nV_S,cc_nO_S, & ! cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, & - ! nV,nV,nV,nO, v_vvvo) + ! cc_nVab,cc_nVab,cc_nVab,cc_nOab, v_vvvo) - !call ccsd_par_t_spin(nO,nV,t1,t2,f_o,f_v,f_ov,v_ooov,v_vvoo,v_vvvo,t_corr) - call ccsd_par_t_spin_v2(nO,nV,t1,t2,f_o,f_v,f_ov,v_ooov,v_vvoo,t_corr) + !call ccsd_par_t_spin(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_f_ov,v_ooov,v_vvoo,v_vvvo,t_corr) + call ccsd_par_t_spin_v2(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_f_ov,v_ooov,v_vvoo,t_corr) !print*,'Working on it...' !call abort call wall_time(tb) @@ -313,12 +288,12 @@ subroutine run_ccsd_spin_orb endif call save_energy(uncorr_energy + energy, t_corr) - - deallocate(f_oo,f_ov,f_vv,f_o,f_v) + + deallocate(f_o,f_v) deallocate(v_ooov,v_vvoo,t1,t2) !deallocate(v_ovvv,v_vvvo,v_vovv) !deallocate(v_vvvv) - + end ! Energy @@ -354,7 +329,7 @@ subroutine ccsd_energy_spin(nO,nV,t1,t2,Fov,v_oovv,energy) do j=1,nO do a=1,nV do b=1,nV - energy = energy & + energy = energy & + 0.5d0 * v_oovv(i,j,a,b) * t1(i,a) * t1(j,b) & + 0.25d0 * v_oovv(i,j,a,b) * t2(i,j,a,b) end do @@ -375,7 +350,7 @@ subroutine compute_tau_spin(nO,nV,t1,t2,tau) double precision,intent(in) :: t2(nO,nO,nV,nV) double precision,intent(out) :: tau(nO,nO,nV,nV) - + integer :: i,j,k,l integer :: a,b,c,d @@ -463,7 +438,7 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov !$OMP v_ovov,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,f,m,n) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(1) do a=1,nV do i=1,nO @@ -494,7 +469,7 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov 1d0, t1 , size(t1,1), & cF_vv, size(cF_vv,1), & 1d0, r1 , size(r1,1)) - + !do a=1,nV ! do i=1,nO ! do m=1,nO @@ -531,7 +506,7 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov !$OMP SHARED(r1,t1,t2,X_vovf,v_ovvf,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,f,m,n) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) !do f = 1, nV @@ -546,28 +521,28 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov !enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('N','T', nO, nV, nO*nV, & -0.5d0, t2(1,1,1,f), size(t2,1), & X_vovf, size(X_vovf,1), & 1d0 , r1 , size(r1,1)) enddo - + !call dgemm('N','T', nO, nV, nO*nV*nV, & ! -0.5d0, t2 , size(t2,1), & ! X_vovv, size(X_vovv,1), & ! 1d0 , r1 , size(r1,1)) - + deallocate(X_vovf) !deallocate(X_vovv) allocate(X_oovv(nO,nO,nV,nV)) - + !$OMP PARALLEL & !$OMP SHARED(r1,t1,t2,X_oovv, & !$OMP f_o,f_v,v_oovo,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,f,m,n) & !$OMP DEFAULT(NONE) - + !do a=1,nV ! do i=1,nO ! do e=1,nV @@ -579,7 +554,7 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov ! end do ! end do !end do - + !$OMP DO collapse(3) do a = 1, nV do e = 1, nV @@ -592,12 +567,12 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('T','N', nO, nV, nO*nO*nV, & -0.5d0, v_oovo, size(v_oovo,1) * size(v_oovo,2) * size(v_oovo,3), & X_oovv, size(X_oovv,1) * size(X_oovv,2) * size(X_oovv,3), & 1d0 , r1 , size(r1,1)) - + !$OMP PARALLEL & !$OMP SHARED(r1,t1,X_oovv,f_o,f_v,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,f,m,n) & @@ -610,7 +585,7 @@ subroutine compute_r1_spin(nO,nV,t1,t2,f_o,f_v,Fov,cF_oo,cF_ov,cF_vv,v_oovo,v_ov enddo !$OMP END DO !$OMP END PARALLEL - + deallocate(X_oovv) end @@ -684,7 +659,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ !$OMP SHARED(r2,v_oovv,X_oovv,nO,nV) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -697,7 +672,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ end do !$OMP END DO !$OMP END PARALLEL - + !deallocate(X_oovv) !do b=1,nV @@ -726,25 +701,25 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ 0.5d0, t2 , size(t2,1) * size(t2,2) * size(t2,3), & A_vv , size(A_vv,1), & 0d0 , X_oovv, size(X_oovv,1) * size(X_oovv,2) * size(X_oovv,3)) - + !$OMP PARALLEL & !$OMP SHARED(r2,v_oovv,X_oovv,nO,nV) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV do j=1,nO do i=1,nO - r2(i,j,a,b) = r2(i,j,a,b) - X_oovv(i,j,a,b) + X_oovv(i,j,b,a) + r2(i,j,a,b) = r2(i,j,a,b) - X_oovv(i,j,a,b) + X_oovv(i,j,b,a) end do end do end do end do !$OMP END DO !$OMP END PARALLEL - + deallocate(A_vv)!,X_oovv) !do b=1,nV @@ -766,7 +741,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ !$OMP SHARED(t2,v_oovv,X_oovv,nO,nV) & !$OMP PRIVATE(i,m,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -789,13 +764,13 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ !$OMP SHARED(r2,v_oovv,Y_oovv,nO,nV) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV do j=1,nO do i=1,nO - r2(i,j,a,b) = r2(i,j,a,b) - Y_oovv(j,i,a,b) + Y_oovv(i,j,a,b) + r2(i,j,a,b) = r2(i,j,a,b) - Y_oovv(j,i,a,b) + Y_oovv(i,j,a,b) end do end do end do @@ -821,17 +796,17 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ ! end do !end do allocate(A_oo(nO,nO),B_oovv(nO,nO,nV,nV))!,X_oovv(nO,nO,nV,nV)) - + call dgemm('N','T', nO, nO, nV, & 1d0, t1 , size(t1,1), & cF_ov, size(cF_ov,1), & 0d0, A_oo , size(A_oo,1)) - + !$OMP PARALLEL & !$OMP SHARED(t2,B_oovv,nO,nV) & !$OMP PRIVATE(i,m,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b = 1, nV do a = 1, nV @@ -844,17 +819,17 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('N','N', nO, nO*nV*nV, nO, & 0.5d0, A_oo, size(A_oo,1), & B_oovv, size(B_oovv,1), & 0d0 , X_oovv, size(X_oovv,1)) - + !$OMP PARALLEL & !$OMP SHARED(r2,X_oovv,nO,nV) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -888,7 +863,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ 0.5d0, cW_oooo, size(cW_oooo,1) * size(cW_oooo,2), & tau , size(tau,1) * size(tau,2), & 1d0 , r2 , size(r2,1) * size(r2,2)) - + !do b=1,nV ! do a=1,nV ! do j=1,nO @@ -908,6 +883,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ ! 0.5d0, tau , size(tau,1) * size(tau,2), & ! cW_vvvv, size(cW_vvvv,1) * size(cW_vvvv,2), & ! 1d0 , r2 , size(r2,1) * size(r2,2)) + double precision :: ti,tf call wall_time(ti) call use_cW_vvvf(nO,nV,t1,t2,tau,v_oovv,r2) @@ -915,7 +891,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ if (cc_dev) then print*,'cW_vvvv:',tf-ti,'s' endif - + !do b=1,nV ! do a=1,nV ! do j=1,nO @@ -923,7 +899,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ ! do e=1,nV ! do m=1,nO - ! r2(i,j,a,b) = r2(i,j,a,b) & + ! r2(i,j,a,b) = r2(i,j,a,b) & ! + t2(i,m,a,e)*cW_ovvo(m,b,e,j) & ! - t2(j,m,a,e)*cW_ovvo(m,b,e,i) & ! - t2(i,m,b,e)*cW_ovvo(m,a,e,j) & @@ -944,7 +920,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ !$OMP SHARED(t2,A_ovov,B_ovvo,cW_ovvo,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do a = 1, nV do i = 1, nO @@ -961,24 +937,24 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ do b = 1, nV do e = 1, nV do m = 1, nO - B_ovvo(m,e,b,j) = cW_ovvo(m,b,e,j) + B_ovvo(m,e,b,j) = cW_ovvo(m,b,e,j) enddo enddo enddo enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('T','N', nO*nV, nV*nO, nO*nV, & 1d0, A_ovov, size(A_ovov,1) * size(A_ovov,2), & B_ovvo, size(B_ovvo,1) * size(B_ovvo,2), & 0d0, X_ovvo, size(X_ovvo,1) * size(X_ovvo,2)) - + !$OMP PARALLEL & !$OMP SHARED(r2,X_ovvo,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b = 1, nV do a = 1, nV @@ -992,15 +968,15 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ enddo !$OMP END DO !$OMP END PARALLEL - + deallocate(A_ovov,B_ovvo,X_ovvo) allocate(A_vvoo(nV,nV,nO,nO), B_ovoo(nO,nV,nO,nO), C_ovov(nO,nV,nO,nV)) - + !$OMP PARALLEL & !$OMP SHARED(A_vvoo,v_ovvo,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do m = 1, nO do j = 1, nO @@ -1013,22 +989,22 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('N','N', nO, nV*nO*nO, nV, & 1d0, t1 , size(t1,1), & A_vvoo, size(A_vvoo,1), & 0d0, B_ovoo, size(B_ovoo,1)) - + call dgemm('N','N', nO*nV*nO, nV, nO, & 1d0, B_ovoo, size(B_ovoo,1) * size(B_ovoo,2) * size(B_ovoo,3), & t1 , size(t1,1), & 0d0, C_ovov, size(C_ovov,1) * size(C_ovov,2) * size(C_ovov,3)) - + !$OMP PARALLEL & !$OMP SHARED(r2,C_ovov,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -1042,9 +1018,9 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ end do !$OMP END DO !$OMP END PARALLEL - + deallocate(A_vvoo, B_ovoo, C_ovov) - + !do b=1,nV ! do a=1,nV ! do j=1,nO @@ -1065,12 +1041,12 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ call gen_v_spin_3idx_i_kl(cc_nV_m,cc_nV_m,cc_nV_m,cc_nO_m, b, cc_nV_S,cc_nV_S,cc_nV_S,cc_nO_S, & cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, & nV,nV,nO, v_vbvo) - + !$OMP PARALLEL & !$OMP SHARED(b,A_vbov,v_vbvo,nO,nV) & !$OMP PRIVATE(i,j,a,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(2) do e = 1, nV do j = 1, nO @@ -1093,12 +1069,12 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ ! 1d0, A_vvov, size(A_vvov,1) * size(A_vvov,2) * size(A_vvov,3), & ! t1 , size(t1,1), & ! 0d0, X_vvoo, size(X_vvoo,1) * size(X_vvoo,2) * size(X_vvoo,3)) - + !$OMP PARALLEL & !$OMP SHARED(b,r2,X_vboo,nO,nV) & !$OMP PRIVATE(i,j,a,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(2) !do b = 1, nV do a = 1, nV @@ -1113,7 +1089,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ !$OMP END DO !$OMP END PARALLEL enddo - + !deallocate(A_vvov)!,X_vvoo) deallocate(A_vbov, X_vboo, v_vbvo) allocate(X_vvoo(nV,nV,nO,nO)) @@ -1132,7 +1108,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ ! end do !end do !allocate(X_vvoo(nV,nV,nO,nO)) - + call dgemm('T','N', nV, nV*nO*nO, nO, & 1d0, t1 , size(t1,1), & v_ovoo, size(v_ovoo,1), & @@ -1142,7 +1118,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ !$OMP SHARED(r2,X_vvoo,f_o,f_v,t2,nO,nV) & !$OMP PRIVATE(i,j,a,b,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -1154,7 +1130,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ end do end do !$OMP END DO - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -1167,7 +1143,7 @@ subroutine compute_r2_spin(nO,nV,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ end do !$OMP END DO !$OMP END PARALLEL - + deallocate(X_vvoo) end @@ -1182,16 +1158,16 @@ subroutine use_cF_oo(nO,nV,t1,t2,tau_t,F_oo,F_ov,v_ooov,v_oovv,r1,r2) double precision, intent(in) :: t1(nO,nV), t2(nO,nO,nV,nV), tau_t(nO,nO,nV,nV) double precision, intent(in) :: F_oo(nO,nV), F_ov(nO,nV) double precision, intent(in) :: v_ooov(nO,nO,nO,nV), v_oovv(nO,nO,nV,nV) - + double precision, intent(inout) :: r1(nO,nV), r2(nO,nO,nV,nV) - + double precision, allocatable :: cF_oo(:,:), X_oovv(:,:,:,:),Y_oovv(:,:,:,:) integer :: i,j,m,a,b allocate(cF_oo(nO,nO)) - + call compute_cF_oo(nO,nV,t1,tau_t,F_oo,F_ov,v_ooov,v_oovv,cF_oo) - + !do a=1,nV ! do i=1,nO ! do m=1,nO @@ -1218,13 +1194,13 @@ subroutine use_cF_oo(nO,nV,t1,t2,tau_t,F_oo,F_ov,v_ooov,v_oovv,r1,r2) ! end do ! end do !end do - + allocate(Y_oovv(nO,nO,nV,nV),X_oovv(nO,nO,nV,nV)) !$OMP PARALLEL & !$OMP SHARED(t2,v_oovv,X_oovv,nO,nV) & !$OMP PRIVATE(i,m,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -1247,20 +1223,20 @@ subroutine use_cF_oo(nO,nV,t1,t2,tau_t,F_oo,F_ov,v_ooov,v_oovv,r1,r2) !$OMP SHARED(r2,v_oovv,Y_oovv,nO,nV) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV do j=1,nO do i=1,nO - r2(i,j,a,b) = r2(i,j,a,b) - Y_oovv(j,i,a,b) + Y_oovv(i,j,a,b) + r2(i,j,a,b) = r2(i,j,a,b) - Y_oovv(j,i,a,b) + Y_oovv(i,j,a,b) end do end do end do end do !$OMP END DO !$OMP END PARALLEL - + deallocate(cF_oo,X_oovv,Y_oovv) end @@ -1274,7 +1250,7 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) integer, intent(in) :: nO,nV double precision, intent(in) :: t1(nO,nV), t2(nO,nO,nV,nV) double precision, intent(in) :: F_ov(nO,nV), v_oovv(nO,nO,nV,nV) - + double precision, intent(inout) :: r1(nO,nV), r2(nO,nO,nV,nV) double precision, allocatable :: cF_ov(:,:), A_oo(:,:), A_vv(:,:) @@ -1282,14 +1258,14 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) integer :: i,j,a,b,e,m allocate(cF_ov(nO,nV)) - + call compute_cF_ov(nO,nV,t1,F_ov,v_oovv,cF_ov) !$OMP PARALLEL & !$OMP SHARED(r1,t2,cF_ov,nO,nV) & !$OMP PRIVATE(i,a,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(1) do a=1,nV do i=1,nO @@ -1334,22 +1310,22 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) !$OMP SHARED(nO,nV,r2,X_oovv) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV do j=1,nO do i=1,nO - r2(i,j,a,b) = r2(i,j,a,b) - X_oovv(i,j,a,b) + X_oovv(i,j,b,a) + r2(i,j,a,b) = r2(i,j,a,b) - X_oovv(i,j,a,b) + X_oovv(i,j,b,a) end do end do end do end do !$OMP END DO !$OMP END PARALLEL - + deallocate(A_vv) - + !do b=1,nV ! do a=1,nV ! do j=1,nO @@ -1367,17 +1343,17 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) ! end do !end do allocate(A_oo(nO,nO),B_oovv(nO,nO,nV,nV))!,X_oovv(nO,nO,nV,nV)) - + call dgemm('N','T', nO, nO, nV, & 1d0, t1 , size(t1,1), & cF_ov, size(cF_ov,1), & 0d0, A_oo , size(A_oo,1)) - + !$OMP PARALLEL & !$OMP SHARED(t2,B_oovv,nO,nV) & !$OMP PRIVATE(i,m,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b = 1, nV do a = 1, nV @@ -1390,7 +1366,7 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('N','N', nO, nO*nV*nV, nO, & 0.5d0, A_oo, size(A_oo,1), & B_oovv, size(B_oovv,1), & @@ -1400,7 +1376,7 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) !$OMP SHARED(r2,X_oovv,nO,nV) & !$OMP PRIVATE(i,j,a,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b=1,nV do a=1,nV @@ -1413,9 +1389,9 @@ subroutine use_cF_ov(nO,nV,t1,t2,F_ov,v_oovv,r1,r2) end do !$OMP END DO !$OMP END PARALLEL - + deallocate(cF_ov,A_oo,B_oovv,X_oovv) - + end ! Use cF_vv @@ -1426,18 +1402,18 @@ subroutine use_cF_vv(nO,nV,t1,t2,r1,r2) integer, intent(in) :: nO,nV double precision, intent(in) :: t1(nO,nV), t2(nO,nO,nV,nV) - + double precision, intent(inout) :: r1(nO,nV), r2(nO,nO,nV,nV) double precision, allocatable :: cF_vv(:,:) integer :: i,j,a,b,e,m allocate(cF_vv(nV,nV)) - + !call compute_cF_vv(nO,nV,t1,tau_t,F_ov,F_vv,v_oovv,v_ovvv,cF_vv) deallocate(cF_vv) - + end ! Use cW_vvvd @@ -1450,7 +1426,7 @@ subroutine use_cW_vvvf(nO,nV,t1,t2,tau,v_oovv,r2) double precision, intent(in) :: t1(nO,nV), t2(nO,nO,nV,nV), tau(nO,nO,nV,nV) double precision, intent(in) :: v_oovv(nO,nO,nV,nV) !double precision, intent(in) :: v_vovv(nV,nO,nV,nV) - + double precision, intent(inout) :: r2(nO,nO,nV,nV) double precision, allocatable :: cW_vvvf(:,:,:), v_vvvf(:,:,:), tau_f(:,:,:), v_vovf(:,:,:) @@ -1460,7 +1436,7 @@ subroutine use_cW_vvvf(nO,nV,t1,t2,tau,v_oovv,r2) allocate(cW_vvvf(nV,nV,nV),v_vvvf(nV,nV,nV),tau_f(nO,nO,nV),v_vovf(nV,nO,nV)) !PROVIDE cc_nVab - + !do b=1,nV ! do a=1,nV ! do j=1,nO @@ -1476,14 +1452,14 @@ subroutine use_cW_vvvf(nO,nV,t1,t2,tau,v_oovv,r2) ! end do ! end do !end do - + do f = 1, nV call wall_time(ti) !$OMP PARALLEL & !$OMP SHARED(tau,tau_f,f,nO,nV) & !$OMP PRIVATE(i,j,e) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(2) do e = 1, nV do j = 1, nO @@ -1515,7 +1491,7 @@ subroutine use_cW_vvvf(nO,nV,t1,t2,tau,v_oovv,r2) if (cc_dev .and. f == 1) then print*,'vovf', tf-ti endif - + call wall_time(ti) call compute_cW_vvvf(nO,nV,t1,t2,tau,f,v_vvvf,v_vovf,v_oovv,cW_vvvf) call wall_time(tf) @@ -1535,7 +1511,7 @@ subroutine use_cW_vvvf(nO,nV,t1,t2,tau,v_oovv,r2) enddo deallocate(cW_vvvf,v_vvvf,v_vovf) - + end ! cF_oo @@ -1562,7 +1538,7 @@ subroutine compute_cF_oo(nO,nV,t1,tau_t,Foo,Fov,v_ooov,v_oovv,cF_oo) !$OMP SHARED(cF_oo,Foo,t1,v_ooov,nO,nV) & !$OMP PRIVATE(i,m,n,e) & !$OMP DEFAULT(NONE) - + !do i=1,nO ! do m=1,nO ! cF_oo(m,i) = (1d0 - Kronecker_delta(m,i))*Foo(m,i) @@ -1580,7 +1556,7 @@ subroutine compute_cF_oo(nO,nV,t1,tau_t,Foo,Fov,v_ooov,v_oovv,cF_oo) cF_oo(i,i) = 0d0 end do !$OMP END DO - + do e=1,nV do n=1,nO !$OMP DO collapse(1) @@ -1620,8 +1596,8 @@ subroutine compute_cF_oo(nO,nV,t1,tau_t,Foo,Fov,v_ooov,v_oovv,cF_oo) call dgemm('N','T', nO, nO, nO*nV*nV, & 0.5d0, v_oovv, size(v_oovv,1), & tau_t , size(tau_t,1), & - 1d0 , cF_oo , size(cF_oo,1)) - + 1d0 , cF_oo , size(cF_oo,1)) + end ! cF_ov @@ -1643,7 +1619,7 @@ subroutine compute_cF_ov(nO,nV,t1,Fov,v_oovv,cF_ov) !$OMP SHARED(cF_ov,Fov,t1,v_oovv,nO,nV) & !$OMP PRIVATE(i,a,m,n,e,f) & !$OMP DEFAULT(NONE) - + !cF_ov = Fov !$OMP DO collapse(1) @@ -1659,7 +1635,7 @@ subroutine compute_cF_ov(nO,nV,t1,Fov,v_oovv,cF_ov) end do !$OMP END DO !$OMP END PARALLEL - + end ! cF_vv @@ -1677,7 +1653,7 @@ subroutine compute_cF_vv(nO,nV,t1,tau_t,Fov,Fvv,v_oovv,cF_vv) !double precision,intent(in) :: v_ovvv(nO,nV,nV,nV) double precision,intent(out) :: cF_vv(nV,nV) - + double precision, allocatable :: v_ovfv(:,:,:),X_ovfv(:,:,:) integer :: i,j,m,n integer :: a,b,e,f @@ -1699,7 +1675,7 @@ subroutine compute_cF_vv(nO,nV,t1,tau_t,Fov,Fvv,v_oovv,cF_vv) enddo !$OMP END DO !$OMP END PARALLEL - + !do e=1,nV ! do a=1,nV ! do m=1,nO @@ -1711,7 +1687,7 @@ subroutine compute_cF_vv(nO,nV,t1,tau_t,Fov,Fvv,v_oovv,cF_vv) -0.5d0, t1 , size(t1,1), & Fov , size(Fov,1), & 1d0 , cF_vv, size(cF_vv,1)) - + !do e=1,nV ! do a=1,nV ! do m=1,nO @@ -1791,7 +1767,7 @@ subroutine compute_cW_oooo(nO,nV,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) integer :: a,b,e,f double precision, allocatable :: X_oooo(:,:,:,:) - ! oooo block + ! oooo block !cW_oooo = v_oooo @@ -1809,7 +1785,7 @@ subroutine compute_cW_oooo(nO,nV,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) ! end do !end do allocate(X_oooo(nO,nO,nO,nO)) - + call dgemm('N','T', nO*nO*nO, nO, nV, & 1d0, v_ooov, size(v_ooov,1) * size(v_ooov,2) * size(v_ooov,3), & t1 , size(t1,1), & @@ -1830,14 +1806,14 @@ subroutine compute_cW_oooo(nO,nV,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) end do !$OMP END DO !$OMP END PARALLEL - + deallocate(X_oooo) - + !do m=1,nO ! do n=1,nO ! do i=1,nO ! do j=1,nO - ! + ! ! do e=1,nV ! do f=1,nV ! cW_oooo(m,n,i,j) = cW_oooo(m,n,i,j) + 0.25d0*tau(i,j,e,f)*v_oovv(m,n,e,f) @@ -1853,7 +1829,7 @@ subroutine compute_cW_oooo(nO,nV,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) 0.25d0, v_oovv , size(v_oovv,1) * size(v_oovv,2), & tau , size(tau,1) * size(tau,2), & 1.d0 , cW_oooo, size(cW_oooo,1) * size(cW_oooo,2)) - + end ! cW_ovvo @@ -1913,7 +1889,7 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) call gen_v_spin_3idx_ij_l(cc_nO_m,cc_nV_m,cc_nV_m,cc_nV_m, e, cc_nO_S,cc_nV_S,cc_nV_S,cc_nV_S, & cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin, & nO,nV,nV, v_ovev) - + call dgemm('N','T', nO*nV, nO, nV, & 1.d0, v_ovev , size(v_ovev,1) * size(v_ovev,2), & t1 , size(t1,1), & @@ -1950,14 +1926,14 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) ! end do ! end do !end do - + allocate(A_oovo(nO,nO,nV,nO), B_vovo(nV,nO,nV,nO)) - + !$OMP PARALLEL & !$OMP SHARED(A_oovo,v_oovo,nO,nV) & !$OMP PRIVATE(j,e,m,n) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do j=1,nO do e=1,nV @@ -1970,17 +1946,17 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) end do !$OMP END DO !$OMP END PARALLEL - + call dgemm('T','N', nV, nO*nV*nO, nO, & 1d0, t1 , size(t1,1), & A_oovo, size(A_oovo,1), & 0d0, B_vovo, size(B_vovo,1)) - + !$OMP PARALLEL & !$OMP SHARED(cW_ovvo,B_vovo,nO,nV) & !$OMP PRIVATE(j,e,m,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do j=1,nO do e=1,nV @@ -2015,7 +1991,7 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) !$OMP SHARED(nO,nV,A_voov,B_voov,v_oovv,t2,t1) & !$OMP PRIVATE(f,n,m,e,j,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do b = 1, nV do j = 1, nO @@ -2039,19 +2015,19 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) enddo !$OMP END DO !$OMP END PARALLEL - + call dgemm('T','N', nO*nV, nV*nO, nV*nO, & 1d0, A_voov, size(A_voov,1) * size(A_voov,2), & B_voov, size(B_voov,1) * size(B_voov,2), & 0d0, C_ovov, size(C_ovov,1) * size(C_ovov,2)) - + deallocate(A_voov,B_voov) !$OMP PARALLEL & !$OMP SHARED(cW_ovvo,C_ovov,nO,nV) & !$OMP PRIVATE(j,e,m,b) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(3) do j = 1, nO do e = 1, nV @@ -2064,7 +2040,7 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) enddo !$OMP END DO !$OMP END PARALLEL - + deallocate(C_ovov) end @@ -2072,7 +2048,7 @@ subroutine compute_cW_ovvo(nO,nV,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) ! cW_vvvv subroutine compute_cW_vvvv(nO,nV,t1,t2,tau,v_vvvv,v_vovv,v_oovv,cW_vvvv) - + implicit none integer,intent(in) :: nO,nV @@ -2154,14 +2130,14 @@ subroutine compute_cW_vvvv(nO,nV,t1,t2,tau,v_vvvv,v_vovv,v_oovv,cW_vvvv) end do !$OMP END DO !$OMP END PARALLEL - + deallocate(A_ovvv,B_vvvv) !do a=1,nV ! do b=1,nV ! do e=1,nV ! do f=1,nV - ! + ! ! do m=1,nO ! do n=1,nO ! cW_vvvv(a,b,e,f) = cW_vvvv(a,b,e,f) + 0.25d0*tau(m,n,a,b)*v_oovv(m,n,e,f) @@ -2182,7 +2158,7 @@ subroutine compute_cW_vvvv(nO,nV,t1,t2,tau,v_vvvv,v_vovv,v_oovv,cW_vvvv) ! cW_vvvf subroutine compute_cW_vvvf(nO,nV,t1,t2,tau,f,v_vvvf,v_vovf,v_oovv,cW_vvvf) - + implicit none integer,intent(in) :: nO,nV,f @@ -2207,7 +2183,7 @@ subroutine compute_cW_vvvf(nO,nV,t1,t2,tau,f,v_vvvf,v_vovf,v_oovv,cW_vvvf) !$OMP SHARED(nO,nV,cW_vvvf,A_ovvf,v_vovf,v_vvvf,f) & !$OMP PRIVATE(a,b,c,d,e,m) & !$OMP DEFAULT(NONE) - + !$OMP DO collapse(2) do c = 1, nV do b = 1, nV @@ -2248,7 +2224,7 @@ subroutine compute_cW_vvvf(nO,nV,t1,t2,tau,f,v_vvvf,v_vovf,v_oovv,cW_vvvf) 1d0, t1 , size(t1,1), & A_ovvf, size(A_ovvf,1), & 0d0, B_vvvf, size(B_vvvf,1)) - + !$OMP PARALLEL & !$OMP SHARED(nO,nV,cW_vvvf,B_vvvf,v_oovf,v_oovv,f) & !$OMP PRIVATE(a,b,c,d,e,m,n) & @@ -2264,14 +2240,14 @@ subroutine compute_cW_vvvf(nO,nV,t1,t2,tau,f,v_vvvf,v_vovf,v_oovv,cW_vvvf) end do end do !$OMP END DO NOWAIT - + !deallocate(A_ovvf,B_vvvf) !do a=1,nV ! do b=1,nV ! do e=1,nV ! do f=1,nV - ! + ! ! do m=1,nO ! do n=1,nO ! cW_vvvv(a,b,e,f) = cW_vvvv(a,b,e,f) + 0.25d0*tau(m,n,a,b)*v_oovv(m,n,e,f) @@ -2292,13 +2268,13 @@ subroutine compute_cW_vvvf(nO,nV,t1,t2,tau,f,v_vvvf,v_vovf,v_oovv,cW_vvvf) enddo enddo !$OMP END DO - !$OMP END PARALLEL - + !$OMP END PARALLEL + call dgemm('T','N', nV*nV, nV, nO*nO, & 0.25d0, tau , size(tau,1) * size(tau,2), & v_oovf , size(v_oovf,1) * size(v_oovf,2), & 1.d0 , cW_vvvf, size(cW_vvvf,1) * size(cW_vvvf,2)) - + deallocate(v_oovf) deallocate(A_ovvf,B_vvvf) diff --git a/src/utils_cc/mo_integrals_cc.irp.f b/src/utils_cc/mo_integrals_cc.irp.f index 6f21c316..eebc84ca 100644 --- a/src/utils_cc/mo_integrals_cc.irp.f +++ b/src/utils_cc/mo_integrals_cc.irp.f @@ -1006,6 +1006,22 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER + +BEGIN_PROVIDER [ double precision, cc_spin_f_oo, (cc_nOab, cc_nOab)] + implicit none + call gen_f_spin(psi_det(1,1,cc_ref), cc_nO_m, cc_nO_m, cc_nO_S, cc_nO_S, cc_list_occ_spin, cc_list_occ_spin, cc_nOab, cc_nOab, cc_spin_f_oo) +END_PROVIDER + +BEGIN_PROVIDER [ double precision, cc_spin_f_ov, (cc_nOab, cc_nVab)] + implicit none + call gen_f_spin(psi_det(1,1,cc_ref), cc_nO_m, cc_nV_m, cc_nO_S, cc_nV_S, cc_list_occ_spin, cc_list_vir_spin, cc_nOab, cc_nVab, cc_spin_f_ov) +END_PROVIDER + +BEGIN_PROVIDER [ double precision, cc_spin_f_vv, (cc_nVab, cc_nVab)] + implicit none + call gen_f_spin(psi_det(1,1,cc_ref), cc_nV_m, cc_nV_m, cc_nV_S, cc_nV_S, cc_list_vir_spin, cc_list_vir_spin, cc_nVab, cc_nVab, cc_spin_f_vv) +END_PROVIDER + ! Shift subroutine shift_idx_spin(s,n_S,shift) From e3e874879f47013b48963d729f8f312bf6ddf33b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Feb 2025 18:11:47 +0100 Subject: [PATCH 068/175] Introduced Cholesky in gen_spin_space --- src/utils_cc/mo_integrals_cc.irp.f | 1234 +++++++++++++++++++++------- 1 file changed, 947 insertions(+), 287 deletions(-) diff --git a/src/utils_cc/mo_integrals_cc.irp.f b/src/utils_cc/mo_integrals_cc.irp.f index eebc84ca..813c186a 100644 --- a/src/utils_cc/mo_integrals_cc.irp.f +++ b/src/utils_cc/mo_integrals_cc.irp.f @@ -47,7 +47,7 @@ subroutine gen_v_space(n1,n2,n3,n4,list1,list2,list3,list4,v) integer :: i1,i2,i3,i4,idx1,idx2,idx3,idx4,k - if (do_ao_cholesky) then + if (do_mo_cholesky) then double precision, allocatable :: buffer(:,:,:,:) double precision, allocatable :: v1(:,:,:), v2(:,:,:) allocate(v1(cholesky_mo_num,n1,n3), v2(cholesky_mo_num,n2,n4)) @@ -132,7 +132,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) BEGIN_PROVIDER [double precision, cc_space_v, (mo_num,mo_num,mo_num,mo_num)] implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1,i2,i3,i4 double precision, allocatable :: buffer(:,:,:) call set_multiple_levels_omp(.False.) @@ -190,7 +190,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -233,7 +233,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -277,7 +277,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -311,7 +311,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -345,7 +345,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -379,7 +379,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -422,7 +422,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -465,7 +465,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -499,7 +499,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -533,7 +533,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -567,7 +567,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) implicit none - if (do_ao_cholesky) then + if (do_mo_cholesky) then integer :: i1, i2, i3, i4 integer :: n1, n2, n3, n4 @@ -1169,7 +1169,7 @@ subroutine gen_v_spin(n1,n2,n3,n4, n1_S,n2_S,n3_S,n4_S, list1,list2,list3,list4, implicit none BEGIN_DOC - ! Compute the bi electronic integrals corresponding to four lists of spin orbitals. + ! Compute the 2e-integrals corresponding to four lists of spin orbitals. ! Ex: occ/occ/occ/occ, occ/vir/occ/vir, ... END_DOC @@ -1178,129 +1178,306 @@ subroutine gen_v_spin(n1,n2,n3,n4, n1_S,n2_S,n3_S,n4_S, list1,list2,list3,list4, integer, intent(in) :: dim1, dim2, dim3, dim4 double precision, intent(out) :: v(dim1,dim2,dim3,dim4) - double precision :: mo_two_e_integral + double precision, external :: mo_two_e_integral integer :: i,j,k,l,idx_i,idx_j,idx_k,idx_l integer :: i_shift,j_shift,k_shift,l_shift integer :: tmp_i,tmp_j,tmp_k,tmp_l integer :: si,sj,sk,sl,s - PROVIDE cc_space_v + double precision, allocatable :: buffer(:,:,:,:) + double precision, allocatable :: v1(:,:,:), v2(:,:,:) + + if (do_mo_cholesky) then + + do sl = 1, 2 + call shift_idx_spin(sl,n4_S,l_shift) + do sk = 1, 2 + call shift_idx_spin(sk,n3_S,k_shift) + do sj = 1, 2 + call shift_idx_spin(sj,n2_S,j_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + + allocate(v1(cholesky_mo_num,n1_S(si),n3_S(sk)), v2(cholesky_mo_num,n2_S(sj),n4_S(sl))) + allocate(buffer(n1_S(si),n3_S(sk),n2_S(sj),n4_S(sl))) + + call gen_v_space_chol(n1_S(si),n3_S(sk),list1(1,si),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n2_S(sj),n4_S(sl),list2(1,sj),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si)*n3_S(sk), n2_S(sj)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,l,idx_i,idx_j,idx_k,idx_l) + !$OMP DO collapse(3) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = buffer(i,k,j,l) + enddo + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + allocate(v1(cholesky_mo_num,n2_S(sj),n3_S(sk)), v2(cholesky_mo_num,n1_S(si),n4_S(sl))) + allocate(buffer(n2_S(sj),n3_S(sk),n1_S(si),n4_S(sl))) + + call gen_v_space_chol(n2_S(sj),n3_S(sk),list2(1,sj),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),n4_S(sl),list1(1,si),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n2_S(sj)*n3_S(sk), n1_S(si)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n2_S(sj)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,l,idx_i,idx_j,idx_k,idx_l) + !$OMP DO collapse(3) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = v(idx_i,idx_j,idx_k,idx_l) - buffer(j,k,i,l) + enddo + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sk .and. sj == sl) then + + allocate(v1(cholesky_mo_num,n1_S(si),n3_S(sk)), v2(cholesky_mo_num,n2_S(sj),n4_S(sl))) + allocate(buffer(n1_S(si),n3_S(sk),n2_S(sj),n4_S(sl))) + + call gen_v_space_chol(n1_S(si),n3_S(sk),list1(1,si),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n2_S(sj),n4_S(sl),list2(1,sj),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si)*n3_S(sk), n2_S(sj)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,l,idx_i,idx_j,idx_k,idx_l) + !$OMP DO collapse(3) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = buffer(i,k,j,l) + enddo + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sl .and. sj == sk) then + + allocate(v1(cholesky_mo_num,n2_S(sj),n3_S(sk)), v2(cholesky_mo_num,n1_S(si),n4_S(sl))) + allocate(buffer(n2_S(sj),n3_S(sk),n1_S(si),n4_S(sl))) + + call gen_v_space_chol(n2_S(sj),n3_S(sk),list2(1,sj),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),n4_S(sl),list1(1,si),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n2_S(sj)*n3_S(sk), n1_S(si)*n4_S(sl), cholesky_mo_num, -1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n2_S(sj)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,l,idx_i,idx_j,idx_k,idx_l) + !$OMP DO collapse(3) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = buffer(j,k,i,l) + enddo + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + else + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,l,idx_i,idx_j,idx_k,idx_l) + !$OMP DO collapse(3) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = 0d0 + enddo + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL - !$OMP PARALLEL & - !$OMP SHARED(cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v) & - !$OMP PRIVATE(s,si,sj,sk,sl,i_shift,j_shift,k_shift,l_shift, & - !$OMP i,j,k,l,idx_i,idx_j,idx_k,idx_l,& - !$OMP tmp_i,tmp_j,tmp_k,tmp_l)& - !$OMP DEFAULT(NONE) + endif - do sl = 1, 2 - call shift_idx_spin(sl,n4_S,l_shift) - do sk = 1, 2 - call shift_idx_spin(sk,n3_S,k_shift) - do sj = 1, 2 - call shift_idx_spin(sj,n2_S,j_shift) - do si = 1, 2 - call shift_idx_spin(si,n1_S,i_shift) + enddo + enddo + enddo + enddo - s = si+sj+sk+sl - ! or - if (s == 4 .or. s == 8) then - !$OMP DO collapse(3) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + else + !$OMP PARALLEL & + !$OMP SHARED(n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v) & + !$OMP PRIVATE(s,si,sj,sk,sl,i_shift,j_shift,k_shift,l_shift, & + !$OMP i,j,k,l,idx_i,idx_j,idx_k,idx_l,& + !$OMP tmp_i,tmp_j,tmp_k,tmp_l)& + !$OMP DEFAULT(NONE) + + do sl = 1, 2 + call shift_idx_spin(sl,n4_S,l_shift) + do sk = 1, 2 + call shift_idx_spin(sk,n3_S,k_shift) + do sj = 1, 2 + call shift_idx_spin(sj,n2_S,j_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + !$OMP DO collapse(3) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - mo_two_e_integral(j,i,k,l) - v(idx_i,idx_j,idx_k,idx_l) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - mo_two_e_integral(j,i,k,l) + enddo enddo enddo enddo - enddo - !$OMP END DO - - ! or - elseif (si == sk .and. sj == sl) then - !$OMP DO collapse(3) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + ! or + elseif (si == sk .and. sj == sl) then + !$OMP DO collapse(3) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - v(idx_i,idx_j,idx_k,idx_l) = cc_space_v(i,j,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) + enddo enddo enddo enddo - enddo - !$OMP END DO - - ! or - elseif (si == sl .and. sj == sk) then - !$OMP DO collapse(3) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + ! or + elseif (si == sl .and. sj == sk) then + !$OMP DO collapse(3) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = - mo_two_e_integral(j,i,k,l) - v(idx_i,idx_j,idx_k,idx_l) = - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = - mo_two_e_integral(j,i,k,l) + enddo enddo enddo enddo - enddo - !$OMP END DO - else - !$OMP DO collapse(3) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) - l = list4(tmp_l,sl) + !$OMP END DO + else + !$OMP DO collapse(3) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) idx_l = tmp_l + l_shift - k = list3(tmp_k,sk) idx_k = tmp_k + k_shift - j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - v(idx_i,idx_j,idx_k,idx_l) = 0d0 + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v(idx_i,idx_j,idx_k,idx_l) = 0d0 + enddo enddo enddo enddo - enddo - !$OMP END DO - endif + !$OMP END DO + endif + enddo enddo enddo enddo - enddo - !$OMP END PARALLEL + !$OMP END PARALLEL + + endif end + ! V_3idx subroutine gen_v_spin_3idx(n1,n2,n3,n4, idx_l, n1_S,n2_S,n3_S,n4_S, list1,list2,list3,list4, dim1,dim2,dim3, v_l) @@ -1323,7 +1500,8 @@ subroutine gen_v_spin_3idx(n1,n2,n3,n4, idx_l, n1_S,n2_S,n3_S,n4_S, list1,list2, integer :: tmp_i,tmp_j,tmp_k,tmp_l integer :: si,sj,sk,sl,s - PROVIDE cc_space_v + double precision, allocatable :: buffer(:,:,:) + double precision, allocatable :: v1(:,:,:), v2(:,:,:) if (idx_l <= n4_S(1)) then sl = 1 @@ -1334,99 +1512,255 @@ subroutine gen_v_spin_3idx(n1,n2,n3,n4, idx_l, n1_S,n2_S,n3_S,n4_S, list1,list2, tmp_l = idx_l - l_shift l = list4(tmp_l,sl) - !$OMP PARALLEL & - !$OMP SHARED(l,sl,idx_l,cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v_l) & - !$OMP PRIVATE(s,si,sj,sk,i_shift,j_shift,k_shift, & - !$OMP i,j,k,idx_i,idx_j,idx_k,& - !$OMP tmp_i,tmp_j,tmp_k)& - !$OMP DEFAULT(NONE) + if (do_mo_cholesky) then - do sk = 1, 2 - call shift_idx_spin(sk,n3_S,k_shift) - do sj = 1, 2 - call shift_idx_spin(sj,n2_S,j_shift) - do si = 1, 2 - call shift_idx_spin(si,n1_S,i_shift) - - s = si+sj+sk+sl - ! or - if (s == 4 .or. s == 8) then - !$OMP DO collapse(2) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) - k = list3(tmp_k,sk) + do sk = 1, 2 + call shift_idx_spin(sk,n3_S,k_shift) + do sj = 1, 2 + call shift_idx_spin(sj,n2_S,j_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + + allocate(v1(cholesky_mo_num,n1_S(si),n3_S(sk)), v2(cholesky_mo_num,n2_S(sj),1)) + allocate(buffer(n1_S(si),n3_S(sk),n2_S(sj))) + + call gen_v_space_chol(n1_S(si),n3_S(sk),list1(1,si),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n2_S(sj),1,list2(1,sj),list4(tmp_l,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si)*n3_S(sk), n2_S(sj), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,idx_i,idx_j,idx_k) + !$OMP DO collapse(2) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_l(idx_i,idx_j,idx_k) = buffer(i,k,j) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + allocate(v1(cholesky_mo_num,n2_S(sj),n3_S(sk)), v2(cholesky_mo_num,n1_S(si),1)) + allocate(buffer(n2_S(sj),n3_S(sk),n1_S(si))) + + call gen_v_space_chol(n2_S(sj),n3_S(sk),list2(1,sj),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),1,list1(1,si),list4(tmp_l,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n2_S(sj)*n3_S(sk), n1_S(si), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n2_S(sj)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,idx_i,idx_j,idx_k) + !$OMP DO collapse(2) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_l(idx_i,idx_j,idx_k) = v_l(idx_i,idx_j,idx_k) - buffer(j,k,i) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sk .and. sj == sl) then + + allocate(v1(cholesky_mo_num,n1_S(si),n3_S(sk)), v2(cholesky_mo_num,n2_S(sj),1)) + allocate(buffer(n1_S(si),n3_S(sk),n2_S(sj))) + + call gen_v_space_chol(n1_S(si),n3_S(sk),list1(1,si),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n2_S(sj),1,list2(1,sj),list4(tmp_l,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si)*n3_S(sk), n2_S(sj), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,idx_i,idx_j,idx_k) + !$OMP DO collapse(2) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_l(idx_i,idx_j,idx_k) = buffer(i,k,j) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sl .and. sj == sk) then + + allocate(v1(cholesky_mo_num,n2_S(sj),n3_S(sk)), v2(cholesky_mo_num,n1_S(si),1)) + allocate(buffer(n2_S(sj),n3_S(sk),n1_S(si))) + + call gen_v_space_chol(n2_S(sj),n3_S(sk),list2(1,sj),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),1,list1(1,si),list4(tmp_l,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n2_S(sj)*n3_S(sk), n1_S(si), cholesky_mo_num, -1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n2_S(sj)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,k,idx_i,idx_j,idx_k,idx_l) + !$OMP DO collapse(2) + do k = 1, n3_S(sk) + do j = 1, n2_S(sj) + idx_k = k + k_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_l(idx_i,idx_j,idx_k) = buffer(j,k,i) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + else + !$OMP DO collapse(2) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) idx_k = tmp_k + k_shift - j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - mo_two_e_integral(j,i,k,l) - v_l(idx_i,idx_j,idx_k) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + idx_i = tmp_i + i_shift + v_l(idx_i,idx_j,idx_k) = 0d0 + enddo enddo enddo - enddo - !$OMP END DO - - ! or - elseif (si == sk .and. sj == sl) then - !$OMP DO collapse(2) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + endif + + enddo + enddo + enddo + + + else + + PROVIDE cc_space_v + + !$OMP PARALLEL & + !$OMP SHARED(l,sl,idx_l,cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v_l) & + !$OMP PRIVATE(s,si,sj,sk,i_shift,j_shift,k_shift, & + !$OMP i,j,k,idx_i,idx_j,idx_k,& + !$OMP tmp_i,tmp_j,tmp_k)& + !$OMP DEFAULT(NONE) + + do sk = 1, 2 + call shift_idx_spin(sk,n3_S,k_shift) + do sj = 1, 2 + call shift_idx_spin(sj,n2_S,j_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + !$OMP DO collapse(2) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) k = list3(tmp_k,sk) idx_k = tmp_k + k_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - v_l(idx_i,idx_j,idx_k) = cc_space_v(i,j,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_l(idx_i,idx_j,idx_k) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + enddo enddo enddo - enddo - !$OMP END DO - - ! or - elseif (si == sl .and. sj == sk) then - !$OMP DO collapse(2) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + ! or + elseif (si == sk .and. sj == sl) then + !$OMP DO collapse(2) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) k = list3(tmp_k,sk) idx_k = tmp_k + k_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = - mo_two_e_integral(j,i,k,l) - v_l(idx_i,idx_j,idx_k) = - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_l(idx_i,idx_j,idx_k) = cc_space_v(i,j,k,l) + enddo enddo enddo - enddo - !$OMP END DO - else - !$OMP DO collapse(2) - do tmp_k = 1, n3_S(sk) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + ! or + elseif (si == sl .and. sj == sk) then + !$OMP DO collapse(2) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) k = list3(tmp_k,sk) idx_k = tmp_k + k_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - v_l(idx_i,idx_j,idx_k) = 0d0 + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_l(idx_i,idx_j,idx_k) = - cc_space_v(j,i,k,l) + enddo enddo enddo - enddo - !$OMP END DO - endif + !$OMP END DO + else + !$OMP DO collapse(2) + do tmp_k = 1, n3_S(sk) + do tmp_j = 1, n2_S(sj) + idx_k = tmp_k + k_shift + idx_j = tmp_j + j_shift + do tmp_i = 1, n1_S(si) + idx_i = tmp_i + i_shift + v_l(idx_i,idx_j,idx_k) = 0d0 + enddo + enddo + enddo + !$OMP END DO + endif + enddo enddo enddo - enddo - !$OMP END PARALLEL + !$OMP END PARALLEL + + endif end @@ -1452,7 +1786,8 @@ subroutine gen_v_spin_3idx_ij_l(n1,n2,n3,n4, idx_k, n1_S,n2_S,n3_S,n4_S, list1,l integer :: tmp_i,tmp_j,tmp_k,tmp_l integer :: si,sj,sk,sl,s - PROVIDE cc_space_v + double precision, allocatable :: buffer(:,:,:) + double precision, allocatable :: v1(:,:,:), v2(:,:,:) if (idx_k <= n3_S(1)) then sk = 1 @@ -1463,100 +1798,257 @@ subroutine gen_v_spin_3idx_ij_l(n1,n2,n3,n4, idx_k, n1_S,n2_S,n3_S,n4_S, list1,l tmp_k = idx_k - k_shift k = list3(tmp_k,sk) - !$OMP PARALLEL & - !$OMP SHARED(k,sk,idx_k,cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v_k) & - !$OMP PRIVATE(s,si,sj,sl,i_shift,j_shift,l_shift, & - !$OMP i,j,l,idx_i,idx_j,idx_l,& - !$OMP tmp_i,tmp_j,tmp_l)& - !$OMP DEFAULT(NONE) + if (do_mo_cholesky) then + + do sl = 1, 2 + call shift_idx_spin(sl,n4_S,l_shift) + do sj = 1, 2 + call shift_idx_spin(sj,n2_S,j_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) - do sl = 1, 2 - call shift_idx_spin(sl,n4_S,l_shift) - do sj = 1, 2 - call shift_idx_spin(sj,n2_S,j_shift) - do si = 1, 2 - call shift_idx_spin(si,n1_S,i_shift) - - s = si+sj+sk+sl - ! or - if (s == 4 .or. s == 8) then - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + + allocate(v1(cholesky_mo_num,n1_S(si),1), v2(cholesky_mo_num,n2_S(sj),n4_S(sl))) + allocate(buffer(n1_S(si),n2_S(sj),n4_S(sl))) + + call gen_v_space_chol(n1_S(si),1,list1(1,si),list3(tmp_k,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n2_S(sj),n4_S(sl),list2(1,sj),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si), n2_S(sj)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,l,idx_i,idx_j,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_k(idx_i,idx_j,idx_l) = buffer(i,j,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + allocate(v1(cholesky_mo_num,n2_S(sj),1), v2(cholesky_mo_num,n1_S(si),n4_S(sl))) + allocate(buffer(n2_S(sj),n1_S(si),n4_S(sl))) + + call gen_v_space_chol(n2_S(sj),1,list2(1,sj),list3(tmp_k,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),n4_S(sl),list1(1,si),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n2_S(sj), n1_S(si)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n2_S(sj)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,l,idx_i,idx_j,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_k(idx_i,idx_j,idx_l) = v_k(idx_i,idx_j,idx_l) - buffer(j,i,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sk .and. sj == sl) then + + allocate(v1(cholesky_mo_num,n1_S(si),1), v2(cholesky_mo_num,n2_S(sj),n4_S(sl))) + allocate(buffer(n1_S(si),n2_S(sj),n4_S(sl))) + + call gen_v_space_chol(n1_S(si),1,list1(1,si),list3(tmp_k,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n2_S(sj),n4_S(sl),list2(1,sj),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si), n2_S(sj)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,l,idx_i,idx_j,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_k(idx_i,idx_j,idx_l) = buffer(i,j,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sl .and. sj == sk) then + + allocate(v1(cholesky_mo_num,n2_S(sj),1), v2(cholesky_mo_num,n1_S(si),n4_S(sl))) + allocate(buffer(n2_S(sj),n1_S(si),n4_S(sl))) + + call gen_v_space_chol(n2_S(sj),1,list2(1,sj),list3(tmp_k,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),n4_S(sl),list1(1,si),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n2_S(sj), n1_S(si)*n4_S(sl), cholesky_mo_num, -1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n2_S(sj)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,j,l,idx_i,idx_j,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do j = 1, n2_S(sj) + idx_l = l + l_shift + idx_j = j + j_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_k(idx_i,idx_j,idx_l) = buffer(j,i,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + else + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_j = 1, n2_S(sj) + idx_l = tmp_l + l_shift + idx_j = tmp_j + j_shift + do tmp_i = 1, n1_S(si) + idx_i = tmp_i + i_shift + v_k(idx_i,idx_j,idx_l) = 0d0 + enddo + enddo + enddo + !$OMP END DO + + endif + + enddo + enddo + enddo + + else + + PROVIDE cc_space_v + + !$OMP PARALLEL & + !$OMP SHARED(k,sk,idx_k,cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v_k) & + !$OMP PRIVATE(s,si,sj,sl,i_shift,j_shift,l_shift, & + !$OMP i,j,l,idx_i,idx_j,idx_l,& + !$OMP tmp_i,tmp_j,tmp_l)& + !$OMP DEFAULT(NONE) + + do sl = 1, 2 + call shift_idx_spin(sl,n4_S,l_shift) + do sj = 1, 2 + call shift_idx_spin(sj,n2_S,j_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - mo_two_e_integral(j,i,k,l) - v_k(idx_i,idx_j,idx_l) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_k(idx_i,idx_j,idx_l) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + enddo enddo enddo - enddo - !$OMP END DO - - ! or - elseif (si == sk .and. sj == sl) then - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + ! or + elseif (si == sk .and. sj == sl) then + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - v_k(idx_i,idx_j,idx_l) = cc_space_v(i,j,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_k(idx_i,idx_j,idx_l) = cc_space_v(i,j,k,l) + enddo enddo enddo - enddo - !$OMP END DO - - ! or - elseif (si == sl .and. sj == sk) then - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + + ! or + elseif (si == sl .and. sj == sk) then + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = - mo_two_e_integral(j,i,k,l) - v_k(idx_i,idx_j,idx_l) = - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_k(idx_i,idx_j,idx_l) = - cc_space_v(j,i,k,l) + enddo enddo enddo - enddo - !$OMP END DO - else - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_j = 1, n2_S(sj) - do tmp_i = 1, n1_S(si) + !$OMP END DO + else + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_j = 1, n2_S(sj) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift j = list2(tmp_j,sj) idx_j = tmp_j + j_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - v_k(idx_i,idx_j,idx_l) = 0d0 + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_k(idx_i,idx_j,idx_l) = 0d0 + enddo enddo enddo - enddo - !$OMP END DO - endif + !$OMP END DO + endif + enddo enddo enddo - enddo - !$OMP END PARALLEL + !$OMP END PARALLEL + endif end ! V_3idx_i_kl @@ -1581,7 +2073,8 @@ subroutine gen_v_spin_3idx_i_kl(n1,n2,n3,n4, idx_j, n1_S,n2_S,n3_S,n4_S, list1,l integer :: tmp_i,tmp_j,tmp_k,tmp_l integer :: si,sj,sk,sl,s - PROVIDE cc_space_v + double precision, allocatable :: buffer(:,:,:) + double precision, allocatable :: v1(:,:,:), v2(:,:,:) if (idx_j <= n2_S(1)) then sj = 1 @@ -1592,98 +2085,265 @@ subroutine gen_v_spin_3idx_i_kl(n1,n2,n3,n4, idx_j, n1_S,n2_S,n3_S,n4_S, list1,l tmp_j = idx_j - j_shift j = list2(tmp_j,sj) - !$OMP PARALLEL & - !$OMP SHARED(j,sj,idx_j,cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v_j) & - !$OMP PRIVATE(s,si,sk,sl,i_shift,l_shift,k_shift, & - !$OMP i,k,l,idx_i,idx_k,idx_l,& - !$OMP tmp_i,tmp_k,tmp_l)& - !$OMP DEFAULT(NONE) - do sl = 1, 2 - call shift_idx_spin(sl,n4_S,l_shift) - do sk = 1, 2 - call shift_idx_spin(sk,n3_S,k_shift) - do si = 1, 2 - call shift_idx_spin(si,n1_S,i_shift) - - s = si+sj+sk+sl - ! or - if (s == 4 .or. s == 8) then - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_i = 1, n1_S(si) + if (do_mo_cholesky) then + do sl = 1, 2 + call shift_idx_spin(sl,n4_S,l_shift) + do sk = 1, 2 + call shift_idx_spin(sk,n3_S,k_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + + allocate(v1(cholesky_mo_num,n1_S(si),n3_S(sk)), v2(cholesky_mo_num,1,n4_S(sl))) + allocate(buffer(n1_S(si),n3_S(sk),n4_S(sl))) + + call gen_v_space_chol(n1_S(si),n3_S(sk),list1(1,si),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(1,n4_S(sl),list2(tmp_j,sj),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si)*n3_S(sk), n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,k,l,idx_i,idx_k,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + idx_l = l + l_shift + idx_k = k + k_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_j(idx_i,idx_k,idx_l) = buffer(i,k,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + allocate(v1(cholesky_mo_num,1,n3_S(sk)), v2(cholesky_mo_num,n1_S(si),n4_S(sl))) + allocate(buffer(n3_S(sk),n1_S(si),n4_S(sl))) + + call gen_v_space_chol(1,n3_S(sk),list2(tmp_j,sj),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),n4_S(sl),list1(1,si),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n3_S(sk), n1_S(si)*n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,k,l,idx_i,idx_k,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + idx_l = l + l_shift + idx_k = k + k_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_j(idx_i,idx_k,idx_l) = v_j(idx_i,idx_k,idx_l) - buffer(k,i,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sk .and. sj == sl) then + + allocate(v1(cholesky_mo_num,n1_S(si),n3_S(sk)), v2(cholesky_mo_num,1,n4_S(sl))) + allocate(buffer(n1_S(si),n3_S(sk),n4_S(sl))) + + call gen_v_space_chol(n1_S(si),n3_S(sk),list1(1,si),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(1,n4_S(sl),list2(tmp_j,sj),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n1_S(si)*n3_S(sk), n4_S(sl), cholesky_mo_num, 1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n1_S(si)*n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,k,l,idx_i,idx_k,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + idx_l = l + l_shift + idx_k = k + k_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_j(idx_i,idx_k,idx_l) = buffer(i,k,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + ! or + elseif (si == sl .and. sj == sk) then + + allocate(v1(cholesky_mo_num,1,n3_S(sk)), v2(cholesky_mo_num,n1_S(si),n4_S(sl))) + allocate(buffer(n3_S(sk),n1_S(si),n4_S(sl))) + + call gen_v_space_chol(1,n3_S(sk),list2(tmp_j,sj),list3(1,sk),v1,cholesky_mo_num) + call gen_v_space_chol(n1_S(si),n4_S(sl),list1(1,si),list4(1,sl),v2,cholesky_mo_num) + + call dgemm('T','N', n3_S(sk), n1_S(si)*n4_S(sl), cholesky_mo_num, -1.d0, & + v1, cholesky_mo_num, & + v2, cholesky_mo_num, 0.d0, buffer, n3_S(sk)) + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,k,l,idx_i,idx_k,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + idx_l = l + l_shift + idx_k = k + k_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_j(idx_i,idx_k,idx_l) = buffer(k,i,l) + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + deallocate(v1, v2, buffer) + + else + + !$OMP PARALLEL & + !$OMP DEFAULT(SHARED) & + !$OMP PRIVATE(i,k,l,idx_i,idx_k,idx_l) + !$OMP DO collapse(2) + do l = 1, n4_S(sl) + do k = 1, n3_S(sk) + idx_l = l + l_shift + idx_k = k + k_shift + do i = 1, n1_S(si) + idx_i = i + i_shift + v_j(idx_i,idx_k,idx_l) = 0d0 + enddo + enddo + enddo + !$OMP END DO + !$OMP END PARALLEL + + endif + + enddo + enddo + enddo + + + + else + + PROVIDE cc_space_v + + !$OMP PARALLEL & + !$OMP SHARED(j,sj,idx_j,cc_space_v,n1_S,n2_S,n3_S,n4_S,list1,list2,list3,list4,v_j) & + !$OMP PRIVATE(s,si,sk,sl,i_shift,l_shift,k_shift, & + !$OMP i,k,l,idx_i,idx_k,idx_l,& + !$OMP tmp_i,tmp_k,tmp_l)& + !$OMP DEFAULT(NONE) + + do sl = 1, 2 + call shift_idx_spin(sl,n4_S,l_shift) + do sk = 1, 2 + call shift_idx_spin(sk,n3_S,k_shift) + do si = 1, 2 + call shift_idx_spin(si,n1_S,i_shift) + + s = si+sj+sk+sl + ! or + if (s == 4 .or. s == 8) then + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - mo_two_e_integral(j,i,k,l) - v_j(idx_i,idx_k,idx_l) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - mo_two_e_integral(j,i,k,l) + v_j(idx_i,idx_k,idx_l) = cc_space_v(i,j,k,l) - cc_space_v(j,i,k,l) + enddo enddo enddo - enddo - !$OMP END DO + !$OMP END DO - ! or - elseif (si == sk .and. sj == sl) then - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_i = 1, n1_S(si) + ! or + elseif (si == sk .and. sj == sl) then + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) - v_j(idx_i,idx_k,idx_l) = cc_space_v(i,j,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + !v(idx_i,idx_j,idx_k,idx_l) = mo_two_e_integral(i,j,k,l) + v_j(idx_i,idx_k,idx_l) = cc_space_v(i,j,k,l) + enddo enddo enddo - enddo - !$OMP END DO + !$OMP END DO - ! or - elseif (si == sl .and. sj == sk) then - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_i = 1, n1_S(si) + ! or + elseif (si == sl .and. sj == sk) then + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - !v(idx_i,idx_j,idx_k,idx_l) = - mo_two_e_integral(j,i,k,l) - v_j(idx_i,idx_k,idx_l) = - cc_space_v(j,i,k,l) + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + !v(idx_i,idx_j,idx_k,idx_l) = - mo_two_e_integral(j,i,k,l) + v_j(idx_i,idx_k,idx_l) = - cc_space_v(j,i,k,l) + enddo enddo enddo - enddo - !$OMP END DO - else - !$OMP DO collapse(2) - do tmp_l = 1, n4_S(sl) - do tmp_k = 1, n3_S(sk) - do tmp_i = 1, n1_S(si) + !$OMP END DO + else + !$OMP DO collapse(2) + do tmp_l = 1, n4_S(sl) + do tmp_k = 1, n3_S(sk) l = list4(tmp_l,sl) idx_l = tmp_l + l_shift k = list3(tmp_k,sk) idx_k = tmp_k + k_shift - i = list1(tmp_i,si) - idx_i = tmp_i + i_shift - v_j(idx_i,idx_k,idx_l) = 0d0 + do tmp_i = 1, n1_S(si) + i = list1(tmp_i,si) + idx_i = tmp_i + i_shift + v_j(idx_i,idx_k,idx_l) = 0d0 + enddo enddo enddo - enddo - !$OMP END DO - endif + !$OMP END DO + endif + enddo enddo enddo - enddo - !$OMP END PARALLEL + !$OMP END PARALLEL + endif end From 3d46cde2e46c8f6dd0eb0d56d5ff446d649907bb Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 5 Feb 2025 13:35:38 +0100 Subject: [PATCH 069/175] Cleaning ccsd_spin --- src/ccsd/ccsd_space_orb_sub.irp.f | 10 +- src/ccsd/ccsd_spin_orb_sub.irp.f | 156 ++++++----------------------- src/utils_cc/mo_integrals_cc.irp.f | 101 +++++++++++++++++++ 3 files changed, 131 insertions(+), 136 deletions(-) diff --git a/src/ccsd/ccsd_space_orb_sub.irp.f b/src/ccsd/ccsd_space_orb_sub.irp.f index 30f134fc..7cd4c50c 100644 --- a/src/ccsd/ccsd_space_orb_sub.irp.f +++ b/src/ccsd/ccsd_space_orb_sub.irp.f @@ -26,7 +26,6 @@ subroutine run_ccsd_space_orb double precision, allocatable :: all_err(:,:), all_t(:,:) integer, allocatable :: list_occ(:), list_vir(:) - integer(bit_kind) :: det(N_int,2) integer :: nO, nV, nOa, nVa call set_multiple_levels_omp(.False.) @@ -38,9 +37,8 @@ subroutine run_ccsd_space_orb PROVIDE all_mo_integrals endif - det = psi_det(:,:,cc_ref) print*,'Reference determinant:' - call print_det(det,N_int) + call print_det(psi_det(1,1,cc_ref),N_int) nOa = cc_nOa nVa = cc_nVa @@ -57,10 +55,6 @@ subroutine run_ccsd_space_orb allocate(list_occ(nO),list_vir(nV)) list_occ = cc_list_occ list_vir = cc_list_vir - ! Debug - !call extract_list_orb_space(det,nO,nV,list_occ,list_vir) - !print*,'occ',list_occ - !print*,'vir',list_vir ! GPU arrays call gpu_allocate(d_cc_space_f_oo, nO, nO) @@ -186,7 +180,7 @@ subroutine run_ccsd_space_orb call update_tau_space(nO,nV,h_t1,t1,t2,tau) call update_tau_x_space(nO,nV,tau,tau_x) - call det_energy(det,uncorr_energy) + call det_energy(psi_det(1,1,cc_ref),uncorr_energy) print*,'Det energy', uncorr_energy call ccsd_energy_space_x(nO,nV,d_cc_space_v_oovv,d_cc_space_f_vo,tau_x,t1,energy) diff --git a/src/ccsd/ccsd_spin_orb_sub.irp.f b/src/ccsd/ccsd_spin_orb_sub.irp.f index fe202ebf..fa0983cd 100644 --- a/src/ccsd/ccsd_spin_orb_sub.irp.f +++ b/src/ccsd/ccsd_spin_orb_sub.irp.f @@ -14,65 +14,31 @@ subroutine run_ccsd_spin_orb double precision, allocatable :: cW_oooo(:,:,:,:), cW_ovvo(:,:,:,:) !, cW_vvvv(:,:,:,:) double precision, allocatable :: f_o(:), f_v(:) - double precision, allocatable :: v_oooo(:,:,:,:), v_vooo(:,:,:,:), v_ovoo(:,:,:,:) - double precision, allocatable :: v_oovo(:,:,:,:), v_ooov(:,:,:,:), v_vvoo(:,:,:,:) - double precision, allocatable :: v_vovo(:,:,:,:), v_voov(:,:,:,:), v_ovvo(:,:,:,:) - double precision, allocatable :: v_ovov(:,:,:,:), v_oovv(:,:,:,:), v_vvvo(:,:,:,:) - double precision, allocatable :: v_vvov(:,:,:,:), v_vovv(:,:,:,:), v_ovvv(:,:,:,:) - double precision, allocatable :: v_vvvv(:,:,:,:) +! double precision, allocatable :: v_ovvv(:,:,:,:) double precision, allocatable :: all_err(:,:), all_t(:,:) logical :: not_converged - integer :: nOa,nOb,nVa,nVb,nO_m,nV_m,nO_S(2),nV_S(2),n_spin(4) + integer :: n_spin(4) integer :: nb_iter, i,j,a,b double precision :: uncorr_energy, energy, max_r, max_r1, max_r2, cc, ta, tb,ti,tf,tbi,tfi - integer(bit_kind) :: det(N_int,2) - det = psi_det(:,:,cc_ref) + if (do_mo_cholesky) then + PROVIDE cholesky_mo_transp + FREE cholesky_ao + else + PROVIDE all_mo_integrals + endif + print*,'Reference determinant:' - call print_det(det,N_int) - - ! Extract number of occ/vir alpha/beta spin orbitals - !call extract_n_spin(det,n_spin) - nOa = cc_nOa !n_spin(1) - nOb = cc_nOb !n_spin(2) - nVa = cc_nVa !n_spin(3) - nVb = cc_nVb !n_spin(4) - - ! Number of occ/vir spin orb per spin - nO_S = cc_nO_S !(/nOa,nOb/) - nV_S = cc_nV_S !(/nVa,nVb/) - ! Debug - !print*,nO_S,nV_S - - ! Maximal number of occ/vir - nO_m = cc_nO_m !max(nOa, nOb) - nV_m = cc_nV_m !max(nVa, nVb) - ! Debug - !print*,nO_m,nV_m + call print_det(psi_det(1,1,cc_ref),N_int) ! Allocation allocate(t1(cc_nOab,cc_nVab), t2(cc_nOab,cc_nOab,cc_nVab,cc_nVab), tau(cc_nOab,cc_nOab,cc_nVab,cc_nVab), tau_t(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) allocate(r1(cc_nOab,cc_nVab), r2(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) allocate(cF_oo(cc_nOab,cc_nOab), cF_ov(cc_nOab,cc_nVab), cF_vv(cc_nVab,cc_nVab)) allocate(cW_oooo(cc_nOab,cc_nOab,cc_nOab,cc_nOab), cW_ovvo(cc_nOab,cc_nVab,cc_nVab,cc_nOab))!, cW_vvvv(cc_nVab,cc_nVab,cc_nVab,cc_nVab)) - allocate(v_oooo(cc_nOab,cc_nOab,cc_nOab,cc_nOab)) - !allocate(v_vooo(cc_nVab,cc_nOab,cc_nOab,cc_nOab)) - allocate(v_ovoo(cc_nOab,cc_nVab,cc_nOab,cc_nOab)) - allocate(v_oovo(cc_nOab,cc_nOab,cc_nVab,cc_nOab)) - allocate(v_ooov(cc_nOab,cc_nOab,cc_nOab,cc_nVab)) - allocate(v_vvoo(cc_nVab,cc_nVab,cc_nOab,cc_nOab)) - !allocate(v_vovo(cc_nVab,cc_nOab,cc_nVab,cc_nOab)) - !allocate(v_voov(cc_nVab,cc_nOab,cc_nOab,cc_nVab)) - allocate(v_ovvo(cc_nOab,cc_nVab,cc_nVab,cc_nOab)) - allocate(v_ovov(cc_nOab,cc_nVab,cc_nOab,cc_nVab)) - allocate(v_oovv(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) - !allocate(v_vvvo(cc_nVab,cc_nVab,cc_nVab,cc_nOab)) - !allocate(v_vvov(cc_nVab,cc_nVab,cc_nOab,cc_nVab)) - !allocate(v_vovv(cc_nVab,cc_nOab,cc_nVab,cc_nVab)) - !allocate(v_ovvv(cc_nOab,cc_nVab,cc_nVab,cc_nVab)) - !allocate(v_vvvv(cc_nVab,cc_nVab,cc_nVab,cc_nVab)) + allocate(f_o(cc_nOab), f_v(cc_nVab)) ! Allocation for the diis @@ -90,45 +56,20 @@ subroutine run_ccsd_spin_orb f_v(i) = cc_spin_f_vv(i,i) enddo - ! Bi electronic integrals from list - call wall_time(ti) - ! OOOO - call gen_v_spin(nO_m,nO_m,nO_m,nO_m, nO_S,nO_S,nO_S,nO_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nOab,cc_nOab,cc_nOab,cc_nOab, v_oooo) - - ! OOO V - !call gen_v_spin(nV_m,nO_m,nO_m,nO_m, nV_S,nO_S,nO_S,nO_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nVab,cc_nOab,cc_nOab,cc_nOab, v_vooo) - call gen_v_spin(nO_m,nV_m,nO_m,nO_m, nO_S,nV_S,nO_S,nO_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nOab,cc_nVab,cc_nOab,cc_nOab, v_ovoo) - call gen_v_spin(nO_m,nO_m,nV_m,nO_m, nO_S,nO_S,nV_S,nO_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nOab,cc_nOab,cc_nVab,cc_nOab, v_oovo) - call gen_v_spin(nO_m,nO_m,nO_m,nV_m, nO_S,nO_S,nO_S,nV_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nOab,cc_nOab,cc_nOab,cc_nVab, v_ooov) - - ! OO VV - call gen_v_spin(nV_m,nV_m,nO_m,nO_m, nV_S,nV_S,nO_S,nO_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin, cc_nVab,cc_nVab,cc_nOab,cc_nOab, v_vvoo) - !call gen_v_spin(nV_m,nO_m,nV_m,nO_m, nV_S,nO_S,nV_S,nO_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nVab,cc_nOab,cc_nVab,cc_nOab, v_vovo) - !call gen_v_spin(nV_m,nO_m,nO_m,nV_m, nV_S,nO_S,nO_S,nV_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nVab,cc_nOab,cc_nOab,cc_nVab, v_voov) - call gen_v_spin(nO_m,nV_m,nV_m,nO_m, nO_S,nV_S,nV_S,nO_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nOab,cc_nVab,cc_nVab,cc_nOab, v_ovvo) - call gen_v_spin(nO_m,nV_m,nO_m,nV_m, nO_S,nV_S,nO_S,nV_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nOab,cc_nVab,cc_nOab,cc_nVab, v_ovov) - call gen_v_spin(nO_m,nO_m,nV_m,nV_m, nO_S,nO_S,nV_S,nV_S, cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nOab,cc_nOab,cc_nVab,cc_nVab, v_oovv) - - ! O VVV - !call gen_v_spin(nV_m,nV_m,nV_m,nO_m, nV_S,nV_S,nV_S,nO_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, cc_nVab,cc_nVab,cc_nVab,cc_nOab, v_vvvo) - !call gen_v_spin(nV_m,nV_m,nO_m,nV_m, nV_S,nV_S,nO_S,nV_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin, cc_nVab,cc_nVab,cc_nOab,cc_nVab, v_vvov) - !call gen_v_spin(nV_m,nO_m,nV_m,nV_m, nV_S,nO_S,nV_S,nV_S, cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nVab,cc_nOab,cc_nVab,cc_nVab, v_vovv) - !call gen_v_spin(nO_m,nV_m,nV_m,nV_m, nO_S,nV_S,nV_S,nV_S, cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nOab,cc_nVab,cc_nVab,cc_nVab, v_ovvv) - - ! VVVV - !call gen_v_spin(nV_m,nV_m,nV_m,nV_m, nV_S,nV_S,nV_S,nV_S, cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin, cc_nVab,cc_nVab,cc_nVab,cc_nVab, v_vvvv) - call wall_time(tf) - if (cc_dev) then - print*,'Load bi elec int:',tf-ti,'s' - endif ! Init of T t1 = 0d0 call guess_t1(cc_nOab,cc_nVab,f_o,f_v,cc_spin_f_ov,t1) - call guess_t2(cc_nOab,cc_nVab,f_o,f_v,v_oovv,t2) + call guess_t2(cc_nOab,cc_nVab,f_o,f_v,cc_spin_v_oovv,t2) call compute_tau_spin(cc_nOab,cc_nVab,t1,t2,tau) call compute_tau_t_spin(cc_nOab,cc_nVab,t1,t2,tau_t) + call det_energy(psi_det(1,1,cc_ref),uncorr_energy) + print*,'Det energy', uncorr_energy + + call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,cc_spin_v_oovv,energy) + print*,'guess energy', uncorr_energy+energy, energy + ! Loop init nb_iter = 0 not_converged = .True. @@ -137,11 +78,6 @@ subroutine run_ccsd_spin_orb max_r1 = 0d0 max_r2 = 0d0 - call det_energy(det,uncorr_energy) - print*,'Det energy', uncorr_energy - call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,v_oovv,energy) - print*,'guess energy', uncorr_energy+energy, energy - write(*,'(A77)') ' -----------------------------------------------------------------------------' write(*,'(A77)') ' | It. | E(CCSD) (Ha) | Correlation (Ha) | Conv. T1 | Conv. T2 |' write(*,'(A77)') ' -----------------------------------------------------------------------------' @@ -152,38 +88,16 @@ subroutine run_ccsd_spin_orb do while (not_converged) ! Intermediates - call wall_time(tbi) - call wall_time(ti) - call compute_cF_oo(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_oo,cc_spin_F_ov,v_ooov,v_oovv,cF_oo) - call compute_cF_ov(cc_nOab,cc_nVab,t1,cc_spin_F_ov,v_oovv,cF_ov) - call compute_cF_vv(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_ov,cc_spin_F_vv,v_oovv,cF_vv) - call wall_time(tf) - if (cc_dev) then - print*,'Compute cFs:',tf-ti,'s' - endif + call compute_cF_oo(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_oo,cc_spin_F_ov,cc_spin_v_ooov,cc_spin_v_oovv,cF_oo) + call compute_cF_ov(cc_nOab,cc_nVab,t1,cc_spin_F_ov,cc_spin_v_oovv,cF_ov) + call compute_cF_vv(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_ov,cc_spin_F_vv,cc_spin_v_oovv,cF_vv) - call wall_time(ti) - call compute_cW_oooo(cc_nOab,cc_nVab,t1,t2,tau,v_oooo,v_ooov,v_oovv,cW_oooo) - call compute_cW_ovvo(cc_nOab,cc_nVab,t1,t2,tau,v_ovvo,v_oovo,v_oovv,cW_ovvo) - !call compute_cW_vvvv(cc_nOab,cc_nVab,t1,t2,tau,v_vvvv,v_vovv,v_oovv,cW_vvvv) - call wall_time(tf) - if (cc_dev) then - print*,'Compute cFs:',tf-ti,'s' - endif + call compute_cW_oooo(cc_nOab,cc_nVab,t1,t2,tau,cc_spin_v_oooo,cc_spin_v_ooov,cc_spin_v_oovv,cW_oooo) + call compute_cW_ovvo(cc_nOab,cc_nVab,t1,t2,tau,cc_spin_v_ovvo,cc_spin_v_oovo,cc_spin_v_oovv,cW_ovvo) ! Residuals - call wall_time(ti) - call compute_r1_spin(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_F_ov,cF_oo,cF_ov,cF_vv,v_oovo,v_ovov,r1) - call wall_time(tf) - if (cc_dev) then - print*,'Compute r1:',tf-ti,'s' - endif - call wall_time(ti) - call compute_r2_spin(cc_nOab,cc_nVab,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ovvo,v_ovoo,v_oovv,v_ovvo,r2) - call wall_time(tf) - if (cc_dev) then - print*,'Compute r2:',tf-ti,'s' - endif + call compute_r1_spin(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_F_ov,cF_oo,cF_ov,cF_vv,cc_spin_v_oovo,cc_spin_v_ovov,r1) + call compute_r2_spin(cc_nOab,cc_nVab,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ovvo,cc_spin_v_ovoo,cc_spin_v_oovv,cc_spin_v_ovvo,r2) ! Max elements in the residuals max_r1 = maxval(abs(r1(:,:))) @@ -213,7 +127,7 @@ subroutine run_ccsd_spin_orb endif ! Print - call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,v_oovv,energy) + call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,cc_spin_v_oovv,energy) call wall_time(tfi) write(*,'(A3,I6,A3,F18.12,A3,F16.12,A3,ES10.2,A3,ES10.2,A2)') ' | ',nb_iter,' | ', & @@ -258,25 +172,13 @@ subroutine run_ccsd_spin_orb deallocate(r1,r2) deallocate(cF_oo,cF_ov,cF_vv) deallocate(cW_oooo,cW_ovvo)!,cW_vvvv) - deallocate(v_oooo) - deallocate(v_ovoo,v_oovo) - deallocate(v_ovvo,v_ovov,v_oovv) double precision :: t_corr t_corr = 0.d0 if (cc_par_t .and. elec_alpha_num +elec_beta_num > 2) then print*,'CCSD(T) calculation...' call wall_time(ta) - !allocate(v_vvvo(cc_nVab,cc_nVab,cc_nVab,cc_nOab)) - !call gen_v_spin(cc_nV_m,cc_nV_m,cc_nV_m,cc_nO_m, & - ! cc_nV_S,cc_nV_S,cc_nV_S,cc_nO_S, & - ! cc_list_vir_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, & - ! cc_nVab,cc_nVab,cc_nVab,cc_nOab, v_vvvo) - - !call ccsd_par_t_spin(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_f_ov,v_ooov,v_vvoo,v_vvvo,t_corr) - call ccsd_par_t_spin_v2(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_f_ov,v_ooov,v_vvoo,t_corr) - !print*,'Working on it...' - !call abort + call ccsd_par_t_spin_v2(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_f_ov,cc_spin_v_ooov,cc_spin_v_vvoo,t_corr) call wall_time(tb) print*,'Done' print*,'Time: ',tb-ta, ' s' @@ -290,9 +192,7 @@ subroutine run_ccsd_spin_orb call save_energy(uncorr_energy + energy, t_corr) deallocate(f_o,f_v) - deallocate(v_ooov,v_vvoo,t1,t2) - !deallocate(v_ovvv,v_vvvo,v_vovv) - !deallocate(v_vvvv) + deallocate(t1,t2) end diff --git a/src/utils_cc/mo_integrals_cc.irp.f b/src/utils_cc/mo_integrals_cc.irp.f index 813c186a..4053c49b 100644 --- a/src/utils_cc/mo_integrals_cc.irp.f +++ b/src/utils_cc/mo_integrals_cc.irp.f @@ -227,6 +227,19 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [double precision, cc_spin_v_oooo, (cc_nOab, cc_nOab, cc_nOab, cc_nOab)] + + implicit none + + !TODO + call gen_v_spin(cc_nO_m,cc_nO_m,cc_nO_m,cc_nO_m, & + cc_nO_S,cc_nO_S,cc_nO_S,cc_nO_S, & + cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin, & + cc_nOab,cc_nOab,cc_nOab,cc_nOab, & + cc_spin_v_oooo) + +END_PROVIDER + ! vooo BEGIN_PROVIDER [double precision, cc_space_v_vooo, (cc_nVa, cc_nOa, cc_nOa, cc_nOa)] @@ -305,6 +318,17 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [ double precision, cc_spin_v_ovoo, (cc_nOab,cc_nVab,cc_nOab,cc_nOab)] + implicit none + + call gen_v_spin(cc_nO_m,cc_nV_m,cc_nO_m,cc_nO_m, & + cc_nO_S,cc_nV_S,cc_nO_S,cc_nO_S, & + cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin, & + cc_nOab,cc_nVab,cc_nOab,cc_nOab, & + cc_spin_v_ovoo) + +END_PROVIDER + ! oovo BEGIN_PROVIDER [double precision, cc_space_v_oovo, (cc_nOa, cc_nOa, cc_nVa, cc_nOa)] @@ -339,6 +363,17 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [ double precision, cc_spin_v_oovo, (cc_nOab,cc_nOab,cc_nVab,cc_nOab)] + implicit none + + call gen_v_spin(cc_nO_m,cc_nO_m,cc_nV_m,cc_nO_m, & + cc_nO_S,cc_nO_S,cc_nV_S,cc_nO_S, & + cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin, & + cc_nOab,cc_nOab,cc_nVab,cc_nOab, & + cc_spin_v_oovo) +END_PROVIDER + + ! ooov BEGIN_PROVIDER [double precision, cc_space_v_ooov, (cc_nOa, cc_nOa, cc_nOa, cc_nVa)] @@ -373,6 +408,17 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [ double precision, cc_spin_v_ooov, (cc_nOab,cc_nOab,cc_nOab,cc_nVab)] + implicit none + + call gen_v_spin(cc_nO_m,cc_nO_m,cc_nO_m,cc_nV_m, & + cc_nO_S,cc_nO_S,cc_nO_S,cc_nV_S, & + cc_list_occ_spin,cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin, & + cc_nOab,cc_nOab,cc_nOab,cc_nVab, & + cc_spin_v_ooov) +END_PROVIDER + + ! vvoo BEGIN_PROVIDER [double precision, cc_space_v_vvoo, (cc_nVa, cc_nVa, cc_nOa, cc_nOa)] @@ -416,6 +462,18 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER + +BEGIN_PROVIDER [ double precision, cc_spin_v_vvoo, (cc_nVab,cc_nVab,cc_nOab,cc_nOab)] + implicit none + + call gen_v_spin(cc_nV_m,cc_nV_m,cc_nO_m,cc_nO_m, & + cc_nV_S,cc_nV_S,cc_nO_S,cc_nO_S, & + cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_occ_spin, & + cc_nVab,cc_nVab,cc_nOab,cc_nOab, & + cc_spin_v_vvoo) +END_PROVIDER + + ! vovo BEGIN_PROVIDER [double precision, cc_space_v_vovo, (cc_nVa, cc_nOa, cc_nVa, cc_nOa)] @@ -527,6 +585,16 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [ double precision, cc_spin_v_ovvo, (cc_nOab,cc_nVab,cc_nVab,cc_nOab) ] + implicit none + + call gen_v_spin(cc_nO_m,cc_nV_m,cc_nV_m,cc_nO_m, & + cc_nO_S,cc_nV_S,cc_nV_S,cc_nO_S, & + cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin,cc_list_occ_spin, & + cc_nOab,cc_nVab,cc_nVab,cc_nOab, & + cc_spin_v_ovvo) +END_PROVIDER + ! ovov BEGIN_PROVIDER [double precision, cc_space_v_ovov, (cc_nOa, cc_nVa, cc_nOa, cc_nVa)] @@ -561,6 +629,16 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [ double precision, cc_spin_v_ovov, (cc_nOab,cc_nVab,cc_nOab,cc_nVab) ] + implicit none + + call gen_v_spin(cc_nO_m,cc_nV_m,cc_nO_m,cc_nV_m, & + cc_nO_S,cc_nV_S,cc_nO_S,cc_nV_S, & + cc_list_occ_spin,cc_list_vir_spin,cc_list_occ_spin,cc_list_vir_spin, & + cc_nOab,cc_nVab,cc_nOab,cc_nVab, & + cc_spin_v_ovov) +END_PROVIDER + ! oovv BEGIN_PROVIDER [double precision, cc_space_v_oovv, (cc_nOa, cc_nOa, cc_nVa, cc_nVa)] @@ -595,6 +673,16 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [ double precision, cc_spin_v_oovv, (cc_nOab,cc_nOab,cc_nVab,cc_nVab) ] + implicit none + + call gen_v_spin(cc_nO_m,cc_nO_m,cc_nV_m,cc_nV_m, & + cc_nO_S,cc_nO_S,cc_nV_S,cc_nV_S, & + cc_list_occ_spin,cc_list_occ_spin,cc_list_vir_spin,cc_list_vir_spin, & + cc_nOab,cc_nOab,cc_nVab,cc_nVab, & + cc_spin_v_oovv) +END_PROVIDER + ! vvvo BEGIN_PROVIDER [double precision, cc_space_v_vvvo, (cc_nVa, cc_nVa, cc_nVa, cc_nOa)] @@ -625,6 +713,7 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER + ! ovvv BEGIN_PROVIDER [double precision, cc_space_v_ovvv, (cc_nOa, cc_nVa, cc_nVa, cc_nVa)] @@ -677,6 +766,18 @@ subroutine gen_v_space_chol(n1,n3,list1,list3,v,ldv) END_PROVIDER +BEGIN_PROVIDER [double precision, cc_spin_v_oo_chol, (cholesky_mo_num, cc_nOab, cc_nOab)] + + implicit none + integer :: list_occ(cc_nOab) + + list_occ(1:cc_nOa) = cc_list_occ_spin(1:cc_nOa,1) + list_occ(cc_nOa+1:cc_nOab) = cc_list_occ_spin(1:cc_nOb,2) + call gen_v_space_chol(cc_nOab, cc_nOab, list_occ, list_occ, & + cc_spin_v_oo_chol, cholesky_mo_num) + +END_PROVIDER + ! ppqq BEGIN_PROVIDER [double precision, cc_space_v_ppqq, (cc_n_mo, cc_n_mo)] From 243ee0ed1457d0bb3ea725a2676620584e2b27db Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 5 Feb 2025 13:59:37 +0100 Subject: [PATCH 070/175] Introduced GPU arrays --- src/ccsd/ccsd_space_orb_sub.irp.f | 5 +- src/ccsd/ccsd_spin_orb_sub.irp.f | 89 ++++++++++++++++++------------- 2 files changed, 55 insertions(+), 39 deletions(-) diff --git a/src/ccsd/ccsd_space_orb_sub.irp.f b/src/ccsd/ccsd_space_orb_sub.irp.f index 7cd4c50c..af7e9285 100644 --- a/src/ccsd/ccsd_space_orb_sub.irp.f +++ b/src/ccsd/ccsd_space_orb_sub.irp.f @@ -177,9 +177,11 @@ subroutine run_ccsd_space_orb call guess_t2(nO,nV,cc_space_f_o,cc_space_f_v,cc_space_v_oovv,h_t2) call gpu_upload(h_t2, t2) + deallocate(h_t1, h_t2) - call update_tau_space(nO,nV,h_t1,t1,t2,tau) + call update_tau_space(nO,nV,t1%f,t1,t2,tau) call update_tau_x_space(nO,nV,tau,tau_x) + call det_energy(psi_det(1,1,cc_ref),uncorr_energy) print*,'Det energy', uncorr_energy @@ -310,7 +312,6 @@ subroutine run_ccsd_space_orb call save_energy(uncorr_energy + energy, e_t) - deallocate(h_t1, h_t2) if (do_mo_cholesky) then call gpu_deallocate(d_cc_space_v_oo_chol) call gpu_deallocate(d_cc_space_v_ov_chol) diff --git a/src/ccsd/ccsd_spin_orb_sub.irp.f b/src/ccsd/ccsd_spin_orb_sub.irp.f index fa0983cd..16062356 100644 --- a/src/ccsd/ccsd_spin_orb_sub.irp.f +++ b/src/ccsd/ccsd_spin_orb_sub.irp.f @@ -1,6 +1,5 @@ -! Code - subroutine run_ccsd_spin_orb + use gpu implicit none @@ -8,8 +7,6 @@ subroutine run_ccsd_spin_orb ! CCSD in spin orbitals END_DOC - double precision, allocatable :: t1(:,:), t2(:,:,:,:), tau(:,:,:,:), tau_t(:,:,:,:) - double precision, allocatable :: r1(:,:), r2(:,:,:,:) double precision, allocatable :: cF_oo(:,:), cF_ov(:,:), cF_vv(:,:) double precision, allocatable :: cW_oooo(:,:,:,:), cW_ovvo(:,:,:,:) !, cW_vvvv(:,:,:,:) @@ -23,6 +20,9 @@ subroutine run_ccsd_spin_orb integer :: nb_iter, i,j,a,b double precision :: uncorr_energy, energy, max_r, max_r1, max_r2, cc, ta, tb,ti,tf,tbi,tfi + type(gpu_double4) :: t2, r2, tau, tau_t + type(gpu_double2) :: t1, r1 + if (do_mo_cholesky) then PROVIDE cholesky_mo_transp FREE cholesky_ao @@ -34,13 +34,18 @@ subroutine run_ccsd_spin_orb call print_det(psi_det(1,1,cc_ref),N_int) ! Allocation - allocate(t1(cc_nOab,cc_nVab), t2(cc_nOab,cc_nOab,cc_nVab,cc_nVab), tau(cc_nOab,cc_nOab,cc_nVab,cc_nVab), tau_t(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) - allocate(r1(cc_nOab,cc_nVab), r2(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) allocate(cF_oo(cc_nOab,cc_nOab), cF_ov(cc_nOab,cc_nVab), cF_vv(cc_nVab,cc_nVab)) allocate(cW_oooo(cc_nOab,cc_nOab,cc_nOab,cc_nOab), cW_ovvo(cc_nOab,cc_nVab,cc_nVab,cc_nOab))!, cW_vvvv(cc_nVab,cc_nVab,cc_nVab,cc_nVab)) allocate(f_o(cc_nOab), f_v(cc_nVab)) + call gpu_allocate(t1, cc_nOab,cc_nVab) + call gpu_allocate(r1, cc_nOab,cc_nVab) + call gpu_allocate(t2, cc_nOab,cc_nOab,cc_nVab,cc_nVab) + call gpu_allocate(r2, cc_nOab,cc_nOab,cc_nVab,cc_nVab) + call gpu_allocate(tau, cc_nOab,cc_nOab,cc_nVab,cc_nVab) + call gpu_allocate(tau_t, cc_nOab,cc_nOab,cc_nVab,cc_nVab) + ! Allocation for the diis if (cc_update_method == 'diis') then allocate(all_err(cc_nOab*cc_nVab+cc_nOab*cc_nOab*cc_nVab*cc_nVab,cc_diis_depth), all_t(cc_nOab*cc_nVab+cc_nOab*cc_nOab*cc_nVab*cc_nVab,cc_diis_depth)) @@ -58,23 +63,29 @@ subroutine run_ccsd_spin_orb ! Init of T - t1 = 0d0 - call guess_t1(cc_nOab,cc_nVab,f_o,f_v,cc_spin_f_ov,t1) - call guess_t2(cc_nOab,cc_nVab,f_o,f_v,cc_spin_v_oovv,t2) - call compute_tau_spin(cc_nOab,cc_nVab,t1,t2,tau) - call compute_tau_t_spin(cc_nOab,cc_nVab,t1,t2,tau_t) + double precision, allocatable :: h_t1(:,:), h_t2(:,:,:,:) + allocate(h_t1(cc_nOab,cc_nVab), h_t2(cc_nOab,cc_nOab,cc_nVab,cc_nVab)) + h_t1 = 0d0 + call guess_t1(cc_nOab,cc_nVab,f_o,f_v,cc_spin_f_ov,h_t1) + call gpu_upload(h_t1, t1) + + call guess_t2(cc_nOab,cc_nVab,f_o,f_v,cc_spin_v_oovv,h_t2) + call gpu_upload(h_t2, t2) + + deallocate(h_t1,h_t2) + + call compute_tau_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau%f) + call compute_tau_t_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau_t%f) call det_energy(psi_det(1,1,cc_ref),uncorr_energy) print*,'Det energy', uncorr_energy - call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,cc_spin_v_oovv,energy) + call ccsd_energy_spin(cc_nOab,cc_nVab,t1%f,t2%f,cc_spin_F_ov,cc_spin_v_oovv,energy) print*,'guess energy', uncorr_energy+energy, energy ! Loop init nb_iter = 0 not_converged = .True. - r1 = 0d0 - r2 = 0d0 max_r1 = 0d0 max_r2 = 0d0 @@ -88,46 +99,46 @@ subroutine run_ccsd_spin_orb do while (not_converged) ! Intermediates - call compute_cF_oo(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_oo,cc_spin_F_ov,cc_spin_v_ooov,cc_spin_v_oovv,cF_oo) - call compute_cF_ov(cc_nOab,cc_nVab,t1,cc_spin_F_ov,cc_spin_v_oovv,cF_ov) - call compute_cF_vv(cc_nOab,cc_nVab,t1,tau_t,cc_spin_F_ov,cc_spin_F_vv,cc_spin_v_oovv,cF_vv) + call compute_cF_oo(cc_nOab,cc_nVab,t1%f,tau_t%f,cc_spin_F_oo,cc_spin_F_ov,cc_spin_v_ooov,cc_spin_v_oovv,cF_oo) + call compute_cF_ov(cc_nOab,cc_nVab,t1%f,cc_spin_F_ov,cc_spin_v_oovv,cF_ov) + call compute_cF_vv(cc_nOab,cc_nVab,t1%f,tau_t%f,cc_spin_F_ov,cc_spin_F_vv,cc_spin_v_oovv,cF_vv) - call compute_cW_oooo(cc_nOab,cc_nVab,t1,t2,tau,cc_spin_v_oooo,cc_spin_v_ooov,cc_spin_v_oovv,cW_oooo) - call compute_cW_ovvo(cc_nOab,cc_nVab,t1,t2,tau,cc_spin_v_ovvo,cc_spin_v_oovo,cc_spin_v_oovv,cW_ovvo) + call compute_cW_oooo(cc_nOab,cc_nVab,t1%f,t2%f,tau%f,cc_spin_v_oooo,cc_spin_v_ooov,cc_spin_v_oovv,cW_oooo) + call compute_cW_ovvo(cc_nOab,cc_nVab,t1%f,t2%f,tau%f,cc_spin_v_ovvo,cc_spin_v_oovo,cc_spin_v_oovv,cW_ovvo) ! Residuals - call compute_r1_spin(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_F_ov,cF_oo,cF_ov,cF_vv,cc_spin_v_oovo,cc_spin_v_ovov,r1) - call compute_r2_spin(cc_nOab,cc_nVab,t1,t2,tau,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ovvo,cc_spin_v_ovoo,cc_spin_v_oovv,cc_spin_v_ovvo,r2) + call compute_r1_spin(cc_nOab,cc_nVab,t1%f,t2%f,f_o,f_v,cc_spin_F_ov,cF_oo,cF_ov,cF_vv,cc_spin_v_oovo,cc_spin_v_ovov,r1%f) + call compute_r2_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau%f,f_o,f_v,cF_oo,cF_ov,cF_vv,cW_oooo,cW_ovvo,cc_spin_v_ovoo,cc_spin_v_oovv,cc_spin_v_ovvo,r2%f) ! Max elements in the residuals - max_r1 = maxval(abs(r1(:,:))) - max_r2 = maxval(abs(r2(:,:,:,:))) + max_r1 = maxval(abs(r1%f(:,:))) + max_r2 = maxval(abs(r2%f(:,:,:,:))) max_r = max(max_r1,max_r2) call wall_time(ti) ! Update if (cc_update_method == 'diis') then - !call update_t_ccsd(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err1,all_err2,all_t1,all_t2) - !call update_t_ccsd_diis(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err1,all_err2,all_t1,all_t2) - call update_t_ccsd_diis_v3(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1,r2,t1,t2,all_err,all_t) + !call update_t_ccsd(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1%f,r2%f,t1%f,t2%f,all_err1,all_err2,all_t1%f,all_t2) + !call update_t_ccsd_diis(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1%f,r2%f,t1%f,t2%f,all_err1,all_err2,all_t1%f,all_t2) + call update_t_ccsd_diis_v3(cc_nOab,cc_nVab,nb_iter,f_o,f_v,r1%f,r2%f,t1%f,t2%f,all_err,all_t) ! Standard update as T = T - Delta elseif (cc_update_method == 'none') then - call update_t1(cc_nOab,cc_nVab,f_o,f_v,r1,t1) - call update_t2(cc_nOab,cc_nVab,f_o,f_v,r2,t2) + call update_t1(cc_nOab,cc_nVab,f_o,f_v,r1%f,t1%f) + call update_t2(cc_nOab,cc_nVab,f_o,f_v,r2%f,t2%f) else print*,'Unkonw cc_method_method: '//cc_update_method endif - call compute_tau_spin(cc_nOab,cc_nVab,t1,t2,tau) - call compute_tau_t_spin(cc_nOab,cc_nVab,t1,t2,tau_t) + call compute_tau_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau%f) + call compute_tau_t_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau_t%f) call wall_time(tf) if (cc_dev) then print*,'Update:',tf-ti,'s' endif ! Print - call ccsd_energy_spin(cc_nOab,cc_nVab,t1,t2,cc_spin_F_ov,cc_spin_v_oovv,energy) + call ccsd_energy_spin(cc_nOab,cc_nVab,t1%f,t2%f,cc_spin_F_ov,cc_spin_v_oovv,energy) call wall_time(tfi) write(*,'(A3,I6,A3,F18.12,A3,F16.12,A3,ES10.2,A3,ES10.2,A2)') ' | ',nb_iter,' | ', & @@ -159,8 +170,8 @@ subroutine run_ccsd_spin_orb print*,'' if (write_amplitudes) then - call write_t1(cc_nOab,cc_nVab,t1) - call write_t2(cc_nOab,cc_nVab,t2) + call write_t1(cc_nOab,cc_nVab,t1%f) + call write_t2(cc_nOab,cc_nVab,t2%f) call ezfio_set_utils_cc_io_amplitudes('Read') endif @@ -168,8 +179,6 @@ subroutine run_ccsd_spin_orb if (cc_update_method == 'diis') then deallocate(all_err,all_t) endif - deallocate(tau,tau_t) - deallocate(r1,r2) deallocate(cF_oo,cF_ov,cF_vv) deallocate(cW_oooo,cW_ovvo)!,cW_vvvv) @@ -178,7 +187,7 @@ subroutine run_ccsd_spin_orb if (cc_par_t .and. elec_alpha_num +elec_beta_num > 2) then print*,'CCSD(T) calculation...' call wall_time(ta) - call ccsd_par_t_spin_v2(cc_nOab,cc_nVab,t1,t2,f_o,f_v,cc_spin_f_ov,cc_spin_v_ooov,cc_spin_v_vvoo,t_corr) + call ccsd_par_t_spin_v2(cc_nOab,cc_nVab,t1%f,t2%f,f_o,f_v,cc_spin_f_ov,cc_spin_v_ooov,cc_spin_v_vvoo,t_corr) call wall_time(tb) print*,'Done' print*,'Time: ',tb-ta, ' s' @@ -192,7 +201,13 @@ subroutine run_ccsd_spin_orb call save_energy(uncorr_energy + energy, t_corr) deallocate(f_o,f_v) - deallocate(t1,t2) + + call gpu_deallocate(t1) + call gpu_deallocate(r1) + call gpu_deallocate(t2) + call gpu_deallocate(r2) + call gpu_deallocate(tau) + call gpu_deallocate(tau_t) end From 6b597c5ceeb7ccb12e32f477c36989c957c7189a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 11:49:42 +0100 Subject: [PATCH 071/175] Optimization in CASSCF --- src/casscf_cipsi/chol_bielec.irp.f | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/casscf_cipsi/chol_bielec.irp.f b/src/casscf_cipsi/chol_bielec.irp.f index f69832c1..a22ad7f3 100644 --- a/src/casscf_cipsi/chol_bielec.irp.f +++ b/src/casscf_cipsi/chol_bielec.irp.f @@ -191,10 +191,15 @@ double precision function bielec_PQxx_no(i_mo, j_mo, i_ca, j_ca) END_DOC integer, intent(in) :: i_ca, j_ca, i_mo, j_mo integer :: ii_ca, jj_ca - double precision :: bielec_no_basis ii_ca = list_core_inact_act(i_ca) jj_ca = list_core_inact_act(j_ca) - bielec_PQxx_no = bielec_no_basis(i_mo,j_mo,ii_ca,jj_ca) +! double precision :: bielec_no_basis +! bielec_PQxx_no = bielec_no_basis(i_mo,j_mo,ii_ca,jj_ca) + integer :: i + bielec_PQxx_no = 0.d0 + do i = 1, cholesky_mo_num + bielec_PQxx_no = bielec_PQxx_no + cholesky_no_total_transp(i,i_mo, j_mo) * cholesky_no_total_transp(i,ii_ca,jj_ca) + enddo end double precision function bielec_PxxQ_no(i_mo, j_ca, i_ca, j_mo) @@ -206,10 +211,15 @@ double precision function bielec_PxxQ_no(i_mo, j_ca, i_ca, j_mo) END_DOC integer, intent(in) :: i_ca, j_ca, i_mo, j_mo integer :: ii_ca, jj_ca - double precision :: bielec_no_basis ii_ca = list_core_inact_act(i_ca) jj_ca = list_core_inact_act(j_ca) - bielec_PxxQ_no = bielec_no_basis(i_mo, jj_ca, ii_ca, j_mo) + double precision :: bielec_no_basis +! bielec_PxxQ_no = bielec_no_basis(i_mo, jj_ca, ii_ca, j_mo) + integer :: i + bielec_PxxQ_no = 0.d0 + do i = 1, cholesky_mo_num + bielec_PxxQ_no = bielec_PxxQ_no + cholesky_no_total_transp(i,i_mo, jj_ca) * cholesky_no_total_transp(i,ii_ca,j_mo) + enddo end From 8c7184fb774706add1e56ed536cb3f18126aa79d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 11:50:11 +0100 Subject: [PATCH 072/175] Speed up cache in integrals --- src/davidson/u0_hs2_u0.irp.f | 2 +- src/mo_two_e_ints/map_integrals.irp.f | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/davidson/u0_hs2_u0.irp.f b/src/davidson/u0_hs2_u0.irp.f index f2ce7aa9..dd5e01eb 100644 --- a/src/davidson/u0_hs2_u0.irp.f +++ b/src/davidson/u0_hs2_u0.irp.f @@ -158,7 +158,7 @@ subroutine H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_st,sze,istart,iend,ishift, double precision, intent(out) :: v_t(N_st,sze), s_t(N_st,sze) - PROVIDE ref_bitmask_energy N_int + PROVIDE ref_bitmask_energy N_int all_mo_integrals select case (N_int) case (1) diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 5b233899..b5f78b7b 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -81,11 +81,15 @@ subroutine insert_into_mo_integrals_map(n_integrals, & integer(key_kind) :: idx real(integral_kind) :: integral FREE ao_integrals_cache + if (do_mo_cholesky) then call set_multiple_levels_omp(.False.) - !$OMP PARALLEL DO PRIVATE (k,l,ii) + + + !$OMP PARALLEL DO PRIVATE(k,l,ii) SCHEDULE(dynamic) do l=mo_integrals_cache_min,mo_integrals_cache_max + print *, l do k=mo_integrals_cache_min,mo_integrals_cache_max ii = int(l-mo_integrals_cache_min,8) ii = ior( shiftl(ii,mo_integrals_cache_shift), int(k-mo_integrals_cache_min,8)) @@ -101,7 +105,7 @@ subroutine insert_into_mo_integrals_map(n_integrals, & !$OMP END PARALLEL DO else - !$OMP PARALLEL DO PRIVATE (i,j,k,l,idx,ii,integral) + !$OMP PARALLEL DO PRIVATE (i,j,k,l,idx,ii,integral) SCHEDULE(dynamic) do l=mo_integrals_cache_min,mo_integrals_cache_max do k=mo_integrals_cache_min,mo_integrals_cache_max do j=mo_integrals_cache_min,mo_integrals_cache_max From 4792e86e4d724fedb20dea047d9f7ce0107f40d2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 12:31:31 +0100 Subject: [PATCH 073/175] DGEMM in mcscf_fock --- src/casscf_cipsi/mcscf_fock.irp.f | 118 +++++++++++++++++++----------- 1 file changed, 74 insertions(+), 44 deletions(-) diff --git a/src/casscf_cipsi/mcscf_fock.irp.f b/src/casscf_cipsi/mcscf_fock.irp.f index 82b710a7..738dee2c 100644 --- a/src/casscf_cipsi/mcscf_fock.irp.f +++ b/src/casscf_cipsi/mcscf_fock.irp.f @@ -3,37 +3,52 @@ ! the inactive Fock matrix, in molecular orbitals END_DOC implicit none - integer :: p,q,k,kk,t,tt,u,uu - double precision :: bielec_pxxq_no, bielec_pqxx_no - + integer :: i,p,q,k,kk,t,tt,u,uu + do q=1,mo_num do p=1,mo_num Fipq(p,q)=one_ints_no(p,q) end do end do - + ! the inactive Fock matrix do k=1,n_core_inact_orb - kk=list_core_inact(k) - do q=1,mo_num - do p=1,mo_num - Fipq(p,q)+=2.D0*bielec_pqxx_no(p,q,k,k) -bielec_pxxq_no(p,k,k,q) - end do - end do + kk=list_core_inact_act(k) +! do q=1,mo_num +! do p=1,mo_num +! do i=1,cholesky_mo_num +! Fipq(p,q) = Fipq(p,q) + 2.d0* cholesky_no_total_transp(i,p,q) * cholesky_no_total_transp(i,kk,kk) +! enddo +! end do +! end do + call dgemm('T','N', mo_num*mo_num, 1, cholesky_mo_num, 2.d0, & + cholesky_no_total_transp, cholesky_mo_num, & + cholesky_no_total_transp(1,kk,kk), cholesky_mo_num, 1.d0, & + Fipq, mo_num*mo_num) +! do q=1,mo_num +! do p=1,mo_num +! do i=1,cholesky_mo_num +! Fipq(p,q) = Fipq(p,q) - cholesky_no_total_transp(i,p,kk) * cholesky_no_total_transp(i,kk,q) +! enddo +! end do +! end do + call dgemm('T','N', mo_num, mo_num, cholesky_mo_num, -1.d0, & + cholesky_no_total_transp(1,1,kk), cholesky_mo_num, & + cholesky_no_total_transp(1,kk,1), cholesky_mo_num*mo_num, 1.d0, & + Fipq, mo_num) end do - + if (bavard) then - integer :: i write(6,*) write(6,*) ' the diagonal of the inactive effective Fock matrix ' write(6,'(5(i3,F12.5))') (i,Fipq(i,i),i=1,mo_num) write(6,*) end if - - + + END_PROVIDER - - + + BEGIN_PROVIDER [real*8, Fapq, (mo_num,mo_num) ] BEGIN_DOC ! the active active Fock matrix, in molecular orbitals @@ -45,27 +60,42 @@ END_DOC implicit none integer :: p,q,k,kk,t,tt,u,uu - double precision :: bielec_pxxq_no, bielec_pqxx_no - + Fapq = 0.d0 - + ! the active Fock matrix, D0tu is diagonal do t=1,n_act_orb tt=list_act(t) - do q=1,mo_num - do p=1,mo_num - Fapq(p,q)+=occnum(tt) & - *(bielec_pqxx_no(p,q,tt,tt)-0.5D0*bielec_pxxq_no(p,tt,tt,q)) - end do - end do +! do q=1,mo_num +! do p=1,mo_num +! do i=1,cholesky_mo_num +! Fapq(p,q) = Fapq(p,q) + occnum(tt)* cholesky_no_total_transp(i,p,q) * cholesky_no_total_transp(i,tt,tt) +! enddo +! end do +! end do + call dgemm('T','N', mo_num*mo_num, 1, cholesky_mo_num, occnum(tt), & + cholesky_no_total_transp, cholesky_mo_num, & + cholesky_no_total_transp(1,tt,tt), cholesky_mo_num, 1.d0, & + Fapq, mo_num*mo_num) +! do q=1,mo_num +! do p=1,mo_num +! do i=1,cholesky_mo_num +! Fapq(p,q) = Fapq(p,q) - 0.5d0*occnum(tt)*cholesky_no_total_transp(i,p,tt) * cholesky_no_total_transp(i,tt,q) +! enddo +! end do +! end do + call dgemm('T','N', mo_num, mo_num, cholesky_mo_num, -0.5d0*occnum(tt), & + cholesky_no_total_transp(1,1,tt), cholesky_mo_num, & + cholesky_no_total_transp(1,tt,1), cholesky_mo_num*mo_num, 1.d0, & + Fapq, mo_num) end do - + if (bavard) then integer :: i write(6,*) write(6,*) ' the effective Fock matrix over MOs' write(6,*) - + write(6,*) write(6,*) ' the diagonal of the inactive effective Fock matrix ' write(6,'(5(i3,F12.5))') (i,Fipq(i,i),i=1,mo_num) @@ -75,35 +105,35 @@ write(6,'(5(i3,F12.5))') (i,Fapq(i,i),i=1,mo_num) write(6,*) end if - - + + END_PROVIDER - - BEGIN_PROVIDER [ double precision, mcscf_fock_alpha_ao, (ao_num, ao_num)] -&BEGIN_PROVIDER [ double precision, mcscf_fock_beta_ao, (ao_num, ao_num)] + + BEGIN_PROVIDER [ double precision, mcscf_fock_alpha_ao, (ao_num, ao_num)] +&BEGIN_PROVIDER [ double precision, mcscf_fock_beta_ao, (ao_num, ao_num)] implicit none BEGIN_DOC - ! mcscf_fock_alpha_ao are set to usual Fock like operator but computed with the MCSCF densities on the AO basis + ! mcscf_fock_alpha_ao are set to usual Fock like operator but computed with the MCSCF densities on the AO basis END_DOC SCF_density_matrix_ao_alpha = D0tu_alpha_ao SCF_density_matrix_ao_beta = D0tu_beta_ao - soft_touch SCF_density_matrix_ao_alpha SCF_density_matrix_ao_beta + soft_touch SCF_density_matrix_ao_alpha SCF_density_matrix_ao_beta mcscf_fock_beta_ao = fock_matrix_ao_beta mcscf_fock_alpha_ao = fock_matrix_ao_alpha -END_PROVIDER +END_PROVIDER - BEGIN_PROVIDER [ double precision, mcscf_fock_alpha_mo, (mo_num, mo_num)] -&BEGIN_PROVIDER [ double precision, mcscf_fock_beta_mo, (mo_num, mo_num)] + BEGIN_PROVIDER [ double precision, mcscf_fock_alpha_mo, (mo_num, mo_num)] +&BEGIN_PROVIDER [ double precision, mcscf_fock_beta_mo, (mo_num, mo_num)] implicit none BEGIN_DOC - ! Mo_mcscf_fock_alpha are set to usual Fock like operator but computed with the MCSCF densities on the MO basis + ! Mo_mcscf_fock_alpha are set to usual Fock like operator but computed with the MCSCF densities on the MO basis END_DOC call ao_to_mo(mcscf_fock_alpha_ao,ao_num,mcscf_fock_alpha_mo,mo_num) call ao_to_mo(mcscf_fock_beta_ao,ao_num,mcscf_fock_beta_mo,mo_num) -END_PROVIDER +END_PROVIDER BEGIN_PROVIDER [ double precision, mcscf_fock_mo, (mo_num,mo_num) ] &BEGIN_PROVIDER [ double precision, mcscf_fock_diag_mo, (mo_num)] @@ -118,13 +148,13 @@ ! |-----------------------| ! | Fcv | F^a | Rvv | ! - ! C: Core, O: Open, V: Virtual - ! + ! C: Core, O: Open, V: Virtual + ! ! Rcc = Acc Fcc^a + Bcc Fcc^b ! Roo = Aoo Foo^a + Boo Foo^b ! Rvv = Avv Fvv^a + Bvv Fvv^b ! Fcv = (F^a + F^b)/2 - ! + ! ! F^a: Fock matrix alpha (MO), F^b: Fock matrix beta (MO) ! A,B: Coupling parameters ! @@ -133,7 +163,7 @@ ! cc oo vv ! A -0.5 0.5 1.5 ! B 1.5 0.5 -0.5 - ! + ! END_DOC integer :: i,j,n if (elec_alpha_num == elec_beta_num) then @@ -194,4 +224,4 @@ do i = 1, mo_num mcscf_fock_diag_mo(i) = mcscf_fock_mo(i,i) enddo -END_PROVIDER +END_PROVIDER From 077f32836b294f4c17d340a48528e1fa2082b9da Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 12:52:33 +0100 Subject: [PATCH 074/175] DGEMV in mcscf_fock --- src/casscf_cipsi/mcscf_fock.irp.f | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/casscf_cipsi/mcscf_fock.irp.f b/src/casscf_cipsi/mcscf_fock.irp.f index 738dee2c..87cc062c 100644 --- a/src/casscf_cipsi/mcscf_fock.irp.f +++ b/src/casscf_cipsi/mcscf_fock.irp.f @@ -13,7 +13,7 @@ ! the inactive Fock matrix do k=1,n_core_inact_orb - kk=list_core_inact_act(k) + kk=list_core_inact(k) ! do q=1,mo_num ! do p=1,mo_num ! do i=1,cholesky_mo_num @@ -21,10 +21,11 @@ ! enddo ! end do ! end do - call dgemm('T','N', mo_num*mo_num, 1, cholesky_mo_num, 2.d0, & + call dgemv('T', cholesky_mo_num, mo_num*mo_num, 2.d0, & cholesky_no_total_transp, cholesky_mo_num, & - cholesky_no_total_transp(1,kk,kk), cholesky_mo_num, 1.d0, & - Fipq, mo_num*mo_num) + cholesky_no_total_transp(1,kk,kk), 1, 1.d0, & + Fipq, 1) + ! do q=1,mo_num ! do p=1,mo_num ! do i=1,cholesky_mo_num @@ -73,10 +74,10 @@ ! enddo ! end do ! end do - call dgemm('T','N', mo_num*mo_num, 1, cholesky_mo_num, occnum(tt), & + call dgemv('T', cholesky_mo_num, mo_num*mo_num, occnum(tt), & cholesky_no_total_transp, cholesky_mo_num, & - cholesky_no_total_transp(1,tt,tt), cholesky_mo_num, 1.d0, & - Fapq, mo_num*mo_num) + cholesky_no_total_transp(1,tt,tt), 1, 1.d0, & + Fapq, 1) ! do q=1,mo_num ! do p=1,mo_num ! do i=1,cholesky_mo_num From 410ed1d5625c2f7837f9b94ea8ac455c8a70bf29 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 14:18:02 +0100 Subject: [PATCH 075/175] Fast 4idx in CASSCF --- src/casscf_cipsi/gradient.irp.f | 59 +++++++------- src/casscf_cipsi/hessian.irp.f | 75 +++++++++--------- src/casscf_cipsi/natorb.irp.f | 106 ++++++-------------------- src/mo_two_e_ints/map_integrals.irp.f | 2 - 4 files changed, 94 insertions(+), 148 deletions(-) diff --git a/src/casscf_cipsi/gradient.irp.f b/src/casscf_cipsi/gradient.irp.f index 961d260d..cd608fb3 100644 --- a/src/casscf_cipsi/gradient.irp.f +++ b/src/casscf_cipsi/gradient.irp.f @@ -14,8 +14,8 @@ implicit none n_c_a_prov = n_core_inact_orb * n_act_orb n_c_v_prov = n_core_inact_orb * n_virt_orb - n_a_v_prov = n_act_orb * n_virt_orb - END_PROVIDER + n_a_v_prov = n_act_orb * n_virt_orb + END_PROVIDER BEGIN_PROVIDER [integer, excit, (2,nMonoEx)] &BEGIN_PROVIDER [character*3, excit_class, (nMonoEx)] @@ -28,7 +28,7 @@ BEGIN_DOC ! a list of the orbitals involved in the excitation END_DOC - + implicit none integer :: i,t,a,ii,tt,aa,indx,indx_tmp indx=0 @@ -48,7 +48,7 @@ mat_idx_c_a(ii,tt) = indx end do end do - + indx_tmp = 0 do ii=1,n_core_inact_orb i=list_core_inact(ii) @@ -61,11 +61,11 @@ indx_tmp += 1 list_idx_c_v(1,indx_tmp) = indx list_idx_c_v(2,indx_tmp) = ii - list_idx_c_v(3,indx_tmp) = aa + list_idx_c_v(3,indx_tmp) = aa mat_idx_c_v(ii,aa) = indx end do end do - + indx_tmp = 0 do tt=1,n_act_orb t=list_act(tt) @@ -82,7 +82,7 @@ mat_idx_a_v(tt,aa) = indx end do end do - + if (bavard) then write(6,*) ' Filled the table of the Monoexcitations ' do indx=1,nMonoEx @@ -90,7 +90,7 @@ ,excit(2,indx),' ',excit_class(indx) end do end if - + END_PROVIDER BEGIN_PROVIDER [real*8, gradvec2, (nMonoEx)] @@ -104,7 +104,7 @@ implicit none integer :: i,t,a,indx real*8 :: gradvec_it,gradvec_ia,gradvec_ta - + indx=0 norm_grad_vec2_tab = 0.d0 do i=1,n_core_inact_orb @@ -114,7 +114,7 @@ norm_grad_vec2_tab(1) += gradvec2(indx)*gradvec2(indx) end do end do - + do i=1,n_core_inact_orb do a=1,n_virt_orb indx+=1 @@ -122,7 +122,7 @@ norm_grad_vec2_tab(2) += gradvec2(indx)*gradvec2(indx) end do end do - + do t=1,n_act_orb do a=1,n_virt_orb indx+=1 @@ -130,7 +130,7 @@ norm_grad_vec2_tab(3) += gradvec2(indx)*gradvec2(indx) end do end do - + norm_grad_vec2=0.d0 do indx=1,nMonoEx norm_grad_vec2+=gradvec2(indx)*gradvec2(indx) @@ -144,7 +144,7 @@ write(6,*) ' Norm of the orbital gradient (via D, P and integrals): ', norm_grad_vec2 write(6,*) endif - + END_PROVIDER real*8 function gradvec_it(i,t) @@ -154,23 +154,30 @@ real*8 function gradvec_it(i,t) END_DOC implicit none integer :: i,t - + integer :: ii,tt,v,vv,x,y integer :: x3,y3 double precision :: bielec_PQxx_no - + ii=list_core_inact(i) tt=list_act(t) gradvec_it=2.D0*(Fipq(tt,ii)+Fapq(tt,ii)) gradvec_it-=occnum(tt)*Fipq(ii,tt) - do v=1,n_act_orb ! active - vv=list_act(v) - do x=1,n_act_orb ! active - x3=x+n_core_inact_orb ! list_act(x) - do y=1,n_act_orb ! active - y3=y+n_core_inact_orb ! list_act(y) + do y=1,n_act_orb ! active +! y3=y+n_core_inact_orb ! list_act(y) + do x=1,n_act_orb ! active +! x3=x+n_core_inact_orb ! list_act(x) + do v=1,n_act_orb ! active + vv=list_act(v) ! Gamma(2) a a a a 1/r12 i a a a - gradvec_it-=2.D0*P0tuvx_no(t,v,x,y)*bielec_PQxx_no(ii,vv,x3,y3) +! gradvec_it-=2.D0*P0tuvx_no(t,v,x,y)*bielec_PQxx_no(ii,vv,x3,y3) + integer :: ichol + double precision :: tmp + tmp = 0.d0 + do ichol=1,cholesky_mo_num + tmp = tmp + cholesky_no_total_transp(ichol,vv,ii) * cholesky_no_total_transp(ichol,list_act(x),list_act(y)) + enddo + gradvec_it = gradvec_it - 2.D0*P0tuvx_no(t,v,x,y)*tmp end do end do end do @@ -183,12 +190,12 @@ real*8 function gradvec_ia(i,a) END_DOC implicit none integer :: i,a,ii,aa - + ii=list_core_inact(i) aa=list_virt(a) gradvec_ia=2.D0*(Fipq(aa,ii)+Fapq(aa,ii)) gradvec_ia*=2.D0 - + end function gradvec_ia real*8 function gradvec_ta(t,a) @@ -198,7 +205,7 @@ real*8 function gradvec_ta(t,a) END_DOC implicit none integer :: t,a,tt,aa,v,vv,x,y - + tt=list_act(t) aa=list_virt(a) gradvec_ta=0.D0 @@ -211,6 +218,6 @@ real*8 function gradvec_ta(t,a) end do end do gradvec_ta*=2.D0 - + end function gradvec_ta diff --git a/src/casscf_cipsi/hessian.irp.f b/src/casscf_cipsi/hessian.irp.f index 1ee073d2..431a6979 100644 --- a/src/casscf_cipsi/hessian.irp.f +++ b/src/casscf_cipsi/hessian.irp.f @@ -11,13 +11,14 @@ real*8 function hessmat_itju(i,t,j,u) integer :: i,t,j,u,ii,tt,uu,v,vv,x,xx,y,jj real*8 :: term,t2 double precision :: bielec_pqxx_no,bielec_pxxq_no - + ii=list_core_inact(i) tt=list_act(t) if (i.eq.j) then if (t.eq.u) then ! diagonal element - term=occnum(tt)*Fipq(ii,ii)+2.D0*(Fipq(tt,tt)+Fapq(tt,tt)) & + term = occnum(tt)*Fipq(ii,ii) + & + 2.D0*(Fipq(tt,tt)+Fapq(tt,tt)) & -2.D0*(Fipq(ii,ii)+Fapq(ii,ii)) term+=2.D0*(3.D0*bielec_pxxq_no(tt,i,i,tt)-bielec_pqxx_no(tt,tt,i,i)) term-=2.D0*occnum(tt)*(3.D0*bielec_pxxq_no(tt,i,i,tt) & @@ -83,10 +84,10 @@ real*8 function hessmat_itju(i,t,j,u) end do end do end if - + term*=2.D0 hessmat_itju=term - + end function hessmat_itju real*8 function hessmat_itja(i,t,j,a) @@ -97,7 +98,7 @@ real*8 function hessmat_itja(i,t,j,a) integer :: i,t,j,a,ii,tt,jj,aa,v,vv,x,y real*8 :: term double precision :: bielec_pqxx_no,bielec_pxxq_no - + ! it/ja ii=list_core_inact(i) tt=list_act(t) @@ -120,7 +121,7 @@ real*8 function hessmat_itja(i,t,j,a) end if term*=2.D0 hessmat_itja=term - + end function hessmat_itja real*8 function hessmat_itua(i,t,u,a) @@ -131,7 +132,7 @@ real*8 function hessmat_itua(i,t,u,a) integer :: i,t,u,a,ii,tt,uu,aa,v,vv,x,xx,u3,t3,v3 real*8 :: term double precision :: bielec_pqxx_no,bielec_pxxq_no - + ii=list_core_inact(i) tt=list_act(t) t3=t+n_core_inact_orb @@ -162,7 +163,7 @@ real*8 function hessmat_itua(i,t,u,a) end if term*=2.D0 hessmat_itua=term - + end function hessmat_itua real*8 function hessmat_iajb(i,a,j,b) @@ -173,7 +174,7 @@ real*8 function hessmat_iajb(i,a,j,b) integer :: i,a,j,b,ii,aa,jj,bb real*8 :: term double precision :: bielec_pqxx_no,bielec_pxxq_no - + ii=list_core_inact(i) aa=list_virt(a) if (i.eq.j) then @@ -199,7 +200,7 @@ real*8 function hessmat_iajb(i,a,j,b) end if term*=2.D0 hessmat_iajb=term - + end function hessmat_iajb real*8 function hessmat_iatb(i,a,t,b) @@ -210,7 +211,7 @@ real*8 function hessmat_iatb(i,a,t,b) integer :: i,a,t,b,ii,aa,tt,bb,v,vv,x,y,v3,t3 real*8 :: term double precision :: bielec_pqxx_no,bielec_pxxq_no - + ii=list_core_inact(i) aa=list_virt(a) tt=list_act(t) @@ -231,7 +232,7 @@ real*8 function hessmat_iatb(i,a,t,b) end if term*=2.D0 hessmat_iatb=term - + end function hessmat_iatb real*8 function hessmat_taub(t,a,u,b) @@ -243,7 +244,7 @@ real*8 function hessmat_taub(t,a,u,b) integer :: v3,x3 real*8 :: term,t1,t2,t3 double precision :: bielec_pqxx_no,bielec_pxxq_no - + tt=list_act(t) aa=list_virt(a) if (t == u) then @@ -311,12 +312,12 @@ real*8 function hessmat_taub(t,a,u,b) end do end do end if - + end if - + term*=2.D0 hessmat_taub=term - + end function hessmat_taub BEGIN_PROVIDER [real*8, hessdiag, (nMonoEx)] @@ -326,7 +327,7 @@ end function hessmat_taub implicit none integer :: i,t,a,indx,indx_shift real*8 :: hessmat_itju,hessmat_iajb,hessmat_taub - + !$OMP PARALLEL DEFAULT(NONE) & !$OMP SHARED(hessdiag,n_core_inact_orb,n_act_orb,n_virt_orb,nMonoEx) & !$OMP PRIVATE(i,indx,t,a,indx_shift) @@ -339,9 +340,9 @@ end function hessmat_taub end do end do !$OMP END DO NOWAIT - + indx_shift = n_core_inact_orb*n_act_orb - !$OMP DO + !$OMP DO do a=1,n_virt_orb do i=1,n_core_inact_orb indx = a + (i-1)*n_virt_orb + indx_shift @@ -349,9 +350,9 @@ end function hessmat_taub end do end do !$OMP END DO NOWAIT - + indx_shift += n_core_inact_orb*n_virt_orb - !$OMP DO + !$OMP DO do a=1,n_virt_orb do t=1,n_act_orb indx = a + (t-1)*n_virt_orb + indx_shift @@ -360,7 +361,7 @@ end function hessmat_taub end do !$OMP END DO !$OMP END PARALLEL - + END_PROVIDER @@ -377,7 +378,7 @@ end function hessmat_taub real*8 :: hessmat_taub ! c-a c-v a-v ! c-a | X X X - ! c-v | X X + ! c-v | X X ! a-v | X provide all_mo_integrals @@ -390,12 +391,12 @@ end function hessmat_taub !$OMP DO !!!! < Core-active| H |Core-active > - ! Core-active excitations + ! Core-active excitations do indx_tmp = 1, n_c_a_prov indx = list_idx_c_a(1,indx_tmp) i = list_idx_c_a(2,indx_tmp) t = list_idx_c_a(3,indx_tmp) - ! Core-active excitations + ! Core-active excitations do j = 1, n_core_inact_orb if (i.eq.j) then ustart=t @@ -418,12 +419,12 @@ end function hessmat_taub !$OMP DO !!!! < Core-active| H |Core-VIRTUAL > - ! Core-active excitations + ! Core-active excitations do indx_tmp = 1, n_c_a_prov indx = list_idx_c_a(1,indx_tmp) i = list_idx_c_a(2,indx_tmp) t = list_idx_c_a(3,indx_tmp) - ! Core-VIRTUAL excitations + ! Core-VIRTUAL excitations do jndx_tmp = 1, n_c_v_prov jndx = list_idx_c_v(1,jndx_tmp) j = list_idx_c_v(2,jndx_tmp) @@ -441,12 +442,12 @@ end function hessmat_taub !$OMP DO !!!! < Core-active| H |ACTIVE-VIRTUAL > - ! Core-active excitations + ! Core-active excitations do indx_tmp = 1, n_c_a_prov indx = list_idx_c_a(1,indx_tmp) i = list_idx_c_a(2,indx_tmp) t = list_idx_c_a(3,indx_tmp) - ! ACTIVE-VIRTUAL excitations + ! ACTIVE-VIRTUAL excitations do jndx_tmp = 1, n_a_v_prov jndx = list_idx_a_v(1,jndx_tmp) u = list_idx_a_v(2,jndx_tmp) @@ -466,12 +467,12 @@ end function hessmat_taub !$OMP PRIVATE(indx_tmp,indx,i,a,j,b,bstart,jndx) !$OMP DO !!!!! < Core-VIRTUAL | H |Core-VIRTUAL > - ! Core-VIRTUAL excitations + ! Core-VIRTUAL excitations do indx_tmp = 1, n_c_v_prov indx = list_idx_c_v(1,indx_tmp) i = list_idx_c_v(2,indx_tmp) a = list_idx_c_v(3,indx_tmp) - ! Core-VIRTUAL excitations + ! Core-VIRTUAL excitations do j = 1, n_core_inact_orb if (i.eq.j) then bstart=a @@ -485,7 +486,7 @@ end function hessmat_taub enddo enddo enddo - + !$OMP END DO NOWAIT !$OMP END PARALLEL endif @@ -496,12 +497,12 @@ end function hessmat_taub !$OMP DO !!!! < Core-VIRTUAL | H |Active-VIRTUAL > - ! Core-VIRTUAL excitations + ! Core-VIRTUAL excitations do indx_tmp = 1, n_c_v_prov indx = list_idx_c_v(1,indx_tmp) i = list_idx_c_v(2,indx_tmp) a = list_idx_c_v(3,indx_tmp) - ! Active-VIRTUAL excitations + ! Active-VIRTUAL excitations do jndx_tmp = 1, n_a_v_prov jndx = list_idx_a_v(1,jndx_tmp) t = list_idx_a_v(2,jndx_tmp) @@ -520,12 +521,12 @@ end function hessmat_taub !$OMP DO !!!! < Active-VIRTUAL | H |Active-VIRTUAL > - ! Active-VIRTUAL excitations + ! Active-VIRTUAL excitations do indx_tmp = 1, n_a_v_prov indx = list_idx_a_v(1,indx_tmp) t = list_idx_a_v(2,indx_tmp) a = list_idx_a_v(3,indx_tmp) - ! Active-VIRTUAL excitations + ! Active-VIRTUAL excitations do u=t,n_act_orb if (t.eq.u) then bstart=a @@ -542,4 +543,4 @@ end function hessmat_taub !$OMP END DO NOWAIT !$OMP END PARALLEL -END_PROVIDER +END_PROVIDER diff --git a/src/casscf_cipsi/natorb.irp.f b/src/casscf_cipsi/natorb.irp.f index 9ce90304..6376308d 100644 --- a/src/casscf_cipsi/natorb.irp.f +++ b/src/casscf_cipsi/natorb.irp.f @@ -72,84 +72,27 @@ BEGIN_DOC ! 4-index transformation of 2part matrices END_DOC - integer :: i,j,k,l,p,q - real*8 :: d(n_act_orb) - - ! index per index - ! first quarter - P0tuvx_no(:,:,:,:) = P0tuvx(:,:,:,:) - - do j=1,n_act_orb - do k=1,n_act_orb - do l=1,n_act_orb - do p=1,n_act_orb - d(p)=0.D0 - end do - do p=1,n_act_orb - do q=1,n_act_orb - d(p)+=P0tuvx_no(q,j,k,l)*natorbsCI(q,p) - end do - end do - do p=1,n_act_orb - P0tuvx_no(p,j,k,l)=d(p) - end do - end do - end do - end do - ! 2nd quarter - do j=1,n_act_orb - do k=1,n_act_orb - do l=1,n_act_orb - do p=1,n_act_orb - d(p)=0.D0 - end do - do p=1,n_act_orb - do q=1,n_act_orb - d(p)+=P0tuvx_no(j,q,k,l)*natorbsCI(q,p) - end do - end do - do p=1,n_act_orb - P0tuvx_no(j,p,k,l)=d(p) - end do - end do - end do - end do - ! 3rd quarter - do j=1,n_act_orb - do k=1,n_act_orb - do l=1,n_act_orb - do p=1,n_act_orb - d(p)=0.D0 - end do - do p=1,n_act_orb - do q=1,n_act_orb - d(p)+=P0tuvx_no(j,k,q,l)*natorbsCI(q,p) - end do - end do - do p=1,n_act_orb - P0tuvx_no(j,k,p,l)=d(p) - end do - end do - end do - end do - ! 4th quarter - do j=1,n_act_orb - do k=1,n_act_orb - do l=1,n_act_orb - do p=1,n_act_orb - d(p)=0.D0 - end do - do p=1,n_act_orb - do q=1,n_act_orb - d(p)+=P0tuvx_no(j,k,l,q)*natorbsCI(q,p) - end do - end do - do p=1,n_act_orb - P0tuvx_no(j,k,l,p)=d(p) - end do - end do - end do - end do + + double precision, allocatable :: tmp(:,:,:,:) + allocate(tmp(n_act_orb,n_act_orb,n_act_orb,n_act_orb)) + + call dgemm('T','N',(n_act_orb*n_act_orb*n_act_orb), n_act_orb, n_act_orb, 1.d0, & + P0tuvx, n_act_orb, natorbsCI, n_act_orb, 0.d0, & + tmp, (n_act_orb*n_act_orb*n_act_orb)) + + call dgemm('T','N',(n_act_orb*n_act_orb*n_act_orb), n_act_orb, n_act_orb, 1.d0, & + tmp, n_act_orb, natorbsCI, n_act_orb, 0.d0, & + P0tuvx_no, (n_act_orb*n_act_orb*n_act_orb)) + + call dgemm('T','N',(n_act_orb*n_act_orb*n_act_orb), n_act_orb, n_act_orb, 1.d0, & + P0tuvx_no, n_act_orb, natorbsCI, n_act_orb, 0.d0, & + tmp, (n_act_orb*n_act_orb*n_act_orb)) + + call dgemm('T','N',(n_act_orb*n_act_orb*n_act_orb), n_act_orb, n_act_orb, 1.d0, & + tmp, n_act_orb, natorbsCI, n_act_orb, 0.d0, & + P0tuvx_no, (n_act_orb*n_act_orb*n_act_orb)) + + deallocate(tmp) END_PROVIDER @@ -160,6 +103,7 @@ BEGIN_DOC ! Transformed one-e integrals END_DOC + integer :: i,j, p, q real*8 :: d(n_act_orb) one_ints_no(:,:)=mo_one_e_integrals(:,:) @@ -168,10 +112,8 @@ do j=1,mo_num do p=1,n_act_orb d(p)=0.D0 - end do - do p=1,n_act_orb do q=1,n_act_orb - d(p)+=one_ints_no(list_act(q),j)*natorbsCI(q,p) + d(p) = d(p) + one_ints_no(list_act(q),j)*natorbsCI(q,p) end do end do do p=1,n_act_orb @@ -183,8 +125,6 @@ do j=1,mo_num do p=1,n_act_orb d(p)=0.D0 - end do - do p=1,n_act_orb do q=1,n_act_orb d(p)+=one_ints_no(j,list_act(q))*natorbsCI(q,p) end do diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index b5f78b7b..5a005d7b 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -86,10 +86,8 @@ subroutine insert_into_mo_integrals_map(n_integrals, & call set_multiple_levels_omp(.False.) - !$OMP PARALLEL DO PRIVATE(k,l,ii) SCHEDULE(dynamic) do l=mo_integrals_cache_min,mo_integrals_cache_max - print *, l do k=mo_integrals_cache_min,mo_integrals_cache_max ii = int(l-mo_integrals_cache_min,8) ii = ior( shiftl(ii,mo_integrals_cache_shift), int(k-mo_integrals_cache_min,8)) From 8975617bf27e55f54d33c473a4c2ab927b6a9719 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 15:45:26 +0100 Subject: [PATCH 076/175] Dgemmized hessmat_taub --- src/casscf_cipsi/hessian.irp.f | 173 ++++++++++++++++++++++++++------- 1 file changed, 138 insertions(+), 35 deletions(-) diff --git a/src/casscf_cipsi/hessian.irp.f b/src/casscf_cipsi/hessian.irp.f index 431a6979..1bcb64b0 100644 --- a/src/casscf_cipsi/hessian.irp.f +++ b/src/casscf_cipsi/hessian.irp.f @@ -241,73 +241,176 @@ real*8 function hessmat_taub(t,a,u,b) END_DOC implicit none integer :: t,a,u,b,tt,aa,uu,bb,v,vv,x,xx,y - integer :: v3,x3 - real*8 :: term,t1,t2,t3 + integer :: v3,x3, ichol + real*8 :: term,t1,t2,t3, tmp double precision :: bielec_pqxx_no,bielec_pxxq_no + double precision, allocatable :: tmp1(:), tmp2(:,:) + allocate(tmp1(n_act_orb)) + allocate(tmp2(n_act_orb,n_act_orb)) + tt=list_act(t) aa=list_virt(a) + if (t == u) then if (a == b) then ! ta/ta - t1=occnum(tt)*Fipq(aa,aa) + t1=occnum(tt)*Fipq(aa,aa) - occnum(tt)*Fipq(tt,tt) + t2=0.D0 - t3=0.D0 - t1-=occnum(tt)*Fipq(tt,tt) +! do x=1,n_act_orb +! x3=x+n_core_inact_orb +! do v=1,n_act_orb +! v3=v+n_core_inact_orb +! tmp = 0.d0 +! do ichol = 1, cholesky_mo_num +! tmp = tmp + cholesky_no_total_transp(ichol,aa,aa) * cholesky_no_total_transp(ichol,v3,x3) +! enddo +! t2 = t2 + 2.D0*P0tuvx_no(t,t,v,x)*tmp +! enddo +! enddo + + do x=1,n_act_orb + x3=x+n_core_inact_orb + call dgemv('T', cholesky_mo_num, n_act_orb, 2.d0, & + cholesky_no_total_transp(1,n_core_inact_orb+1,x3), cholesky_mo_num, & + cholesky_no_total_transp(1,aa,aa), 1, 0.d0, & + tmp1, 1) + do v=1,n_act_orb + t2 = t2 + P0tuvx_no(t,t,v,x)*tmp1(v) + enddo + enddo +! do v=1,n_act_orb +! v3=v+n_core_inact_orb +! do x=1,n_act_orb +! x3=x+n_core_inact_orb +! tmp = 0.d0 +! do ichol = 1, cholesky_mo_num +! tmp = tmp + cholesky_no_total_transp(ichol,aa,x3) * cholesky_no_total_transp(ichol,v3,aa) +! enddo +! t2 = t2 + 2.d0*(P0tuvx_no(t,x,v,t)+P0tuvx_no(t,x,t,v))*tmp +! end do +! end do + call dgemm('T','N', n_act_orb, n_act_orb, cholesky_mo_num, 2.d0, & + cholesky_no_total_transp(1,n_core_inact_orb+1,aa), cholesky_mo_num, & + cholesky_no_total_transp(1,n_core_inact_orb+1,aa), cholesky_mo_num, 0.d0, & + tmp2, n_act_orb) do v=1,n_act_orb - vv=list_act(v) - v3=v+n_core_inact_orb do x=1,n_act_orb - xx=list_act(x) - x3=x+n_core_inact_orb - t2+=2.D0*(P0tuvx_no(t,t,v,x)*bielec_pqxx_no(aa,aa,v3,x3) & - +(P0tuvx_no(t,x,v,t)+P0tuvx_no(t,x,t,v))* & - bielec_pxxq_no(aa,x3,v3,aa)) - do y=1,n_act_orb - t3-=2.D0*P0tuvx_no(t,v,x,y)*bielecCI_no(t,v,y,xx) + t2 = t2 + P0tuvx_no(t,x,v,t)*tmp2(x,v) + P0tuvx_no(t,x,t,v)*tmp2(x,v) + enddo + enddo + + t3=0.D0 + do x=1,n_act_orb + xx=list_act(x) + do y=1,n_act_orb + do v=1,n_act_orb + t3 = t3 - P0tuvx_no(t,v,x,y)*bielecCI_no(v,t,y,xx) end do end do end do - term=t1+t2+t3 + term=t1+t2+t3*2.d0 + else + bb=list_virt(b) ! ta/tb b/=a term=occnum(tt)*Fipq(aa,bb) +! do v=1,n_act_orb +! vv=list_act(v) +! v3=v+n_core_inact_orb +! do x=1,n_act_orb +! xx=list_act(x) +! x3=x+n_core_inact_orb +! term+=2.D0*P0tuvx_no(t,t,v,x)*bielec_pqxx_no(aa,bb,v3,x3) +! end do +! end do + do x=1,n_act_orb + x3=x+n_core_inact_orb + call dgemv('T', cholesky_mo_num, n_act_orb, 2.d0, & + cholesky_no_total_transp(1,n_core_inact_orb+1,x3), cholesky_mo_num, & + cholesky_no_total_transp(1,aa,bb), 1, 0.d0, & + tmp1, 1) + do v=1,n_act_orb + term = term + P0tuvx_no(t,t,v,x)*tmp1(v) + enddo + enddo + +! do v=1,n_act_orb +! vv=list_act(v) +! v3=v+n_core_inact_orb +! do x=1,n_act_orb +! xx=list_act(x) +! x3=x+n_core_inact_orb +! term+=2.d0*(P0tuvx_no(t,x,v,t)+P0tuvx_no(t,x,t,v))*bielec_pxxq_no(aa,x3,v3,bb) +! end do +! end do + call dgemm('T','N', n_act_orb, n_act_orb, cholesky_mo_num, 2.d0, & + cholesky_no_total_transp(1,n_core_inact_orb+1,aa), cholesky_mo_num, & + cholesky_no_total_transp(1,n_core_inact_orb+1,bb), cholesky_mo_num, 0.d0, & + tmp2, n_act_orb) do v=1,n_act_orb - vv=list_act(v) - v3=v+n_core_inact_orb do x=1,n_act_orb - xx=list_act(x) - x3=x+n_core_inact_orb - term+=2.D0*(P0tuvx_no(t,t,v,x)*bielec_pqxx_no(aa,bb,v3,x3) & - +(P0tuvx_no(t,x,v,t)+P0tuvx_no(t,x,t,v)) & - *bielec_pxxq_no(aa,x3,v3,bb)) - end do - end do + term = term + P0tuvx_no(t,x,v,t)*tmp2(x,v) + P0tuvx_no(t,x,t,v)*tmp2(x,v) + enddo + enddo + end if + else + ! ta/ub t/=u uu=list_act(u) bb=list_virt(b) + term=0.D0 +! do v=1,n_act_orb +! vv=list_act(v) +! v3=v+n_core_inact_orb +! do x=1,n_act_orb +! xx=list_act(x) +! x3=x+n_core_inact_orb +! term+=2.D0*(P0tuvx_no(t,u,v,x)*bielec_pqxx_no(aa,bb,v3,x3) +! end do +! end do + do x=1,n_act_orb + x3=x+n_core_inact_orb + call dgemv('T', cholesky_mo_num, n_act_orb, 2.d0, & + cholesky_no_total_transp(1,n_core_inact_orb+1,x3), cholesky_mo_num, & + cholesky_no_total_transp(1,aa,bb), 1, 0.d0, & + tmp1, 1) + do v=1,n_act_orb + term = term + P0tuvx_no(t,u,v,x)*tmp1(v) + enddo + enddo + +! do v=1,n_act_orb +! vv=list_act(v) +! v3=v+n_core_inact_orb +! do x=1,n_act_orb +! xx=list_act(x) +! x3=x+n_core_inact_orb +! term+=2.D0*(P0tuvx_no(t,x,v,u)+P0tuvx_no(t,x,u,v))*bielec_pxxq_no(aa,x3,v3,bb) +! end do +! end do + call dgemm('T','N', n_act_orb, n_act_orb, cholesky_mo_num, 2.d0, & + cholesky_no_total_transp(1,n_core_inact_orb+1,aa), cholesky_mo_num, & + cholesky_no_total_transp(1,n_core_inact_orb+1,bb), cholesky_mo_num, 0.d0, & + tmp2, n_act_orb) do v=1,n_act_orb - vv=list_act(v) - v3=v+n_core_inact_orb do x=1,n_act_orb - xx=list_act(x) - x3=x+n_core_inact_orb - term+=2.D0*(P0tuvx_no(t,u,v,x)*bielec_pqxx_no(aa,bb,v3,x3) & - +(P0tuvx_no(t,x,v,u)+P0tuvx_no(t,x,u,v)) & - *bielec_pxxq_no(aa,x3,v3,bb)) - end do - end do + term = term + P0tuvx_no(t,x,v,u)*tmp2(x,v)+P0tuvx_no(t,x,u,v)*tmp2(x,v) + enddo + enddo + if (a.eq.b) then term-=0.5D0*(occnum(tt)*Fipq(uu,tt)+occnum(uu)*Fipq(tt,uu)) do v=1,n_act_orb do y=1,n_act_orb do x=1,n_act_orb - term-=P0tuvx_no(t,v,x,y)*bielecCI_no(x,y,v,uu) - term-=P0tuvx_no(u,v,x,y)*bielecCI_no(x,y,v,tt) + term = term - P0tuvx_no(t,v,x,y)*bielecCI_no(x,y,v,uu) & + - P0tuvx_no(u,v,x,y)*bielecCI_no(x,y,v,tt) end do end do end do From 4ecb15a727373d6a29f122dc165babaed237ffe9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2025 19:17:43 +0100 Subject: [PATCH 077/175] Trying to fix Davidson in CASSCF --- src/dav_general_mat/dav_general.irp.f | 41 ++++++++++++--------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/src/dav_general_mat/dav_general.irp.f b/src/dav_general_mat/dav_general.irp.f index a277d9ef..114476c2 100644 --- a/src/dav_general_mat/dav_general.irp.f +++ b/src/dav_general_mat/dav_general.irp.f @@ -82,7 +82,7 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv nproc_target = nproc double precision :: rss integer :: maxab - maxab = sze + maxab = sze m=1 disk_based = .False. @@ -204,7 +204,7 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv u_in(i,k) = r1*dcos(r2) enddo enddo - ! Normalize all states + ! Normalize all states do k=1,N_st_diag call normalize(u_in(:,k),sze) enddo @@ -228,20 +228,13 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv shift = N_st_diag*(iter-1) shift2 = N_st_diag*iter - if ((iter > 1).or.(itertot == 1)) then - ! Compute |W_k> = \sum_i |i> - ! ----------------------------------- + ! Compute |W_k> = \sum_i |i> + ! ----------------------------------- - ! Gram-Smitt to orthogonalize all new guess with the previous vectors - call ortho_qr(U,size(U,1),sze,shift2) - call ortho_qr(U,size(U,1),sze,shift2) + ! Gram-Smitt to orthogonalize all new guess with the previous vectors + call ortho_qr(U,size(U,1),sze,shift2) -! call H_S2_u_0_nstates_openmp(W(:,shift+1),U(:,shift+1),N_st_diag,sze) - call hpsi(W(:,shift+1),U(:,shift+1),N_st_diag,sze,h_mat) - else - ! Already computed in update below - continue - endif + call hpsi(W(:,shift+1),U(:,shift+1),N_st_diag,sze,h_mat) ! Compute h_kl = = ! ------------------------------------------- @@ -311,12 +304,12 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv do i=1,sze U(i,shift2+k) = & (lambda(k) * U(i,shift2+k) - W(i,shift2+k) ) & - /max(H_jj(i) - lambda (k),1.d-2) + /max(dabs(H_jj(i) - lambda (k)),1.d-2) * dsign(1d0,H_jj(i) - lambda (k)) enddo if (k <= N_st) then residual_norm(k) = u_dot_u(U(:,shift2+k),sze) - to_print(1,k) = lambda(k) + to_print(1,k) = lambda(k) to_print(2,k) = residual_norm(k) endif enddo @@ -324,7 +317,7 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv if ((itertot>1).and.(iter == 1)) then - !don't print + !don't print continue else write(*,'(1X,I3,1X,100(1X,F16.10,1X,F11.6,1X,ES11.3))') iter-1, to_print(1:2,1:N_st) @@ -333,11 +326,11 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv ! Check convergence if (iter > 1) then converged = dabs(maxval(residual_norm(1:N_st))) < threshold_davidson - endif - + endif + do k=1,N_st - if (residual_norm(k) > 1.e8) then + if (residual_norm(k) > 1.d8) then print *, 'Davidson failed' stop -1 endif @@ -365,13 +358,15 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv call dgemm('N','N', sze, N_st_diag, shift2, 1.d0, & U, size(U,1), y, size(y,1), 0.d0, u_in, size(u_in,1)) + do k=1,N_st_diag do i=1,sze U(i,k) = u_in(i,k) enddo enddo - call ortho_qr(U,size(U,1),sze,N_st_diag) - call ortho_qr(U,size(U,1),sze,N_st_diag) + + call ortho_qr(U,size(U,1),sze,N_st_diag) + do j=1,N_st_diag k=1 do while ((k Date: Fri, 7 Feb 2025 18:38:52 +0100 Subject: [PATCH 078/175] added mo_in_r on extra grid --- src/dft_utils_in_r/ao_in_r.irp.f | 6 ++--- src/dft_utils_in_r/mo_in_r.irp.f | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/dft_utils_in_r/ao_in_r.irp.f b/src/dft_utils_in_r/ao_in_r.irp.f index e9c003d4..c8822776 100644 --- a/src/dft_utils_in_r/ao_in_r.irp.f +++ b/src/dft_utils_in_r/ao_in_r.irp.f @@ -185,9 +185,9 @@ END_PROVIDER BEGIN_PROVIDER[double precision, aos_in_r_array_extra, (ao_num,n_points_extra_final_grid)] - implicit none + implicit none BEGIN_DOC - ! aos_in_r_array_extra(i,j) = value of the ith ao on the jth grid point + ! aos_in_r_array_extra(i,j) = value of the ith ao on the jth grid point of the EXTRA grid END_DOC integer :: i,j double precision :: aos_array(ao_num), r(3) @@ -214,7 +214,7 @@ BEGIN_PROVIDER[double precision, aos_in_r_array_extra_transp, (n_points_extra_final_grid,ao_num)] BEGIN_DOC - ! aos_in_r_array_extra_transp(i,j) = value of the jth ao on the ith grid point + ! aos_in_r_array_extra_transp(i,j) = value of the jth ao on the ith grid point of the EXTRA grid END_DOC implicit none diff --git a/src/dft_utils_in_r/mo_in_r.irp.f b/src/dft_utils_in_r/mo_in_r.irp.f index ad931402..623de4f8 100644 --- a/src/dft_utils_in_r/mo_in_r.irp.f +++ b/src/dft_utils_in_r/mo_in_r.irp.f @@ -181,3 +181,44 @@ END_PROVIDER + +!!!!!EXTRA GRID + + BEGIN_PROVIDER[double precision, mos_in_r_array_extra_omp, (mo_num,n_points_extra_final_grid)] + implicit none + BEGIN_DOC + ! mos_in_r_array_extra(i,j) = value of the ith mo on the jth grid point on the EXTRA GRID + END_DOC + integer :: i,j + double precision :: mos_array_extra(mo_num), r(3) + print*,'coucou' + !$OMP PARALLEL DO & + !$OMP DEFAULT (NONE) & + !$OMP PRIVATE (i,r,mos_array_extra,j) & + !$OMP SHARED(mos_in_r_array_extra_omp,n_points_extra_final_grid,mo_num,final_grid_points_extra) + do i = 1, n_points_extra_final_grid + r(1) = final_grid_points_extra(1,i) + r(2) = final_grid_points_extra(2,i) + r(3) = final_grid_points_extra(3,i) + call give_all_mos_at_r(r,mos_array_extra) + do j = 1, mo_num + mos_in_r_array_extra_omp(j,i) = mos_array_extra(j) + enddo + enddo + !$OMP END PARALLEL DO + print*,'coucou fin' + END_PROVIDER + + + BEGIN_PROVIDER[double precision, mos_in_r_array_extra_transp,(n_points_extra_final_grid,mo_num)] + implicit none + BEGIN_DOC + ! mos_in_r_array_extra_transp(i,j) = value of the jth mo on the ith grid point + END_DOC + integer :: i,j + do i = 1, n_points_extra_final_grid + do j = 1, mo_num + mos_in_r_array_extra_transp(i,j) = mos_in_r_array_extra_omp(j,i) + enddo + enddo + END_PROVIDER From fe9ea75ae79a5c7b641733c27d0801aeb4bf3af5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 11 Feb 2025 19:02:00 +0100 Subject: [PATCH 079/175] Added Spd module in OCaml --- bin/qp_convert_output_to_ezfio | 3 +-- ocaml/Angmom.ml | 31 ++++++++++++++++++++++++--- ocaml/Angmom.mli | 25 +++++++++++++++++++-- ocaml/Long_basis.ml | 4 ++-- src/mo_two_e_ints/map_integrals.irp.f | 1 - src/scf_utils/roothaan_hall_scf.irp.f | 2 +- 6 files changed, 55 insertions(+), 11 deletions(-) diff --git a/bin/qp_convert_output_to_ezfio b/bin/qp_convert_output_to_ezfio index 6f2d02d0..95822770 100755 --- a/bin/qp_convert_output_to_ezfio +++ b/bin/qp_convert_output_to_ezfio @@ -154,8 +154,7 @@ def write_ezfio(res, filename): prim_num_max = ezfio.get_ao_basis_ao_prim_num_max() for i in range(len(res.basis)): - coefficient[ - i] += [0. for j in range(len(coefficient[i]), prim_num_max)] + coefficient[i] += [0. for j in range(len(coefficient[i]), prim_num_max)] exponent[i] += [0. for j in range(len(exponent[i]), prim_num_max)] coefficient = reduce(lambda x, y: x + y, coefficient, []) diff --git a/ocaml/Angmom.ml b/ocaml/Angmom.ml index 2da09340..4e315a95 100644 --- a/ocaml/Angmom.ml +++ b/ocaml/Angmom.ml @@ -77,6 +77,7 @@ module Xyz = struct type t = { x: Positive_int.t ; y: Positive_int.t ; z: Positive_int.t } [@@deriving sexp] + type state_type = Null | X | Y | Z (** Builds an XYZ triplet from a string. @@ -147,8 +148,8 @@ module Xyz = struct in Positive_int.of_int (x+y+z) - (** Returns a list of XYZ powers for a given symmetry *) - let of_symmetry sym = + (** Returns a list of XYZ powers for a given angular momentum *) + let of_angmom sym = let l = Positive_int.to_int (to_l sym) in let create_z xyz = { x=xyz.x ; @@ -179,7 +180,31 @@ module Xyz = struct |> List.rev - (** Returns the symmetry corresponding to the XYZ triplet *) + (** Returns the angular momentum corresponding to the XYZ triplet *) + let to_symmetry sym = of_l (get_l sym) + +end + +module Spd = struct + type t = { l: st; m: int } [@@deriving sexp] + + let to_string { l ; m } = + (to_string l) ^ " " ^ (if m > 0 then "+" else "") ^ (string_of_int m) + + let of_string s = match String_ext.lsplit2 ~on:' ' s with + | Some (l, m) -> { l=of_string l ; m=int_of_string m } + | _ -> failwith ("Invalid Spd: "^s) + + (** Returns the l quantum number from a XYZ powers triplet *) + let get_l { l ; _ } = to_l l + + (** Returns a list of XYZ powers for a given angular momentum *) + let of_angmom sym = + let l = Positive_int.to_int (to_l sym) in + Array.init (2*l+1) (fun i -> { l=sym ; m=i-l }) + |> Array.to_list + + (** Returns the angular momentum corresponding to the XYZ triplet *) let to_symmetry sym = of_l (get_l sym) end diff --git a/ocaml/Angmom.mli b/ocaml/Angmom.mli index 2ab63003..006717aa 100644 --- a/ocaml/Angmom.mli +++ b/ocaml/Angmom.mli @@ -28,9 +28,30 @@ module Xyz : val get_l : t -> Qptypes.Positive_int.t (** Returns a list of XYZ powers for a given symmetry *) - val of_symmetry : st -> t list + val of_angmom : st -> t list (** Returns the symmetry corresponding to the XYZ powers *) val to_symmetry : t -> st - end +end + + +module Spd : + sig + type t = { l: st; m: int } [@@deriving sexp] + + (** The string format contains the l and m quantum numbers *) + + val of_string : string -> t + val to_string : t -> string + + (** Returns the quantum number l *) + val get_l : t -> Qptypes.Positive_int.t + + (** Returns a list of XYZ powers for a given symmetry *) + val of_angmom : st -> t list + + (** Returns the symmetry corresponding to the XYZ powers *) + val to_symmetry : t -> st + +end diff --git a/ocaml/Long_basis.ml b/ocaml/Long_basis.ml index a8ea3c66..96f7566b 100644 --- a/ocaml/Long_basis.ml +++ b/ocaml/Long_basis.ml @@ -10,7 +10,7 @@ let of_basis b = | (g,n)::tail -> begin let new_accu = - Angmom.Xyz.of_symmetry g.Gto.sym + Angmom.Xyz.of_angmom g.Gto.sym |> List.rev_map (fun x-> (x,g,n)) in do_work (new_accu@accu) tail @@ -25,7 +25,7 @@ let to_basis b = | [] -> List.rev accu | (s,g,n)::tail -> let first_sym = - Angmom.Xyz.of_symmetry g.Gto.sym + Angmom.Xyz.of_angmom g.Gto.sym |> List.hd in let new_accu = diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index b5f78b7b..c95a8f44 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -89,7 +89,6 @@ subroutine insert_into_mo_integrals_map(n_integrals, & !$OMP PARALLEL DO PRIVATE(k,l,ii) SCHEDULE(dynamic) do l=mo_integrals_cache_min,mo_integrals_cache_max - print *, l do k=mo_integrals_cache_min,mo_integrals_cache_max ii = int(l-mo_integrals_cache_min,8) ii = ior( shiftl(ii,mo_integrals_cache_shift), int(k-mo_integrals_cache_min,8)) diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index 9e2ca4bc..4ba0964a 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -70,7 +70,7 @@ subroutine Roothaan_Hall_SCF dim_DIIS = min(dim_DIIS+1,max_dim_DIIS) - if ( (scf_algorithm == 'DIIS').and.(dabs(Delta_energy_SCF) > 1.d-6) ) then + if ( (scf_algorithm == 'DIIS').and.(dabs(Delta_energy_SCF) > 1.d-10) ) then ! Store Fock and error matrices at each iteration do j=1,ao_num From 9d2a2ee754b69972fe38ae8e4190bfa2df268ea5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 Feb 2025 12:01:04 +0100 Subject: [PATCH 080/175] Introducing trexion convention --- bin/qp_convert_output_to_ezfio | 2 + external/ezfio | 2 +- ocaml/qp_create_ezfio.ml | 1 + scripts/qp_import_trexio.py | 16 +++-- src/ao_basis/aos.irp.f | 90 ++++++++++++++++++------- src/basis/EZFIO.cfg | 1 - src/basis/basis.irp.f | 69 ------------------- src/trexio/export_trexio_routines.irp.f | 35 ++++++---- 8 files changed, 100 insertions(+), 116 deletions(-) diff --git a/bin/qp_convert_output_to_ezfio b/bin/qp_convert_output_to_ezfio index 95822770..9c0441b8 100755 --- a/bin/qp_convert_output_to_ezfio +++ b/bin/qp_convert_output_to_ezfio @@ -44,6 +44,7 @@ def write_ezfio(res, filename): res.clean_uncontractions() ezfio.set_file(filename) + ezfio.set_ezfio_files_ezfio_convention(20250211) # _ # |_ | _ _ _|_ ._ _ ._ _ @@ -172,6 +173,7 @@ def write_ezfio(res, filename): # ~#~#~#~#~ # ezfio.set_ao_basis_ao_coef(coef) + ezfio.set_basis_ao_normalized(True) ezfio.set_ao_basis_ao_expo(expo) ezfio.set_ao_basis_ao_basis("Read by resultsFile") diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index 4e17c0ad..ad8d44ca 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -265,6 +265,7 @@ let run ?o b au c d m p cart xyz_file = let write_file () = (* Create EZFIO *) Ezfio.set_file ezfio_file; + Ezfio.set_files_ezfio_ezfio_convention 20250211; (* Write Pseudo *) let pseudo = diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 23f48eef..a515efba 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -84,6 +84,7 @@ def write_ezfio(trexio_filename, filename): ezfio.set_file(filename) ezfio.set_trexio_trexio_file(trexio_filename) + ezfio.set_ezfio_files_ezfio_convention(20250211) print("Nuclei\t\t...\t", end=' ') @@ -315,8 +316,8 @@ def write_ezfio(trexio_filename, filename): power_x.append(x) power_y.append(y) power_z.append(z) - coefficient.append(coef[i]) - exponent.append(expo[i]) + coefficient.append(list(coef[i])) + exponent.append(list(expo[i])) num_prim.append(num_prim0[i]) assert (len(coefficient) == ao_num) @@ -326,15 +327,15 @@ def write_ezfio(trexio_filename, filename): prim_num_max = max( [ len(x) for x in coefficient ] ) - ao_normalization = trexio.read_ao_normalization(trexio_file_cart) - for i, coef in enumerate(coefficient): - for j in range(len(coef)): - coef[j] *= ao_normalization[i] - for i in range(ao_num): coefficient[i] += [0. for j in range(len(coefficient[i]), prim_num_max)] exponent [i] += [0. for j in range(len(exponent[i]), prim_num_max)] + ao_normalization = trexio.read_ao_normalization(trexio_file_cart) + for i in range(ao_num): + for j in range(prim_num_max): + coefficient[i][j] *= ao_normalization[i] + coefficient = reduce(lambda x, y: x + y, coefficient, []) exponent = reduce(lambda x, y: x + y, exponent , []) @@ -345,6 +346,7 @@ def write_ezfio(trexio_filename, filename): coef.append(coefficient[j]) expo.append(exponent[j]) + ezfio.set_ao_basis_ao_coef(coef) ezfio.set_ao_basis_ao_expo(expo) diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index d718e935..440cc865 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -53,42 +53,84 @@ C_A(3) = 0.d0 ao_coef_normalized = 0.d0 - do i=1,ao_num - - powA(1) = ao_power(i,1) - powA(2) = ao_power(i,2) - powA(3) = ao_power(i,3) - - ! Normalization of the primitives - if (primitives_normalized) then - do j=1,ao_prim_num(i) - call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j), & - powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) - ao_coef_normalized(i,j) = ao_coef(i,j)/dsqrt(norm) + if (primitives_normalized) then + + if (ezfio_convention >= 20250211) then + ! Same primitive normalization factors for all AOs of the same shell, or read from trexio file + + do i=1,ao_num + k=1 + do while (k<=prim_num .and. shell_index(k) /= ao_shell(i)) + k = k+1 + end do + do j=1,ao_prim_num(i) + ao_coef_normalized(i,j) = ao_coef(i,j)*prim_normalization_factor(k+j-1) + enddo enddo + else + ! GAMESS convention for primitive factors + + do i=1,ao_num + powA(1) = ao_power(i,1) + powA(2) = ao_power(i,2) + powA(3) = ao_power(i,3) + + do j=1,ao_prim_num(i) + call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j), & + powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) + ao_coef_normalized(i,j) = ao_coef(i,j)/dsqrt(norm) + enddo + enddo + + endif + + else + + do i=1,ao_num do j=1,ao_prim_num(i) ao_coef_normalized(i,j) = ao_coef(i,j) enddo - endif + enddo - ! Normalization of the contracted basis functions - norm = 0.d0 + endif + + double precision, allocatable :: self_overlap(:) + allocate(self_overlap(ao_num)) + + do i=1,ao_num + powA(1) = ao_power(i,1) + powA(2) = ao_power(i,2) + powA(3) = ao_power(i,3) + self_overlap(i) = 0.d0 do j=1,ao_prim_num(i) - do k=1,ao_prim_num(i) + do k=1,j-1 call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) - norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k) + self_overlap(i) = self_overlap(i) + 2.d0*c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k) enddo + call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j),powA,powA,overlap_x,overlap_y,overlap_z,c,nz) + self_overlap(i) = self_overlap(i) +c*ao_coef_normalized(i,j)*ao_coef_normalized(i,j) enddo - ao_coef_normalization_factor(i) = 1.d0/dsqrt(norm) + enddo - if (ao_normalized) then - do j=1,ao_prim_num(i) - ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i) - enddo - else + if (ao_normalized) then + + do i=1,ao_num + ao_coef_normalization_factor(i) = 1.d0/dsqrt(self_overlap(i)) + enddo + + else + + do i=1,ao_num ao_coef_normalization_factor(i) = 1.d0 - endif + enddo + + endif + + do i=1,ao_num + do j=1,ao_prim_num(i) + ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i) + enddo enddo END_PROVIDER diff --git a/src/basis/EZFIO.cfg b/src/basis/EZFIO.cfg index 03e224e4..a9ec2c1b 100644 --- a/src/basis/EZFIO.cfg +++ b/src/basis/EZFIO.cfg @@ -84,4 +84,3 @@ type: logical doc: If true, normalize the basis functions interface: ezfio, provider, ocaml default: false - diff --git a/src/basis/basis.irp.f b/src/basis/basis.irp.f index 5374e5be..81282cb5 100644 --- a/src/basis/basis.irp.f +++ b/src/basis/basis.irp.f @@ -1,72 +1,3 @@ -BEGIN_PROVIDER [ double precision, shell_normalization_factor , (shell_num) ] - implicit none - BEGIN_DOC - ! Number of primitives per |AO| - END_DOC - - logical :: has - PROVIDE ezfio_filename - if (.not.ao_normalized) then - shell_normalization_factor = 1.d0 - return - endif - - if (mpi_master) then - if (size(shell_normalization_factor) == 0) return - - call ezfio_has_basis_shell_normalization_factor(has) - if (has) then - write(6,'(A)') '.. >>>>> [ IO READ: shell_normalization_factor ] <<<<< ..' - call ezfio_get_basis_shell_normalization_factor(shell_normalization_factor) - else - - double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c - integer :: l, powA(3), nz - integer :: i,j,k - nz=100 - C_A(1) = 0.d0 - C_A(2) = 0.d0 - C_A(3) = 0.d0 - - do i=1,shell_num - - powA(1) = shell_ang_mom(i) - powA(2) = 0 - powA(3) = 0 - - norm = 0.d0 - do k=1, prim_num - if (shell_index(k) /= i) cycle - do j=1, prim_num - if (shell_index(j) /= i) cycle - call overlap_gaussian_xyz(C_A,C_A,prim_expo(j),prim_expo(k), & - powA,powA,overlap_x,overlap_y,overlap_z,c,nz) - norm = norm+c*prim_coef(j)*prim_coef(k) * prim_normalization_factor(j) * prim_normalization_factor(k) - enddo - enddo - shell_normalization_factor(i) = 1.d0/dsqrt(norm) - enddo - - endif - 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' - integer :: ierr - call MPI_BCAST( shell_normalization_factor, (shell_num), MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) - if (ierr /= MPI_SUCCESS) then - stop 'Unable to read shell_normalization_factor with MPI' - endif - IRP_ENDIF - - call write_time(6) - -END_PROVIDER - - BEGIN_PROVIDER [ double precision, prim_normalization_factor , (prim_num) ] implicit none BEGIN_DOC diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index c60b1aa0..6391233a 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -15,6 +15,8 @@ subroutine export_trexio(update,full_path) integer, external :: getunitandopen + integer :: i,j,l + if (full_path) then fp = trexio_filename call system('realpath '//trim(fp)//' > '//trim(fp)//'.tmp') @@ -271,7 +273,7 @@ subroutine export_trexio(update,full_path) call trexio_assert(rc, TREXIO_SUCCESS) allocate(factor(shell_num)) - factor(1:shell_num) = shell_normalization_factor(1:shell_num) + factor(1:shell_num) = 1.d0 rc = trexio_write_basis_shell_factor(f(1), factor) call trexio_assert(rc, TREXIO_SUCCESS) @@ -312,22 +314,27 @@ subroutine export_trexio(update,full_path) rc = trexio_write_ao_shell(f(1), ao_shell) call trexio_assert(rc, TREXIO_SUCCESS) - integer :: i, pow0(3), powA(3), j, l, nz - double precision :: normA, norm0, C_A(3), overlap_x, overlap_z, overlap_y, c - nz=100 + if (ezfio_convention >= 20250211) then + rc = trexio_write_ao_normalization(f(1), ao_coef_normalization_factor) + print *, ao_coef_normalization_factor(:) + else + integer :: pow0(3), powA(3), nz + double precision :: normA, norm0, C_A(3), overlap_x, overlap_z, overlap_y, c + nz=100 - C_A(1) = 0.d0 - C_A(2) = 0.d0 - C_A(3) = 0.d0 + C_A(1) = 0.d0 + C_A(2) = 0.d0 + C_A(3) = 0.d0 - allocate(factor(ao_num)) - do i=1,ao_num - l = ao_first_of_shell(ao_shell(i)) - factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0)) - enddo - rc = trexio_write_ao_normalization(f(1), factor) + allocate(factor(ao_num)) + do i=1,ao_num + l = ao_first_of_shell(ao_shell(i)) + factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0)) + enddo + rc = trexio_write_ao_normalization(f(1), factor) + deallocate(factor) + endif call trexio_assert(rc, TREXIO_SUCCESS) - deallocate(factor) endif From 74d56370e8c6e8758fc22b50f02618d7bbb17d7a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 Feb 2025 12:02:04 +0100 Subject: [PATCH 081/175] Added 1 to unsigned shift to avoid zero index --- external/ezfio | 2 +- src/determinants/spindeterminants.irp.f | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 diff --git a/src/determinants/spindeterminants.irp.f b/src/determinants/spindeterminants.irp.f index 87c5d360..01979c02 100644 --- a/src/determinants/spindeterminants.irp.f +++ b/src/determinants/spindeterminants.irp.f @@ -14,7 +14,7 @@ integer*8 function spin_det_search_key(det,Nint) END_DOC integer, intent(in) :: Nint integer(bit_kind), intent(in) :: det(Nint) - integer(bit_kind), parameter :: unsigned_shift = -huge(1_bit_kind) ! 100...00 + integer(bit_kind), parameter :: unsigned_shift = 1_bit_kind-huge(1_bit_kind) ! 100...00 integer :: i spin_det_search_key = det(1) do i=2,Nint From 4a8551be153a7ef1937ed887a33dfb0b870be196 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 Feb 2025 13:26:36 +0100 Subject: [PATCH 082/175] Fixing previous commit --- ocaml/Angmom.ml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ocaml/Angmom.ml b/ocaml/Angmom.ml index 4e315a95..0f1658f0 100644 --- a/ocaml/Angmom.ml +++ b/ocaml/Angmom.ml @@ -2,6 +2,7 @@ open Qptypes open Sexplib.Std type t = S|P|D|F|G|H|I|J|K|L [@@deriving sexp] +type st = t [@@deriving sexp] let to_string = function | S -> "S" @@ -70,9 +71,6 @@ let of_l i = | x -> raise (Failure ("Angmom should be S|P|D|F|G|H|I|J|K|L")) -type st = t - - module Xyz = struct type t = { x: Positive_int.t ; y: Positive_int.t ; From eb6e1d4339fe6342da40c56184119c0545b97507 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 13 Feb 2025 10:23:52 +0100 Subject: [PATCH 083/175] Introduced qp_bug.irp.f --- src/determinants/spindeterminants.irp.f | 22 ++++++++++++++++------ src/utils/bug.irp.f | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/utils/bug.irp.f diff --git a/src/determinants/spindeterminants.irp.f b/src/determinants/spindeterminants.irp.f index 01979c02..2f497bd7 100644 --- a/src/determinants/spindeterminants.irp.f +++ b/src/determinants/spindeterminants.irp.f @@ -197,7 +197,9 @@ integer function get_index_in_psi_det_alpha_unique(key,Nint) enddo i += 1 - ASSERT (i <= N_det_alpha_unique) + if (i> N_det_alpha_unique) then + call qp_bug(irp_here, i, 'i> N_det_alpha_unique') + endif !DIR$ FORCEINLINE do while (spin_det_search_key(psi_det_alpha_unique(1,i),Nint) == det_ref) @@ -219,12 +221,15 @@ integer function get_index_in_psi_det_alpha_unique(key,Nint) endif i += 1 if (i > N_det_alpha_unique) then - ASSERT (get_index_in_psi_det_alpha_unique > 0) - return + exit endif enddo + if (get_index_in_psi_det_alpha_unique <= 0) then + call qp_bug(irp_here, get_index_in_psi_det_alpha_unique, 'get_index_in_psi_det_alpha_unique <= 0') + endif + end integer function get_index_in_psi_det_beta_unique(key,Nint) @@ -277,7 +282,9 @@ integer function get_index_in_psi_det_beta_unique(key,Nint) enddo i += 1 - ASSERT (i <= N_det_beta_unique) + if (i > N_det_beta_unique) then + call qp_bug(irp_here, i, 'i> N_det_beta_unique') + endif !DIR$ FORCEINLINE do while (spin_det_search_key(psi_det_beta_unique(1,i),Nint) == det_ref) @@ -299,12 +306,15 @@ integer function get_index_in_psi_det_beta_unique(key,Nint) endif i += 1 if (i > N_det_beta_unique) then - ASSERT (get_index_in_psi_det_beta_unique > 0) - return + exit endif enddo + if (get_index_in_psi_det_beta_unique <= 0) then + call qp_bug(irp_here, i, 'get_index_in_psi_det_beta_unique <= 0') + endif + end diff --git a/src/utils/bug.irp.f b/src/utils/bug.irp.f new file mode 100644 index 00000000..0e2ad551 --- /dev/null +++ b/src/utils/bug.irp.f @@ -0,0 +1,23 @@ +subroutine qp_bug(from, code, message) + implicit none + BEGIN_DOC +! This routine prints a bug report + END_DOC + character*(*) :: from + integer :: code + character*(*) :: message + + print *, '' + print *, '=======================' + print *, 'Bug in Quantum Package!' + print *, '=======================' + print *, '' + print *, ' from: ', trim(from) + print *, ' code: ', code + print *, ' info: ', trim(message) + print *, '' + print *, 'Please report this bug at https://github.com/QuantumPackage/qp2/issues' + print *, 'with your output file attached.' + print *, '' + stop -1 +end subroutine qp_bug From 70ad9f31b390b5931392a52ae375fab7c1e9f241 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 13 Feb 2025 11:58:46 +0100 Subject: [PATCH 084/175] Accelerated PT2-cholesky with dgemm --- external/ezfio | 2 +- src/cipsi/selection.irp.f | 28 +++++++++++++------ src/mo_two_e_ints/map_integrals.irp.f | 40 ++++++++++++++++++++++----- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/external/ezfio b/external/ezfio index d02132ea..dba01c4f 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 +Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index af7420c8..8c22ec85 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -1478,17 +1478,21 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) integer, parameter :: bant=1 - double precision, allocatable :: hij_cache1(:), hij_cache2(:) - allocate (hij_cache1(mo_num),hij_cache2(mo_num)) +! double precision, allocatable :: hij_cache1(:), hij_cache2(:) + double precision, allocatable :: hij_cache1(:,:), hij_cache2(:,:) +! allocate (hij_cache1(mo_num),hij_cache2(mo_num)) PROVIDE mo_integrals_threshold if(sp == 3) then ! AB + + allocate(hij_cache1(mo_num,mo_num)) + h1 = p(1,1) h2 = p(1,2) + call get_mo_two_e_integrals_ij(h2,h1,mo_num,hij_cache1,mo_integrals_map) do p1=1, mo_num if(bannedOrb(p1, 1)) cycle - call get_mo_two_e_integrals(p1,h2,h1,mo_num,hij_cache1,mo_integrals_map) do p2=1, mo_num if(bannedOrb(p2,2)) cycle if(banned(p1, p2, bant)) cycle ! rentable? @@ -1497,7 +1501,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call i_h_j(gen, det, N_int, hij) else phase = get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2, N_int) - hij = hij_cache1(p2) * phase + hij = hij_cache1(p2,p1) * phase end if if (dabs(hij) < mo_integrals_threshold) cycle !DIR$ LOOP COUNT AVG(4) @@ -1507,13 +1511,18 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) end do end do + deallocate(hij_cache1) + else ! AA BB + + allocate(hij_cache1(mo_num,mo_num),hij_cache2(mo_num,mo_num)) + p1 = p(1,sp) p2 = p(2,sp) + call get_mo_two_e_integrals_ij(p2,p1,mo_num,hij_cache1,mo_integrals_map) + call get_mo_two_e_integrals_ij(p1,p2,mo_num,hij_cache2,mo_integrals_map) do puti=1, mo_num if (bannedOrb(puti, sp)) cycle - call get_mo_two_e_integrals(puti,p2,p1,mo_num,hij_cache1,mo_integrals_map) - call get_mo_two_e_integrals(puti,p1,p2,mo_num,hij_cache2,mo_integrals_map) do putj=puti+1, mo_num if(bannedOrb(putj, sp)) cycle if(banned(puti, putj, bant)) cycle ! rentable? @@ -1522,7 +1531,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call i_h_j(gen, det, N_int, hij) if (dabs(hij) < mo_integrals_threshold) cycle else - hij = hij_cache1(putj) - hij_cache2(putj) + hij = hij_cache1(putj,puti) - hij_cache2(putj,puti) if (dabs(hij) < mo_integrals_threshold) cycle hij = hij * get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2, N_int) end if @@ -1532,9 +1541,12 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) enddo end do end do + + deallocate(hij_cache1,hij_cache2) + end if - deallocate(hij_cache1,hij_cache2) +! deallocate(hij_cache1,hij_cache2) end diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 5a005d7b..8f3c72d0 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -262,8 +262,14 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) out_val, 1) else integer :: isplit - out_val = 0.d0 - do isplit=1,4 + call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & + mo_integrals_cache_min-1, 1., & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & + out_val_sp, 1) + out_val(1:mo_integrals_cache_min-1) += out_val_sp(1:mo_integrals_cache_min-1) + out_val(1:mo_integrals_cache_min-1) = out_val_sp(1:mo_integrals_cache_min-1) + do isplit=2,4 call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & mo_integrals_cache_min-1, 1., & cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & @@ -442,16 +448,36 @@ subroutine get_mo_two_e_integrals_ij(k,l,sze,out_array,map) double precision, intent(out) :: out_array(sze,sze) type(map_type), intent(inout) :: map integer :: j - real(integral_kind), allocatable :: tmp_val(:) if ( (mo_integrals_cache_min>1).or.(mo_integrals_cache_max Date: Thu, 13 Feb 2025 15:05:27 +0100 Subject: [PATCH 085/175] Add possibility of single precision cholesky vectors --- src/ao_two_e_ints/cholesky.irp.f | 2 +- src/mo_two_e_ints/EZFIO.cfg | 6 + src/mo_two_e_ints/cholesky.irp.f | 6 +- src/mo_two_e_ints/map_integrals.irp.f | 193 +++++++++++++++----------- 4 files changed, 121 insertions(+), 86 deletions(-) diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index eb2f092a..d15ebdc3 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -469,7 +469,7 @@ double precision function get_ao_integ_chol(i,j,k,l) !$OMP PARALLEL DO PRIVATE(k,j) do k=1,rank do j=1,ao_num - cholesky_ao(1:ao_num,j,rank-k+1) = L((j-1_8)*ao_num+1_8:1_8*j*ao_num,rank-k+1) + cholesky_ao(1:ao_num,j,k) = L((j-1_8)*ao_num+1_8:1_8*j*ao_num,rank-k+1) enddo enddo !$OMP END PARALLEL DO diff --git a/src/mo_two_e_ints/EZFIO.cfg b/src/mo_two_e_ints/EZFIO.cfg index da9d8fc9..f26bfb61 100644 --- a/src/mo_two_e_ints/EZFIO.cfg +++ b/src/mo_two_e_ints/EZFIO.cfg @@ -29,4 +29,10 @@ doc: Read/Write MO integrals with the long range interaction from/to disk [ W interface: ezfio,provider,ocaml default: None +[mo_cholesky_double] +type: logical +doc: Use double precision to build integrals from Cholesky vectors +interface: ezfio,provider,ocaml +default: True + diff --git a/src/mo_two_e_ints/cholesky.irp.f b/src/mo_two_e_ints/cholesky.irp.f index 835110de..062e52e2 100644 --- a/src/mo_two_e_ints/cholesky.irp.f +++ b/src/mo_two_e_ints/cholesky.irp.f @@ -175,9 +175,9 @@ integer :: i,j,k !$OMP PARALLEL DO PRIVATE(k) - do k=1,cholesky_mo_num - do j=1,mo_num - do i=1,mo_num + do j=1,mo_num + do i=1,mo_num + do k=1,cholesky_mo_num cholesky_mo_transp_sp(k,i,j) = cholesky_mo_transp(k,i,j) enddo enddo diff --git a/src/mo_two_e_ints/map_integrals.irp.f b/src/mo_two_e_ints/map_integrals.irp.f index 8f3c72d0..bc83fbdd 100644 --- a/src/mo_two_e_ints/map_integrals.irp.f +++ b/src/mo_two_e_ints/map_integrals.irp.f @@ -9,15 +9,6 @@ PROVIDE mo_two_e_integrals_in_map mo_integrals_cache mo_two_e_integrals_jj_exchange mo_two_e_integrals_jj_anti mo_two_e_integrals_jj big_array_exchange_integrals big_array_coulomb_integrals mo_one_e_integrals END_PROVIDER -BEGIN_PROVIDER [ logical, mo_cholesky_double ] - implicit none - BEGIN_DOC -! If true, use double precision to compute integrals from cholesky vectors - END_DOC - mo_cholesky_double = .True. -END_PROVIDER - - !! MO Map !! ====== @@ -193,13 +184,14 @@ double precision function get_two_e_integral(i,j,k,l,map) if (mo_cholesky_double) then get_two_e_integral = ddot(cholesky_mo_num, cholesky_mo_transp(1,i,k), 1, cholesky_mo_transp(1,j,l), 1) else - get_two_e_integral = 0.d0 - do isplit=1,4 - get_two_e_integral = get_two_e_integral + & - sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1) - enddo + get_two_e_integral = sdot(cholesky_mo_num, cholesky_mo_transp_sp(1,i,k), 1, cholesky_mo_transp_sp(1,j,l), 1) +! get_two_e_integral = 0.d0 +! do isplit=1,4 +! get_two_e_integral = get_two_e_integral + & +! sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1) +! enddo endif else @@ -244,7 +236,7 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) ii = ior(ii, j-mo_integrals_cache_min) if (do_mo_cholesky.and. .not.mo_cholesky_double) then - allocate(out_val_sp(sze)) + allocate(out_val_sp(mo_num)) endif if (iand(ii, -mo_integrals_cache_size) == 0) then @@ -261,22 +253,27 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) cholesky_mo_transp(1,j,l), 1, 0.d0, & out_val, 1) else - integer :: isplit - call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - mo_integrals_cache_min-1, 1., & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & - out_val_sp, 1) - out_val(1:mo_integrals_cache_min-1) += out_val_sp(1:mo_integrals_cache_min-1) + call sgemv('T', cholesky_mo_num, mo_integrals_cache_min-1, 1., & + cholesky_mo_transp_sp(1,1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(1,j,l), 1, 0., & + out_val_sp, 1) out_val(1:mo_integrals_cache_min-1) = out_val_sp(1:mo_integrals_cache_min-1) - do isplit=2,4 - call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - mo_integrals_cache_min-1, 1., & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & - out_val_sp, 1) - out_val(1:mo_integrals_cache_min-1) += out_val_sp(1:mo_integrals_cache_min-1) - enddo +! integer :: isplit +! isplit=1 +! call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! mo_integrals_cache_min-1, 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & +! out_val_sp, 1) +! out_val(1:mo_integrals_cache_min-1) = out_val_sp(1:mo_integrals_cache_min-1) +! do isplit=2,4 +! call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! mo_integrals_cache_min-1, 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & +! out_val_sp, 1) +! out_val(1:mo_integrals_cache_min-1) += out_val_sp(1:mo_integrals_cache_min-1) +! enddo endif else @@ -318,15 +315,26 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) cholesky_mo_transp(1,j,l), 1, 0.d0, & out_val(mo_integrals_cache_max+1), 1) else - out_val = 0.d0 - do isplit=1,4 - call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - mo_num-mo_integrals_cache_max, 1., & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),mo_integrals_cache_max+1,k), cholesky_mo_num, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & - out_val_sp(mo_integrals_cache_max+1), 1) - out_val(mo_integrals_cache_max+1:sze) += out_val_sp(mo_integrals_cache_max+1:sze) - enddo + call sgemv('T', cholesky_mo_num, mo_num-mo_integrals_cache_max, 1., & + cholesky_mo_transp_sp(1,mo_integrals_cache_max+1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(1,j,l), 1, 0., & + out_val_sp(mo_integrals_cache_max+1), 1) + out_val(mo_integrals_cache_max+1:sze) = out_val_sp(mo_integrals_cache_max+1:sze) +! isplit=1 +! call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! mo_num-mo_integrals_cache_max, 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),mo_integrals_cache_max+1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & +! out_val_sp(mo_integrals_cache_max+1), 1) +! out_val(mo_integrals_cache_max+1:sze) = out_val_sp(mo_integrals_cache_max+1:sze) +! do isplit=2,4 +! call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! mo_num-mo_integrals_cache_max, 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),mo_integrals_cache_max+1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & +! out_val_sp(mo_integrals_cache_max+1), 1) +! out_val(mo_integrals_cache_max+1:sze) += out_val_sp(mo_integrals_cache_max+1:sze) +! enddo endif else @@ -366,15 +374,26 @@ subroutine get_mo_two_e_integrals(j,k,l,sze,out_val,map) cholesky_mo_transp(1,j,l), 1, 0.d0, & out_val, 1) else - out_val = 0.d0 - do isplit=1,4 - call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - sze, 1., & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & - out_val_sp, 1) - out_val(1:sze) += out_val_sp(1:sze) - enddo + call sgemv('T', cholesky_mo_num, sze, 1., & + cholesky_mo_transp_sp(1,1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(1,j,l), 1, 0., & + out_val_sp, 1) + out_val(1:sze) = out_val_sp(1:sze) +! isplit=1 +! call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! sze, 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & +! out_val_sp, 1) +! out_val(1:sze) = out_val_sp(1:sze) +! do isplit=2,4 +! call sgemv('T', cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! sze, 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),j,l), 1, 0., & +! out_val_sp, 1) +! out_val(1:sze) += out_val_sp(1:sze) +! enddo endif else @@ -459,23 +478,30 @@ subroutine get_mo_two_e_integrals_ij(k,l,sze,out_array,map) cholesky_mo_transp(1,1,l), cholesky_mo_num, 0.d0, & out_array, sze) else - integer :: isplit - double precision, allocatable :: out_array_sp(:,:) + real, allocatable :: out_array_sp(:,:) allocate(out_array_sp(sze,sze)) - call sgemm('T', 'N', mo_num, mo_num, & - cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), 1.d0, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,l), cholesky_mo_num, 0.d0, & + call sgemm('T', 'N', mo_num, mo_num, cholesky_mo_num, 1.0, & + cholesky_mo_transp_sp(1,1,k), cholesky_mo_num, & + cholesky_mo_transp_sp(1,1,l), cholesky_mo_num, 0.0, & out_array_sp, sze) out_array(1:sze,1:sze) = out_array_sp(1:sze,1:sze) - do isplit=2,4 - call sgemm('T', 'N', mo_num, mo_num, & - cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), 1.d0, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,l), cholesky_mo_num, 0.d0, & - out_array_sp, sze) - out_array(1:sze,1:sze) = out_array(1:sze,1:sze) + out_array_sp(1:sze,1:sze) - enddo +! +! isplit=1 +! call sgemm('T', 'N', mo_num, mo_num, & +! cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,l), cholesky_mo_num, 0., & +! out_array_sp, sze) +! out_array(1:sze,1:sze) = out_array_sp(1:sze,1:sze) +! integer :: isplit +! do isplit=2,4 +! call sgemm('T', 'N', mo_num, mo_num, & +! cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), 1., & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,k), cholesky_mo_num, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),1,l), cholesky_mo_num, 0., & +! out_array_sp, sze) +! out_array(1:sze,1:sze) = out_array(1:sze,1:sze) + out_array_sp(1:sze,1:sze) +! enddo deallocate(out_array_sp) endif @@ -631,12 +657,13 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) integer :: isplit do i=1,mo_integrals_cache_min-1 - out_val(i) = 0.d0 - do isplit=1,4 - out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) - enddo + out_val(i) = sdot(cholesky_mo_num, cholesky_mo_transp_sp(1,i,k), 1, cholesky_mo_transp_sp(1,i,l), 1) +! out_val(i) = 0.d0 +! do isplit=1,4 +! out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) +! enddo enddo do i=mo_integrals_cache_min,mo_integrals_cache_max @@ -644,12 +671,13 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) enddo do i=mo_integrals_cache_max, sze - out_val(i) = 0.d0 - do isplit=1,4 - out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) - enddo + out_val(i) = sdot(cholesky_mo_num, cholesky_mo_transp_sp(1,i,k), 1, cholesky_mo_transp_sp(1,i,l), 1) +! out_val(i) = 0.d0 +! do isplit=1,4 +! out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) +! enddo enddo endif @@ -663,12 +691,13 @@ subroutine get_mo_two_e_integrals_exch_ii(k,l,sze,out_val,map) enddo else do i=1,sze - out_val(i) = 0.d0 - do isplit=1,4 - out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & - cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) - enddo + out_val(i) = sdot(cholesky_mo_num, cholesky_mo_transp_sp(1,i,k), 1, cholesky_mo_transp_sp(1,i,l), 1) +! out_val(i) = 0.d0 +! do isplit=1,4 +! out_val(i) += sdot(cholesky_mo_num_split(isplit+1) - cholesky_mo_num_split(isplit), & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,k), 1, & +! cholesky_mo_transp_sp(cholesky_mo_num_split(isplit),i,l), 1) +! enddo enddo endif From bce68e7461440405f2cdaf8462a97163ed89899a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 13 Feb 2025 16:06:05 +0100 Subject: [PATCH 086/175] Simplified hij_cache in pt2 --- src/cipsi/selection.irp.f | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/cipsi/selection.irp.f b/src/cipsi/selection.irp.f index 8c22ec85..99bc7013 100644 --- a/src/cipsi/selection.irp.f +++ b/src/cipsi/selection.irp.f @@ -1478,19 +1478,17 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) integer, parameter :: bant=1 -! double precision, allocatable :: hij_cache1(:), hij_cache2(:) - double precision, allocatable :: hij_cache1(:,:), hij_cache2(:,:) -! allocate (hij_cache1(mo_num),hij_cache2(mo_num)) + double precision, allocatable :: hij_cache(:,:) PROVIDE mo_integrals_threshold - if(sp == 3) then ! AB + allocate(hij_cache(mo_num,mo_num)) - allocate(hij_cache1(mo_num,mo_num)) + if(sp == 3) then ! AB h1 = p(1,1) h2 = p(1,2) - call get_mo_two_e_integrals_ij(h2,h1,mo_num,hij_cache1,mo_integrals_map) + call get_mo_two_e_integrals_ij(h2,h1,mo_num,hij_cache,mo_integrals_map) do p1=1, mo_num if(bannedOrb(p1, 1)) cycle do p2=1, mo_num @@ -1501,7 +1499,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call i_h_j(gen, det, N_int, hij) else phase = get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2, N_int) - hij = hij_cache1(p2,p1) * phase + hij = hij_cache(p2,p1) * phase end if if (dabs(hij) < mo_integrals_threshold) cycle !DIR$ LOOP COUNT AVG(4) @@ -1511,16 +1509,11 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) end do end do - deallocate(hij_cache1) - else ! AA BB - allocate(hij_cache1(mo_num,mo_num),hij_cache2(mo_num,mo_num)) - p1 = p(1,sp) p2 = p(2,sp) - call get_mo_two_e_integrals_ij(p2,p1,mo_num,hij_cache1,mo_integrals_map) - call get_mo_two_e_integrals_ij(p1,p2,mo_num,hij_cache2,mo_integrals_map) + call get_mo_two_e_integrals_ij(p2,p1,mo_num,hij_cache,mo_integrals_map) do puti=1, mo_num if (bannedOrb(puti, sp)) cycle do putj=puti+1, mo_num @@ -1531,7 +1524,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call i_h_j(gen, det, N_int, hij) if (dabs(hij) < mo_integrals_threshold) cycle else - hij = hij_cache1(putj,puti) - hij_cache2(putj,puti) + hij = hij_cache(putj,puti) - hij_cache(puti,putj) if (dabs(hij) < mo_integrals_threshold) cycle hij = hij * get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2, N_int) end if @@ -1542,11 +1535,10 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) end do end do - deallocate(hij_cache1,hij_cache2) - end if -! deallocate(hij_cache1,hij_cache2) + deallocate(hij_cache) + end From ed47408948436dd67146c49ddb59c8bb12e9b484 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 14 Feb 2025 11:26:06 +0100 Subject: [PATCH 087/175] Forgot EZFIO.cfg in ezfio_files --- src/ezfio_files/EZFIO.cfg | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/ezfio_files/EZFIO.cfg diff --git a/src/ezfio_files/EZFIO.cfg b/src/ezfio_files/EZFIO.cfg new file mode 100644 index 00000000..a65cda1a --- /dev/null +++ b/src/ezfio_files/EZFIO.cfg @@ -0,0 +1,9 @@ +[ezfio_convention] +type: integer +doc: Version of the EZFIO conventions +interface: ezfio, provider, ocaml +default: 20210101 + +# EZFIO conventions +# 20210101: Old conventions +# 20250211: Changed normalization of AOs: Moved GAMESS convention from primitives to AOs for compatibility with trexio. From 7738a8ab8138301e953c4872b0a536c3c77ec643 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 14 Feb 2025 12:42:49 +0100 Subject: [PATCH 088/175] Fixed 9a840ae --- ocaml/qp_create_ezfio.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index ad8d44ca..9e58a18f 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -265,7 +265,7 @@ let run ?o b au c d m p cart xyz_file = let write_file () = (* Create EZFIO *) Ezfio.set_file ezfio_file; - Ezfio.set_files_ezfio_ezfio_convention 20250211; + Ezfio.set_ezfio_files_ezfio_convention 20250211; (* Write Pseudo *) let pseudo = From a1ff1a3efc97e9d8a3a86c4dd0b7227aa5820196 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 17 Feb 2025 14:07:12 +0100 Subject: [PATCH 089/175] Fixed qp_create for cc-pcvnz basis --- external/ezfio | 2 +- ocaml/qp_create_ezfio.ml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/external/ezfio b/external/ezfio index d02132ea..dba01c4f 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 +Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index 9e58a18f..bc36593e 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -131,7 +131,8 @@ let run ?o b au c d m p cart xyz_file = let key = Element.to_string elem.Atom.element in - Hashtbl.add basis_table key new_channel + if not (Hashtbl.mem basis_table key) then + Hashtbl.add basis_table key new_channel ) nuclei end | Some (key, basis) -> (*Aux basis *) From d04232bb7bf964896f355be29c114d7f959ac387 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 18 Feb 2025 11:36:56 +0100 Subject: [PATCH 090/175] Foce ao_normalized=true for qp_create --- ocaml/qp_create_ezfio.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index bc36593e..ba0e2b7b 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -267,6 +267,7 @@ let run ?o b au c d m p cart xyz_file = (* Create EZFIO *) Ezfio.set_file ezfio_file; Ezfio.set_ezfio_files_ezfio_convention 20250211; + Ezfio.set_basis_ao_normalized true ; (* Write Pseudo *) let pseudo = From d20ac13c4f3d5b4d7d2007253aaee689a6b121b5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 18 Feb 2025 11:55:25 +0100 Subject: [PATCH 091/175] Added del orbs in reorder_casscf --- src/casscf_cipsi/reorder_orb.irp.f | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/casscf_cipsi/reorder_orb.irp.f b/src/casscf_cipsi/reorder_orb.irp.f index 3cb90522..865edd65 100644 --- a/src/casscf_cipsi/reorder_orb.irp.f +++ b/src/casscf_cipsi/reorder_orb.irp.f @@ -26,6 +26,11 @@ subroutine reorder_orbitals_for_casscf array(iorb) = 3 * mo_num + i enddo + do i = 1, n_del_orb + iorb = list_del(i) + array(iorb) = 4 * mo_num + i + enddo + do i = 1, mo_num iorder(i) = i enddo From cbad838a341ab98e1f6397951553d47caa9154a3 Mon Sep 17 00:00:00 2001 From: Antoine MARIE Date: Tue, 25 Feb 2025 16:06:01 +0100 Subject: [PATCH 092/175] increase hard coded max rank of cholesky for ao_two_e_int --- src/ao_two_e_ints/cholesky.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index d15ebdc3..36061ef0 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -178,7 +178,7 @@ double precision function get_ao_integ_chol(i,j,k,l) rank_max = np ! Avoid too large arrays when there are many electrons if (elec_num > 10) then - rank_max = min(np,20*elec_num*elec_num) + rank_max = min(np,25*elec_num*elec_num) endif call mmap_create_d('', (/ ndim8, rank_max /), .False., .True., map) From ed1253f62956c10866ea83c707cf532b7f3d4d67 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 25 Feb 2025 18:09:57 +0100 Subject: [PATCH 093/175] Sort indices for faster access in RDM --- external/ezfio | 2 +- .../basis_correction/print_routine.irp.f | 97 ++++++++------- src/ao_two_e_ints/two_e_integrals.irp.f | 1 + src/cas_based_on_top/on_top_cas_prov.irp.f | 13 +- src/dft_utils_in_r/ao_in_r.irp.f | 112 ++++++++---------- src/dft_utils_in_r/mo_in_r.irp.f | 15 +-- src/mu_of_r/mu_of_r_conditions.irp.f | 85 ++++++++++++- src/two_rdm_routines/davidson_like_2rdm.irp.f | 88 ++++++++------ 8 files changed, 248 insertions(+), 165 deletions(-) diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 diff --git a/plugins/local/basis_correction/print_routine.irp.f b/plugins/local/basis_correction/print_routine.irp.f index b3b38673..8879fd5d 100644 --- a/plugins/local/basis_correction/print_routine.irp.f +++ b/plugins/local/basis_correction/print_routine.irp.f @@ -22,53 +22,58 @@ subroutine print_basis_correction print*, '****************************************' print*, '****************************************' print*, 'mu_of_r_potential = ',mu_of_r_potential - if(mu_of_r_potential.EQ."hf".or.mu_of_r_potential.EQ."hf_old".or.mu_of_r_potential.EQ."hf_sparse")then - print*, '' - print*,'Using a HF-like two-body density to define mu(r)' - print*,'This assumes that HF is a qualitative representation of the wave function ' - print*,'********************************************' - print*,'Functionals more suited for weak correlation' - print*,'********************************************' - print*,'+) LDA Ecmd functional : purely based on the UEG (JCP,149,194301,1-15 (2018)) ' - do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA , state ',istate,' = ',ecmd_lda_mu_of_r(istate) - enddo - print*,'+) PBE-UEG Ecmd functional : PBE at mu=0, UEG ontop pair density at large mu (JPCL, 10, 2931-2937 (2019))' - do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate) - enddo + if(mu_of_r_potential.EQ."hf".or. & + mu_of_r_potential.EQ."hf_old".or.& + mu_of_r_potential.EQ."hf_sparse".or.& + mu_of_r_potential.EQ."proj")then + print*, '' + print*,'Using a HF-like two-body density to define mu(r)' + print*,'This assumes that HF is a qualitative representation of the wave function ' + print*,'********************************************' + print*,'Functionals more suited for weak correlation' + print*,'********************************************' + print*,'+) LDA Ecmd functional : purely based on the UEG (JCP,149,194301,1-15 (2018)) ' + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA , state ',istate,' = ',ecmd_lda_mu_of_r(istate) + enddo + print*,'+) PBE-UEG Ecmd functional : PBE at mu=0, UEG ontop pair density at large mu (JPCL, 10, 2931-2937 (2019))' + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate) + enddo - else if(mu_of_r_potential.EQ."cas_full".or.mu_of_r_potential.EQ."cas_truncated".or.mu_of_r_potential.EQ."pure_act")then - print*, '' - print*,'Using a CAS-like two-body density to define mu(r)' - print*,'This assumes that the CAS is a qualitative representation of the wave function ' - print*,'********************************************' - print*,'Functionals more suited for weak correlation' - print*,'********************************************' - print*,'+) LDA Ecmd functional : purely based on the UEG (JCP,149,194301,1-15 (2018)) ' - do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA , state ',istate,' = ',ecmd_lda_mu_of_r(istate) - enddo - print*,'+) PBE-UEG Ecmd functional : PBE at mu=0, UEG ontop pair density at large mu (JPCL, 10, 2931-2937 (2019))' - do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate) - enddo - print*,'' - print*,'********************************************' - print*,'********************************************' - print*,'+) PBE-on-top Ecmd functional : JCP, 152, 174104 (2020) ' - print*,'PBE at mu=0, extrapolated ontop pair density at large mu, usual spin-polarization' - do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_mu_of_r(istate) - enddo - print*,'' - print*,'********************************************' - print*,'+) PBE-on-top no spin polarization Ecmd functional : JCP, 152, 174104 (2020)' - print*,'PBE at mu=0, extrapolated ontop pair density at large mu, and ZERO SPIN POLARIZATION' - do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate) - enddo - print*,'' + else if(mu_of_r_potential.EQ."cas_full".or. & + mu_of_r_potential.EQ."cas_truncated".or. & + mu_of_r_potential.EQ."pure_act") then + print*, '' + print*,'Using a CAS-like two-body density to define mu(r)' + print*,'This assumes that the CAS is a qualitative representation of the wave function ' + print*,'********************************************' + print*,'Functionals more suited for weak correlation' + print*,'********************************************' + print*,'+) LDA Ecmd functional : purely based on the UEG (JCP,149,194301,1-15 (2018)) ' + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA , state ',istate,' = ',ecmd_lda_mu_of_r(istate) + enddo + print*,'+) PBE-UEG Ecmd functional : PBE at mu=0, UEG ontop pair density at large mu (JPCL, 10, 2931-2937 (2019))' + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate) + enddo + print*,'' + print*,'********************************************' + print*,'********************************************' + print*,'+) PBE-on-top Ecmd functional : JCP, 152, 174104 (2020) ' + print*,'PBE at mu=0, extrapolated ontop pair density at large mu, usual spin-polarization' + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_mu_of_r(istate) + enddo + print*,'' + print*,'********************************************' + print*,'+) PBE-on-top no spin polarization Ecmd functional : JCP, 152, 174104 (2020)' + print*,'PBE at mu=0, extrapolated ontop pair density at large mu, and ZERO SPIN POLARIZATION' + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate) + enddo + print*,'' endif print*,'' diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index fb376ce1..1cb7617e 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -54,6 +54,7 @@ double precision function ao_two_e_integral(i, j, k, l) else if (use_only_lr) then ao_two_e_integral = ao_two_e_integral_erf(i, j, k, l) + return else if (do_schwartz_accel(i,j,k,l)) then diff --git a/src/cas_based_on_top/on_top_cas_prov.irp.f b/src/cas_based_on_top/on_top_cas_prov.irp.f index dd93ed40..9f9a1f06 100644 --- a/src/cas_based_on_top/on_top_cas_prov.irp.f +++ b/src/cas_based_on_top/on_top_cas_prov.irp.f @@ -15,14 +15,17 @@ subroutine act_on_top_on_grid_pt(ipoint,istate,pure_act_on_top_of_r) pure_act_on_top_of_r = 0.d0 do l = 1, n_act_orb phi_l = act_mos_in_r_array(l,ipoint) + if (dabs(phi_l) < 1.d-12) cycle do k = 1, n_act_orb - phi_k = act_mos_in_r_array(k,ipoint) + phi_k = act_mos_in_r_array(k,ipoint) * phi_l + if (dabs(phi_k) < 1.d-12) cycle do j = 1, n_act_orb - phi_j = act_mos_in_r_array(j,ipoint) + phi_j = act_mos_in_r_array(j,ipoint) * phi_k + if (dabs(phi_j) < 1.d-12) cycle do i = 1, n_act_orb - phi_i = act_mos_in_r_array(i,ipoint) - ! 1 2 1 2 - pure_act_on_top_of_r += act_2_rdm_ab_mo(i,j,k,l,istate) * phi_i * phi_j * phi_k * phi_l + phi_i = act_mos_in_r_array(i,ipoint) * phi_j + ! 1 2 1 2 + pure_act_on_top_of_r = pure_act_on_top_of_r + act_2_rdm_ab_mo(i,j,k,l,istate) * phi_i !* phi_j * phi_k * phi_l enddo enddo enddo diff --git a/src/dft_utils_in_r/ao_in_r.irp.f b/src/dft_utils_in_r/ao_in_r.irp.f index c8822776..ffd8c9d5 100644 --- a/src/dft_utils_in_r/ao_in_r.irp.f +++ b/src/dft_utils_in_r/ao_in_r.irp.f @@ -8,21 +8,14 @@ END_DOC implicit none - integer :: i, j - double precision :: tmp_array(ao_num), r(3) + integer :: i !$OMP PARALLEL DO & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,r,tmp_array,j) & - !$OMP SHARED(aos_in_r_array,n_points_final_grid,ao_num,final_grid_points) + !$OMP PRIVATE (i) & + !$OMP SHARED(aos_in_r_array,n_points_final_grid,final_grid_points) 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) - call give_all_aos_at_r(r, tmp_array) - do j = 1, ao_num - aos_in_r_array(j,i) = tmp_array(j) - enddo + call give_all_aos_at_r(final_grid_points(1,i), aos_in_r_array(1,i)) enddo !$OMP END PARALLEL DO @@ -42,7 +35,7 @@ do i = 1, n_points_final_grid do j = 1, ao_num - aos_in_r_array_transp(i,j) = aos_in_r_array(j,i) + aos_in_r_array_transp(i,j) = aos_in_r_array(j,i) enddo enddo @@ -62,27 +55,29 @@ implicit none integer :: i, j, m - double precision :: aos_array(ao_num), r(3) - double precision :: aos_grad_array(3,ao_num) + double precision :: r(3) + double precision, allocatable :: aos_grad_array(:,:), aos_array(:) - !$OMP PARALLEL DO & + !$OMP PARALLEL & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,j,m,r,aos_array,aos_grad_array) & + !$OMP PRIVATE (i,j,m,r,aos_array,aos_grad_array) & !$OMP SHARED(aos_grad_in_r_array,n_points_final_grid,ao_num,final_grid_points) + allocate(aos_grad_array(3,ao_num), aos_array(ao_num)) + + !$OMP DO 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) - call give_all_aos_and_grad_at_r(r,aos_array,aos_grad_array) + call give_all_aos_and_grad_at_r(final_grid_points(1,i),aos_array,aos_grad_array) do m = 1, 3 do j = 1, ao_num aos_grad_in_r_array(j,i,m) = aos_grad_array(m,j) enddo enddo enddo - !$OMP END PARALLEL DO + !$OMP END DO + deallocate(aos_grad_array,aos_array) + !$OMP END PARALLEL -END_PROVIDER +END_PROVIDER ! --- @@ -116,7 +111,7 @@ enddo enddo enddo - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, aos_lapl_in_r_array, (3,ao_num,n_points_final_grid)] implicit none @@ -126,32 +121,32 @@ ! k = 1 : x, k= 2, y, k 3, z END_DOC integer :: i,j,m - double precision :: aos_array(ao_num), r(3) - double precision :: aos_grad_array(3,ao_num) - double precision :: aos_lapl_array(3,ao_num) - !$OMP PARALLEL DO & + double precision, allocatable :: aos_lapl_array(:,:), aos_grad_array(:,:), aos_array(:) + + !$OMP PARALLEL & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,r,aos_array,aos_grad_array,aos_lapl_array,j,m) & + !$OMP PRIVATE (i,aos_array,aos_grad_array,aos_lapl_array,j,m) & !$OMP SHARED(aos_lapl_in_r_array,n_points_final_grid,ao_num,final_grid_points) + allocate( aos_array(ao_num), aos_grad_array(3,ao_num), aos_lapl_array(3,ao_num)) + !$OMP DO 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) - call give_all_aos_and_grad_and_lapl_at_r(r,aos_array,aos_grad_array,aos_lapl_array) + call give_all_aos_and_grad_and_lapl_at_r(final_grid_points(1,i),aos_array,aos_grad_array,aos_lapl_array) do j = 1, ao_num do m = 1, 3 aos_lapl_in_r_array(m,j,i) = aos_lapl_array(m,j) enddo enddo enddo - !$OMP END PARALLEL DO + !$OMP END DO + deallocate( aos_array, aos_grad_array, aos_lapl_array) + !$OMP END PARALLEL END_PROVIDER BEGIN_PROVIDER[double precision, aos_grad_in_r_array_transp_bis, (n_points_final_grid,ao_num,3)] implicit none BEGIN_DOC -! Transposed gradients -! +! Transposed gradients +! END_DOC integer :: i,j,m double precision :: aos_array(ao_num), r(3) @@ -169,8 +164,8 @@ BEGIN_PROVIDER[double precision, aos_grad_in_r_array_transp_3, (3,n_points_final_grid,ao_num)] implicit none BEGIN_DOC -! Transposed gradients -! +! Transposed gradients +! END_DOC integer :: i,j,m double precision :: aos_array(ao_num), r(3) @@ -187,22 +182,14 @@ BEGIN_PROVIDER[double precision, aos_in_r_array_extra, (ao_num,n_points_extra_final_grid)] implicit none BEGIN_DOC - ! aos_in_r_array_extra(i,j) = value of the ith ao on the jth grid point of the EXTRA grid + ! aos_in_r_array_extra(i,j) = value of the ith ao on the jth grid point of the EXTRA grid END_DOC - integer :: i,j - double precision :: aos_array(ao_num), r(3) + integer :: i !$OMP PARALLEL DO & - !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,r,aos_array,j) & - !$OMP SHARED(aos_in_r_array_extra,n_points_extra_final_grid,ao_num,final_grid_points_extra) + !$OMP DEFAULT (NONE) PRIVATE (i) & + !$OMP SHARED(aos_in_r_array_extra,n_points_extra_final_grid,final_grid_points_extra) do i = 1, n_points_extra_final_grid - r(1) = final_grid_points_extra(1,i) - r(2) = final_grid_points_extra(2,i) - r(3) = final_grid_points_extra(3,i) - call give_all_aos_at_r(r,aos_array) - do j = 1, ao_num - aos_in_r_array_extra(j,i) = aos_array(j) - enddo + call give_all_aos_at_r(final_grid_points_extra(1,i),aos_in_r_array_extra(1,i)) enddo !$OMP END PARALLEL DO @@ -214,9 +201,9 @@ BEGIN_PROVIDER[double precision, aos_in_r_array_extra_transp, (n_points_extra_final_grid,ao_num)] BEGIN_DOC - ! aos_in_r_array_extra_transp(i,j) = value of the jth ao on the ith grid point of the EXTRA grid + ! aos_in_r_array_extra_transp(i,j) = value of the jth ao on the ith grid point of the EXTRA grid END_DOC - + implicit none integer :: i, j double precision :: aos_array(ao_num), r(3) @@ -235,27 +222,28 @@ implicit none integer :: i, j, m - double precision :: aos_array(ao_num), r(3) - double precision :: aos_grad_array(3,ao_num) + double precision, allocatable :: aos_array(:), aos_grad_array(:,:) + - !$OMP PARALLEL DO & + !$OMP PARALLEL & !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,j,m,r,aos_array,aos_grad_array) & + !$OMP PRIVATE (i,j,m,aos_array,aos_grad_array) & !$OMP SHARED(aos_grad_in_r_array_extra,n_points_extra_final_grid,ao_num,final_grid_points_extra) + allocate(aos_array(ao_num), aos_grad_array(3,ao_num)) + !$OMP DO do i = 1, n_points_extra_final_grid - r(1) = final_grid_points_extra(1,i) - r(2) = final_grid_points_extra(2,i) - r(3) = final_grid_points_extra(3,i) - call give_all_aos_and_grad_at_r(r, aos_array, aos_grad_array) + call give_all_aos_and_grad_at_r(final_grid_points_extra(1,i), aos_array, aos_grad_array) do m = 1, 3 do j = 1, ao_num aos_grad_in_r_array_extra(j,i,m) = aos_grad_array(m,j) enddo enddo enddo - !$OMP END PARALLEL DO + !$OMP END DO + deallocate(aos_array,aos_grad_array) + !$OMP END PARALLEL -END_PROVIDER +END_PROVIDER ! --- diff --git a/src/dft_utils_in_r/mo_in_r.irp.f b/src/dft_utils_in_r/mo_in_r.irp.f index 623de4f8..f3cc5559 100644 --- a/src/dft_utils_in_r/mo_in_r.irp.f +++ b/src/dft_utils_in_r/mo_in_r.irp.f @@ -21,20 +21,11 @@ BEGIN_DOC ! mos_in_r_array(i,j) = value of the ith mo on the jth grid point END_DOC - integer :: i,j - double precision :: mos_array(mo_num), r(3) - !$OMP PARALLEL DO & - !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,r,mos_array,j) & + integer :: i + !$OMP PARALLEL DO DEFAULT(NONE) PRIVATE (i) & !$OMP SHARED(mos_in_r_array_omp,n_points_final_grid,mo_num,final_grid_points) 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) - call give_all_mos_at_r(r,mos_array) - do j = 1, mo_num - mos_in_r_array_omp(j,i) = mos_array(j) - enddo + call give_all_mos_at_r(final_grid_points(1,i),mos_in_r_array_omp(1,i)) enddo !$OMP END PARALLEL DO END_PROVIDER diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index 88dad8c3..3ad52a05 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -22,22 +22,32 @@ endif do istate = 1, N_states - do ipoint = 1, n_points_final_grid if(mu_of_r_potential.EQ."hf")then - mu_of_r_prov(ipoint,istate) = mu_of_r_hf(ipoint) + do ipoint = 1, n_points_final_grid + mu_of_r_prov(ipoint,istate) = mu_of_r_hf(ipoint) + enddo else if(mu_of_r_potential.EQ."hf_old")then - mu_of_r_prov(ipoint,istate) = mu_of_r_hf_old(ipoint) + do ipoint = 1, n_points_final_grid + mu_of_r_prov(ipoint,istate) = mu_of_r_hf_old(ipoint) + enddo else if(mu_of_r_potential.EQ."hf_sparse")then - mu_of_r_prov(ipoint,istate) = mu_of_r_hf_sparse(ipoint) + do ipoint = 1, n_points_final_grid + mu_of_r_prov(ipoint,istate) = mu_of_r_hf_sparse(ipoint) + enddo else if(mu_of_r_potential.EQ."cas_full".or.mu_of_r_potential.EQ."cas_truncated".or.mu_of_r_potential.EQ."pure_act")then - mu_of_r_prov(ipoint,istate) = mu_of_r_psi_cas(ipoint,istate) + do ipoint = 1, n_points_final_grid + mu_of_r_prov(ipoint,istate) = mu_of_r_psi_cas(ipoint,istate) + enddo + else if(mu_of_r_potential.EQ."proj")then + do ipoint = 1, n_points_final_grid + mu_of_r_prov(ipoint,istate) = mu_of_r_projector_mo(ipoint) + enddo else print*,'you requested the following mu_of_r_potential' print*,mu_of_r_potential print*,'which does not correspond to any of the options for such keyword' stop endif - enddo enddo if (write_mu_of_r) then @@ -225,3 +235,66 @@ enddo END_PROVIDER + +BEGIN_PROVIDER [double precision, mu_of_r_projector_mo, (n_points_final_grid) ] + implicit none + BEGIN_DOC + ! mu(r) computed with the projector onto the atomic basis + ! P_B(\mathbf{r},\mathbf{r}') = \sum_{ij} | + ! \chi_{i} \rangle \left[S^{-1}\right]_{ij} \langle \chi_{j} | + ! \] where $i$ and $j$ denote all atomic orbitals. + END_DOC + + double precision, parameter :: factor = dsqrt(2.d0*dacos(-1.d0)) + double precision, allocatable :: tmp(:,:) + integer :: ipoint + + + do ipoint=1,n_points_final_grid + mu_of_r_projector_mo(ipoint) = 0.d0 + integer :: i,j + do j=1,n_inact_act_orb + i = list_inact_act(j) + mu_of_r_projector_mo(ipoint) = mu_of_r_projector_mo(ipoint) + & + mos_in_r_array_omp(i,ipoint) * mos_in_r_array_omp(i,ipoint) + enddo + do j=1,n_virt_orb + i = list_virt(j) + mu_of_r_projector_mo(ipoint) = mu_of_r_projector_mo(ipoint) + & + mos_in_r_array_omp(i,ipoint) * mos_in_r_array_omp(i,ipoint) + enddo + enddo + + do ipoint=1,n_points_final_grid + ! epsilon + mu_of_r_projector_mo(ipoint) = 1.d0/(2.d0*dacos(-1.d0) * mu_of_r_projector_mo(ipoint)**(2.d0/3.d0)) + ! mu + mu_of_r_projector_mo(ipoint) = 1.d0/dsqrt( mu_of_r_projector_mo(ipoint) ) + enddo +END_PROVIDER + + + +BEGIN_PROVIDER [double precision, mu_average_proj, (N_states)] + implicit none + BEGIN_DOC + ! average value of mu(r) weighted with the total one-e density and divided by the number of electrons + ! + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! + ! in the one- and two-body density matrix are excluded + END_DOC + integer :: ipoint,istate + double precision :: weight,density + do istate = 1, N_states + mu_average_proj(istate) = 0.d0 + do ipoint = 1, n_points_final_grid + weight =final_weight_at_r_vector(ipoint) + density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + mu_average_proj(istate) += mu_of_r_projector_mo(ipoint) * weight * density + enddo + mu_average_proj(istate) = mu_average_proj(istate) / elec_num_grid_becke(istate) + enddo +END_PROVIDER + diff --git a/src/two_rdm_routines/davidson_like_2rdm.irp.f b/src/two_rdm_routines/davidson_like_2rdm.irp.f index 09436663..f0b40459 100644 --- a/src/two_rdm_routines/davidson_like_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_2rdm.irp.f @@ -139,6 +139,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin call list_to_bitstring( orb_bitmask, list_orb, norb, N_int) sze_buff = 6 * norb + elec_alpha_num * elec_alpha_num * 60 + sze_buff = sze_buff*100 list_orb_reverse = -1000 do i = 1, norb list_orb_reverse(list_orb(i)) = i @@ -191,7 +192,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin ASSERT (istart > 0) ASSERT (istep > 0) - !$OMP DO SCHEDULE(dynamic,64) + !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep krow = psi_bilinear_matrix_rows(k_a) @@ -272,14 +273,14 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin enddo endif - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 enddo +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! nkeys = 0 enddo !$OMP END DO - !$OMP DO SCHEDULE(dynamic,64) + !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep @@ -343,24 +344,24 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin c_1(l) = u_t(l,l_a) * u_t(l,k_a) enddo if(alpha_beta.or.spin_trace.or.alpha_alpha)then - ! increment the alpha/beta part for single excitations - if (nkeys+ 2 * elec_alpha_num .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 - endif - call orb_range_off_diag_single_to_all_states_ab_dm_buffer(tmp_det, tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) - ! increment the alpha/alpha part for single excitations - if (nkeys+4 * elec_alpha_num .ge. sze_buff ) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 - endif - call orb_range_off_diag_single_to_all_states_aa_dm_buffer(tmp_det,tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) + ! increment the alpha/beta part for single excitations + if (nkeys+ 2 * elec_alpha_num .ge. sze_buff) then + call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + nkeys = 0 + endif + call orb_range_off_diag_single_to_all_states_ab_dm_buffer(tmp_det, tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) + ! increment the alpha/alpha part for single excitations + if (nkeys+4 * elec_alpha_num .ge. sze_buff ) then + call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + nkeys = 0 + endif + call orb_range_off_diag_single_to_all_states_aa_dm_buffer(tmp_det,tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) endif enddo - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! nkeys = 0 ! Compute Hij for all alpha doubles ! ---------------------------------- @@ -383,8 +384,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin call orb_range_off_diag_double_to_all_states_aa_dm_buffer(tmp_det(1,1),psi_det_alpha_unique(1, lrow),c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) enddo endif - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! nkeys = 0 ! Single and double beta excitations @@ -459,8 +460,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin call orb_range_off_diag_single_to_all_states_bb_dm_buffer(tmp_det, tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) endif enddo - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! nkeys = 0 ! Compute Hij for all beta doubles ! ---------------------------------- @@ -487,8 +488,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin enddo endif - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! nkeys = 0 ! Diagonal contribution @@ -550,22 +551,43 @@ subroutine update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,loc integer :: istate integer :: i,h1,h2,p1,p2 - call omp_set_lock(lock_2rdm) + integer, allocatable :: iorder(:) + integer*8, allocatable :: to_sort(:) + + allocate(iorder(nkeys)) + do i=1,nkeys + iorder(i) = i + enddo + + ! If the lock is already taken, sort the keys while waiting for a faster access + if (.not.omp_test_lock(lock_2rdm)) then + allocate(to_sort(nkeys)) + do i=1,nkeys + h1 = keys(1,iorder(i)) + h2 = keys(2,iorder(i))-1 + p1 = keys(3,iorder(i))-1 + p2 = keys(4,iorder(i))-1 + to_sort(i) = int(h1,8) + int(dim1,8)*(int(h2,8) + int(dim1,8)*(int(p1,8) + int(dim1,8)*int(p2,8))) + enddo + call i8sort(to_sort, iorder, nkeys) + deallocate(to_sort) + call omp_set_lock(lock_2rdm) + endif ! print*,'*************' ! print*,'updating' ! print*,'nkeys',nkeys - do i = 1, nkeys - h1 = keys(1,i) - h2 = keys(2,i) - p1 = keys(3,i) - p2 = keys(4,i) - do istate = 1, N_st -! print*,h1,h2,p1,p2,values(istate,i) - big_array(h1,h2,p1,p2,istate) += values(istate,i) + do istate = 1, N_st + do i = 1, nkeys + h1 = keys(1,iorder(i)) + h2 = keys(2,iorder(i)) + p1 = keys(3,iorder(i)) + p2 = keys(4,iorder(i)) + big_array(h1,h2,p1,p2,istate) = big_array(h1,h2,p1,p2,istate) + values(istate,iorder(i)) enddo enddo call omp_unset_lock(lock_2rdm) + deallocate(iorder) end From 62c13860bae511e8641208b880d71c6176129325 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 26 Feb 2025 14:42:39 +0100 Subject: [PATCH 094/175] update two_rdm_routines --- src/bitmask/bitmasks_routines.irp.f | 39 +- src/two_body_rdm/act_2_rdm.irp.f | 1 + src/two_rdm_routines/davidson_like_2rdm.irp.f | 2 + src/two_rdm_routines/update_rdm.irp.f | 1509 +++++++++-------- 4 files changed, 785 insertions(+), 766 deletions(-) diff --git a/src/bitmask/bitmasks_routines.irp.f b/src/bitmask/bitmasks_routines.irp.f index 9c6f4f0c..be0a2dd1 100644 --- a/src/bitmask/bitmasks_routines.irp.f +++ b/src/bitmask/bitmasks_routines.irp.f @@ -283,33 +283,16 @@ subroutine print_det_one_dimension(string,Nint) end -logical function is_integer_in_string(bite,string,Nint) - use bitmasks +logical function is_integer_in_string(orb,bitmask,Nint) + use bitmasks implicit none - integer, intent(in) :: bite,Nint - integer(bit_kind), intent(in) :: string(Nint) - integer(bit_kind) :: string_bite(Nint) - integer :: i,itot,itot_and - character*(2048) :: output(1) - string_bite = 0_bit_kind - call set_bit_to_integer(bite,string_bite,Nint) - itot = 0 - itot_and = 0 - is_integer_in_string = .False. -!print*,'' -!print*,'' -!print*,'bite = ',bite -!call bitstring_to_str( output(1), string_bite, Nint ) -! print *, trim(output(1)) -!call bitstring_to_str( output(1), string, Nint ) -! print *, trim(output(1)) - do i = 1, Nint - itot += popcnt(string(i)) - itot_and += popcnt(ior(string(i),string_bite(i))) - enddo -!print*,'itot,itot_and',itot,itot_and - if(itot == itot_and)then - is_integer_in_string = .True. - endif -!pause + BEGIN_DOC +! Checks is the orbital orb is set to 1 in the bit string + END_DOC + integer, intent(in) :: orb, Nint + integer(bit_kind), intent(in) :: bitmask(Nint) + integer :: j, k + k = ishft(orb-1,-bit_kind_shift)+1 + j = orb-ishft(k-1,bit_kind_shift)-1 + is_integer_in_string = iand(bitmask(k), ibset(0_bit_kind, j)) /= 0_bit_kind end diff --git a/src/two_body_rdm/act_2_rdm.irp.f b/src/two_body_rdm/act_2_rdm.irp.f index 9e2ea018..6cad72be 100644 --- a/src/two_body_rdm/act_2_rdm.irp.f +++ b/src/two_body_rdm/act_2_rdm.irp.f @@ -145,6 +145,7 @@ print*,'' print*,'Providing act_2_rdm_spin_trace_mo ' character*(128) :: name_file + PROVIDE all_mo_integrals name_file = 'act_2_rdm_spin_trace_mo' ispin = 4 act_2_rdm_spin_trace_mo = 0.d0 diff --git a/src/two_rdm_routines/davidson_like_2rdm.irp.f b/src/two_rdm_routines/davidson_like_2rdm.irp.f index f0b40459..0e6899f8 100644 --- a/src/two_rdm_routines/davidson_like_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_2rdm.irp.f @@ -194,6 +194,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep +!print *, 'aa', k_a, '/', iend krow = psi_bilinear_matrix_rows(k_a) ASSERT (krow <= N_det_alpha_unique) @@ -282,6 +283,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep +!print *, 'ab', k_a, '/', iend ! Single and double alpha exitations diff --git a/src/two_rdm_routines/update_rdm.irp.f b/src/two_rdm_routines/update_rdm.irp.f index 8aeb0699..978f6e33 100644 --- a/src/two_rdm_routines/update_rdm.irp.f +++ b/src/two_rdm_routines/update_rdm.irp.f @@ -1,780 +1,813 @@ - subroutine orb_range_diag_to_all_states_2_rdm_dm_buffer(det_1,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) +logical function is_integer_in_string_local(orb,bitmask,Nint) + use bitmasks + implicit none + integer, intent(in) :: orb, Nint + integer(bit_kind), intent(in) :: bitmask(Nint) + integer :: j, k + k = ishft(orb-1,-bit_kind_shift)+1 + j = orb-ishft(k-1,bit_kind_shift)-1 + is_integer_in_string_local = iand(bitmask(k), ibset(0_bit_kind, j)) /= 0_bit_kind +end + +subroutine orb_range_diag_to_all_states_2_rdm_dm_buffer(det_1,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) use bitmasks BEGIN_DOC - ! routine that update the DIAGONAL PART of the two body rdms in a specific range of orbitals for a given determinant det_1 - ! - ! c_1 is the array of the contributions to the rdm for all states - ! - ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals - ! - ! ispin determines which spin-spin component of the two-rdm you will update - ! - ! ispin == 1 :: alpha/ alpha - ! ispin == 2 :: beta / beta - ! ispin == 3 :: alpha/ beta - ! ispin == 4 :: spin traced <=> total two-rdm - END_DOC - implicit none - integer, intent(in) :: ispin,sze_buff,N_st - integer, intent(in) :: list_orb_reverse(mo_num) - integer(bit_kind), intent(in) :: det_1(N_int,2) - integer(bit_kind), intent(in) :: orb_bitmask(N_int) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - - integer :: occ(N_int*bit_kind_size,2) - integer :: n_occ_ab(2) - integer :: i,j,h1,h2 - integer(bit_kind) :: det_1_act(N_int,2) - logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - do i = 1, N_int - det_1_act(i,1) = iand(det_1(i,1),orb_bitmask(i)) - det_1_act(i,2) = iand(det_1(i,2),orb_bitmask(i)) - enddo - - alpha_alpha = .False. - beta_beta = .False. - alpha_beta = .False. - spin_trace = .False. - if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. - else if(ispin == 4)then - spin_trace = .True. - endif - call bitstring_to_list_ab(det_1_act, occ, n_occ_ab, N_int) - logical :: is_integer_in_string - integer :: i1,i2,istate - if(alpha_beta)then - do i = 1, n_occ_ab(1) - i1 = occ(i,1) - do j = 1, n_occ_ab(2) - i2 = occ(j,2) - h1 = list_orb_reverse(i1) - h2 = list_orb_reverse(i2) - ! If alpha/beta, electron 1 is alpha, electron 2 is beta - ! Therefore you don't necessayr have symmetry between electron 1 and 2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h1 - keys(4,nkeys) = h2 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = h1 - enddo - enddo - - else if (alpha_alpha)then - do i = 1, n_occ_ab(1) - i1 = occ(i,1) - do j = 1, n_occ_ab(1) - i2 = occ(j,1) - h1 = list_orb_reverse(i1) - h2 = list_orb_reverse(i2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = -0.5d0 * c_1(istate) - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h2 - keys(4,nkeys) = h1 - enddo + ! routine that update the DIAGONAL PART of the two body rdms in a specific range of orbitals for a given determinant det_1 + ! + ! c_1 is the array of the contributions to the rdm for all states + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + END_DOC + implicit none + integer, intent(in) :: ispin,sze_buff,N_st + integer, intent(in) :: list_orb_reverse(mo_num) + integer(bit_kind), intent(in) :: det_1(N_int,2) + integer(bit_kind), intent(in) :: orb_bitmask(N_int) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + + integer :: occ(N_int*bit_kind_size,2) + integer :: n_occ_ab(2) + integer :: i,j,h1,h2 + integer(bit_kind) :: det_1_act(N_int,2) + logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace + do i = 1, N_int + det_1_act(i,1) = iand(det_1(i,1),orb_bitmask(i)) + det_1_act(i,2) = iand(det_1(i,2),orb_bitmask(i)) enddo - else if (beta_beta)then - do i = 1, n_occ_ab(2) - i1 = occ(i,2) - do j = 1, n_occ_ab(2) - i2 = occ(j,2) - h1 = list_orb_reverse(i1) - h2 = list_orb_reverse(i2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = -0.5d0 * c_1(istate) + + alpha_alpha = .False. + beta_beta = .False. + alpha_beta = .False. + spin_trace = .False. + if( ispin == 1)then + alpha_alpha = .True. + else if(ispin == 2)then + beta_beta = .True. + else if(ispin == 3)then + alpha_beta = .True. + else if(ispin == 4)then + spin_trace = .True. + endif + + call bitstring_to_list_ab(det_1_act, occ, n_occ_ab, N_int) + logical :: is_integer_in_string_local + integer :: i1,i2,istate + if(alpha_beta)then + do i = 1, n_occ_ab(1) + i1 = occ(i,1) + h1 = list_orb_reverse(i1) + do j = 1, n_occ_ab(2) + i2 = occ(j,2) + h2 = list_orb_reverse(i2) + ! If alpha/beta, electron 1 is alpha, electron 2 is beta + ! Therefore you don't necessayr have symmetry between electron 1 and 2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h1 + keys(4,nkeys) = h2 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = h1 + enddo enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h2 - keys(4,nkeys) = h1 - enddo - enddo - else if(spin_trace)then - ! 0.5 * (alpha beta + beta alpha) - do i = 1, n_occ_ab(1) - i1 = occ(i,1) - do j = 1, n_occ_ab(2) - i2 = occ(j,2) - h1 = list_orb_reverse(i1) - h2 = list_orb_reverse(i2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) + + else if (alpha_alpha)then + + do i = 1, n_occ_ab(1) + i1 = occ(i,1) + h1 = list_orb_reverse(i1) + do j = 1, n_occ_ab(1) + i2 = occ(j,1) + h2 = list_orb_reverse(i2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = -0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h2 + keys(4,nkeys) = h1 + enddo enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) + + else if (beta_beta)then + + do i = 1, n_occ_ab(2) + i1 = occ(i,2) + h1 = list_orb_reverse(i1) + do j = 1, n_occ_ab(2) + i2 = occ(j,2) + h2 = list_orb_reverse(i2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = -0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h2 + keys(4,nkeys) = h1 + enddo enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = h1 - enddo - enddo - do i = 1, n_occ_ab(1) - i1 = occ(i,1) - do j = 1, n_occ_ab(1) - i2 = occ(j,1) - h1 = list_orb_reverse(i1) - h2 = list_orb_reverse(i2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) + + else if(spin_trace)then + + ! 0.5 * (alpha beta + beta alpha) + do i = 1, n_occ_ab(1) + i1 = occ(i,1) + h1 = list_orb_reverse(i1) + do j = 1, n_occ_ab(2) + i2 = occ(j,2) + h2 = list_orb_reverse(i2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = h1 + enddo + do j = 1, n_occ_ab(1) + i2 = occ(j,1) + h2 = list_orb_reverse(i2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = -0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h2 + keys(4,nkeys) = h1 + enddo enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = -0.5d0 * c_1(istate) + do i = 1, n_occ_ab(2) + i1 = occ(i,2) + h1 = list_orb_reverse(i1) + do j = 1, n_occ_ab(2) + i2 = occ(j,2) + h2 = list_orb_reverse(i2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = 0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = -0.5d0 * c_1(istate) + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h2 + keys(4,nkeys) = h1 + enddo enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h2 - keys(4,nkeys) = h1 - enddo - enddo - do i = 1, n_occ_ab(2) - i1 = occ(i,2) - do j = 1, n_occ_ab(2) - i2 = occ(j,2) - h1 = list_orb_reverse(i1) - h2 = list_orb_reverse(i2) + endif +end + + +subroutine orb_range_off_diag_double_to_all_states_ab_dm_buffer(det_1,det_2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) + use bitmasks + BEGIN_DOC + ! routine that updates the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for + ! + ! a given couple of determinant det_1, det_2 being a alpha/beta DOUBLE excitation with respect to one another + ! + ! c_1 is the array of the contributions to the rdm for all states + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + ! + ! here, only ispin == 3 or 4 will do something + END_DOC + implicit none + integer, intent(in) :: ispin,sze_buff,N_st + integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) + integer, intent(in) :: list_orb_reverse(mo_num) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + integer :: i,j,h1,h2,p1,p2,istate + integer :: exc(0:2,2,2) + double precision :: phase + logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace + logical :: is_integer_in_string_local + if (ispin <= 2) return + +! alpha_alpha = .False. +! beta_beta = .False. +! alpha_beta = .False. +! spin_trace = .False. +! if( ispin == 1)then +! alpha_alpha = .True. +! else if(ispin == 2)then +! beta_beta = .True. +! else if(ispin == 3)then +! alpha_beta = .True. +! else if(ispin == 4)then +! spin_trace = .True. +! endif + call get_double_excitation(det_1,det_2,exc,phase,N_int) + + h1 = exc(1,1,1) + if(list_orb_reverse(h1).lt.0)return + h1 = list_orb_reverse(h1) + h2 = exc(1,1,2) + if(list_orb_reverse(h2).lt.0)return + h2 = list_orb_reverse(h2) + p1 = exc(1,2,1) + if(list_orb_reverse(p1).lt.0)return + p1 = list_orb_reverse(p1) + p2 = exc(1,2,2) + if(list_orb_reverse(p2).lt.0)return + p2 = list_orb_reverse(p2) +! if(alpha_beta)then nkeys += 1 + phase = phase * 0.5d0 do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) + values(istate,nkeys) = c_1(istate) * phase enddo keys(1,nkeys) = h1 keys(2,nkeys) = h2 - keys(3,nkeys) = h1 - keys(4,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = p2 nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = -0.5d0 * c_1(istate) + values(istate,nkeys) = c_1(istate) * phase enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h2 - keys(4,nkeys) = h1 - enddo - enddo - endif - end - - - subroutine orb_range_off_diag_double_to_all_states_ab_dm_buffer(det_1,det_2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) - use bitmasks - BEGIN_DOC -! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for -! -! a given couple of determinant det_1, det_2 being a alpha/beta DOUBLE excitation with respect to one another -! -! c_1 is the array of the contributions to the rdm for all states -! -! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals -! -! ispin determines which spin-spin component of the two-rdm you will update -! -! ispin == 1 :: alpha/ alpha -! ispin == 2 :: beta / beta -! ispin == 3 :: alpha/ beta -! ispin == 4 :: spin traced <=> total two-rdm -! -! here, only ispin == 3 or 4 will do something - END_DOC - implicit none - integer, intent(in) :: ispin,sze_buff,N_st - integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) - integer, intent(in) :: list_orb_reverse(mo_num) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - integer :: i,j,h1,h2,p1,p2,istate - integer :: exc(0:2,2,2) - double precision :: phase - logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - logical :: is_integer_in_string - alpha_alpha = .False. - beta_beta = .False. - alpha_beta = .False. - spin_trace = .False. - if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. - else if(ispin == 4)then - spin_trace = .True. - endif - call get_double_excitation(det_1,det_2,exc,phase,N_int) - h1 = exc(1,1,1) - if(list_orb_reverse(h1).lt.0)return - h1 = list_orb_reverse(h1) - h2 = exc(1,1,2) - if(list_orb_reverse(h2).lt.0)return - h2 = list_orb_reverse(h2) - p1 = exc(1,2,1) - if(list_orb_reverse(p1).lt.0)return - p1 = list_orb_reverse(p1) - p2 = exc(1,2,2) - if(list_orb_reverse(p2).lt.0)return - p2 = list_orb_reverse(p2) - if(alpha_beta)then - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = p2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p2 - keys(4,nkeys) = p1 - else if(spin_trace)then - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = p2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p2 - keys(4,nkeys) = p1 - endif - end - - subroutine orb_range_off_diag_single_to_all_states_ab_dm_buffer(det_1,det_2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p2 + keys(4,nkeys) = p1 +! else if(spin_trace)then +! nkeys += 1 +! do istate = 1, N_st +! values(istate,nkeys) = 0.5d0 * c_1(istate) * phase +! enddo +! keys(1,nkeys) = h1 +! keys(2,nkeys) = h2 +! keys(3,nkeys) = p1 +! keys(4,nkeys) = p2 +! nkeys += 1 +! do istate = 1, N_st +! values(istate,nkeys) = 0.5d0 * c_1(istate) * phase +! enddo +! keys(1,nkeys) = h2 +! keys(2,nkeys) = h1 +! keys(3,nkeys) = p2 +! keys(4,nkeys) = p1 +! endif +end + +subroutine orb_range_off_diag_single_to_all_states_ab_dm_buffer(det_1,det_2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) use bitmasks BEGIN_DOC - ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for - ! - ! a given couple of determinant det_1, det_2 being a SINGLE excitation with respect to one another - ! - ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 - ! - ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation - ! - ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals - ! - ! ispin determines which spin-spin component of the two-rdm you will update - ! - ! ispin == 1 :: alpha/ alpha - ! ispin == 2 :: beta / beta - ! ispin == 3 :: alpha/ beta - ! ispin == 4 :: spin traced <=> total two-rdm - ! - ! here, only ispin == 3 or 4 will do something + ! routine that updates the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for + ! + ! a given couple of determinant det_1, det_2 being a SINGLE excitation with respect to one another + ! + ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 + ! + ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + ! + ! here, only ispin == 3 or 4 will do something END_DOC implicit none - integer, intent(in) :: ispin,sze_buff,N_st - integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) - integer, intent(in) :: list_orb_reverse(mo_num) - integer(bit_kind), intent(in) :: orb_bitmask(N_int) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - + integer, intent(in) :: ispin,sze_buff,N_st + integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) + integer, intent(in) :: list_orb_reverse(mo_num) + integer(bit_kind), intent(in) :: orb_bitmask(N_int) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + integer :: occ(N_int*bit_kind_size,2) integer :: n_occ_ab(2) - integer :: i,j,h1,h2,p1,istate + integer :: i,j,h1,h2,p1,istate integer :: exc(0:2,2,2) double precision :: phase - + logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - logical :: is_integer_in_string - alpha_alpha = .False. - beta_beta = .False. + logical :: is_integer_in_string_local + if (ispin <= 2) return + alpha_beta = .False. spin_trace = .False. - if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. + if(ispin == 3)then + alpha_beta = .True. else if(ispin == 4)then - spin_trace = .True. + spin_trace = .True. endif - + call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int) call get_single_excitation(det_1,det_2,exc,phase,N_int) if(alpha_beta)then - if (exc(0,1,1) == 1) then - ! Mono alpha - h1 = exc(1,1,1) - if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return - h1 = list_orb_reverse(h1) - p1 = exc(1,2,1) - if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return - p1 = list_orb_reverse(p1) - do i = 1, n_occ_ab(2) - h2 = occ(i,2) - if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle - h2 = list_orb_reverse(h2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - enddo - else - ! Mono beta - h1 = exc(1,1,2) - if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return - h1 = list_orb_reverse(h1) - p1 = exc(1,2,2) - if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return - p1 = list_orb_reverse(p1) - do i = 1, n_occ_ab(1) - h2 = occ(i,1) - if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle - h2 = list_orb_reverse(h2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + + if (exc(0,1,1) == 1) then + ! Mono alpha + h1 = exc(1,1,1) + if(.not.is_integer_in_string_local(h1,orb_bitmask,N_int))return + p1 = exc(1,2,1) + if(.not.is_integer_in_string_local(p1,orb_bitmask,N_int))return + + h1 = list_orb_reverse(h1) + p1 = list_orb_reverse(p1) + + phase = 0.5d0 * phase + do i = 1, n_occ_ab(2) + h2 = occ(i,2) + if(.not.is_integer_in_string_local(h2,orb_bitmask,N_int))cycle + h2 = list_orb_reverse(h2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + else + ! Mono beta + h1 = exc(1,1,2) + if(.not.is_integer_in_string_local(h1,orb_bitmask,N_int))return + p1 = exc(1,2,2) + if(.not.is_integer_in_string_local(p1,orb_bitmask,N_int))return + + h1 = list_orb_reverse(h1) + p1 = list_orb_reverse(p1) + phase = 0.5d0 * phase + do i = 1, n_occ_ab(1) + h2 = occ(i,1) + if(.not.is_integer_in_string_local(h2,orb_bitmask,N_int))cycle + h2 = list_orb_reverse(h2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - enddo - endif + endif + else if(spin_trace)then - if (exc(0,1,1) == 1) then - ! Mono alpha - h1 = exc(1,1,1) - if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return - h1 = list_orb_reverse(h1) - p1 = exc(1,2,1) - if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return - p1 = list_orb_reverse(p1) - do i = 1, n_occ_ab(2) - h2 = occ(i,2) - if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle - h2 = list_orb_reverse(h2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - enddo - else - ! Mono beta - h1 = exc(1,1,2) - if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return - h1 = list_orb_reverse(h1) - p1 = exc(1,2,2) - if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return - p1 = list_orb_reverse(p1) - do i = 1, n_occ_ab(1) - h2 = occ(i,1) - if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle - h2 = list_orb_reverse(h2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + + if (exc(0,1,1) == 1) then + ! Mono alpha + h1 = exc(1,1,1) + if(.not.is_integer_in_string_local(h1,orb_bitmask,N_int))return + p1 = exc(1,2,1) + if(.not.is_integer_in_string_local(p1,orb_bitmask,N_int))return + + h1 = list_orb_reverse(h1) + p1 = list_orb_reverse(p1) + phase = 0.5d0 * phase + do i = 1, n_occ_ab(2) + h2 = occ(i,2) + if(.not.is_integer_in_string_local(h2,orb_bitmask,N_int))cycle + h2 = list_orb_reverse(h2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + + else + + ! Mono beta + h1 = exc(1,1,2) + if(.not.is_integer_in_string_local(h1,orb_bitmask,N_int))return + p1 = exc(1,2,2) + if(.not.is_integer_in_string_local(p1,orb_bitmask,N_int))return + + h1 = list_orb_reverse(h1) + p1 = list_orb_reverse(p1) + + phase = 0.5d0 * phase + do i = 1, n_occ_ab(1) + h2 = occ(i,1) + if(.not.is_integer_in_string_local(h2,orb_bitmask,N_int))cycle + h2 = list_orb_reverse(h2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - enddo - endif + endif + endif - end +end - subroutine orb_range_off_diag_single_to_all_states_aa_dm_buffer(det_1,det_2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) +subroutine orb_range_off_diag_single_to_all_states_aa_dm_buffer(det_1,det_2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) BEGIN_DOC - ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for - ! - ! a given couple of determinant det_1, det_2 being a ALPHA SINGLE excitation with respect to one another - ! - ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 - ! - ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation - ! - ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals - ! - ! ispin determines which spin-spin component of the two-rdm you will update - ! - ! ispin == 1 :: alpha/ alpha - ! ispin == 2 :: beta / beta - ! ispin == 3 :: alpha/ beta - ! ispin == 4 :: spin traced <=> total two-rdm - ! - ! here, only ispin == 1 or 4 will do something + ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for + ! + ! a given couple of determinant det_1, det_2 being a ALPHA SINGLE excitation with respect to one another + ! + ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 + ! + ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + ! + ! here, only ispin == 1 or 4 will do something END_DOC use bitmasks implicit none - integer, intent(in) :: ispin,sze_buff,N_st - integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) - integer, intent(in) :: list_orb_reverse(mo_num) - integer(bit_kind), intent(in) :: orb_bitmask(N_int) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - + integer, intent(in) :: ispin,sze_buff,N_st + integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) + integer, intent(in) :: list_orb_reverse(mo_num) + integer(bit_kind), intent(in) :: orb_bitmask(N_int) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + integer :: occ(N_int*bit_kind_size,2) integer :: n_occ_ab(2) - integer :: i,j,h1,h2,p1,istate + integer :: i,j,h1,h2,p1,istate integer :: exc(0:2,2,2) double precision :: phase - + logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - logical :: is_integer_in_string - alpha_alpha = .False. - beta_beta = .False. - alpha_beta = .False. + logical :: is_integer_in_string_local + alpha_alpha = .False. +! beta_beta = .False. +! alpha_beta = .False. spin_trace = .False. if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. + alpha_alpha = .True. else if(ispin == 4)then - spin_trace = .True. - endif - - call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int) - call get_single_excitation(det_1,det_2,exc,phase,N_int) - if(alpha_alpha.or.spin_trace)then - if (exc(0,1,1) == 1) then - ! Mono alpha - h1 = exc(1,1,1) - if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return - h1 = list_orb_reverse(h1) - p1 = exc(1,2,1) - if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return - p1 = list_orb_reverse(p1) - do i = 1, n_occ_ab(1) - h2 = occ(i,1) - if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle - h2 = list_orb_reverse(h2) - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - enddo - else + spin_trace = .True. + else return - endif endif - end - subroutine orb_range_off_diag_single_to_all_states_bb_dm_buffer(det_1,det_2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) +! if(alpha_alpha.or.spin_trace)then + call get_single_excitation(det_1,det_2,exc,phase,N_int) + if (exc(0,1,1) == 1) then + ! Mono alpha + h1 = exc(1,1,1) + if(.not.is_integer_in_string_local(h1,orb_bitmask,N_int))return + p1 = exc(1,2,1) + if(.not.is_integer_in_string_local(p1,orb_bitmask,N_int))return + + call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int) + + h1 = list_orb_reverse(h1) + p1 = list_orb_reverse(p1) + + phase = 0.5d0*phase + do i = 1, n_occ_ab(1) + h2 = occ(i,1) + if(.not.is_integer_in_string_local(h2,orb_bitmask,N_int))cycle + h2 = list_orb_reverse(h2) + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + enddo + else + return + endif +! endif +end + +subroutine orb_range_off_diag_single_to_all_states_bb_dm_buffer(det_1,det_2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) use bitmasks BEGIN_DOC - ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for - ! - ! a given couple of determinant det_1, det_2 being a BETA SINGLE excitation with respect to one another - ! - ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 - ! - ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation - ! - ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals - ! - ! ispin determines which spin-spin component of the two-rdm you will update - ! - ! ispin == 1 :: alpha/ alpha - ! ispin == 2 :: beta / beta - ! ispin == 3 :: alpha/ beta - ! ispin == 4 :: spin traced <=> total two-rdm - ! - ! here, only ispin == 2 or 4 will do something + ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for + ! + ! a given couple of determinant det_1, det_2 being a BETA SINGLE excitation with respect to one another + ! + ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 + ! + ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + ! + ! here, only ispin == 2 or 4 will do something END_DOC implicit none - integer, intent(in) :: ispin,sze_buff,N_st - integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) - integer, intent(in) :: list_orb_reverse(mo_num) - integer(bit_kind), intent(in) :: orb_bitmask(N_int) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - + integer, intent(in) :: ispin,sze_buff,N_st + integer(bit_kind), intent(in) :: det_1(N_int,2),det_2(N_int,2) + integer, intent(in) :: list_orb_reverse(mo_num) + integer(bit_kind), intent(in) :: orb_bitmask(N_int) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + integer :: occ(N_int*bit_kind_size,2) integer :: n_occ_ab(2) - integer :: i,j,h1,h2,p1,istate + integer :: i,j,h1,h2,p1,istate integer :: exc(0:2,2,2) double precision :: phase logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - logical :: is_integer_in_string - alpha_alpha = .False. + logical :: is_integer_in_string_local +! alpha_alpha = .False. beta_beta = .False. - alpha_beta = .False. +! alpha_beta = .False. spin_trace = .False. - if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. + if(ispin == 2)then + beta_beta = .True. else if(ispin == 4)then - spin_trace = .True. - endif - - - call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int) - call get_single_excitation(det_1,det_2,exc,phase,N_int) - if(beta_beta.or.spin_trace)then - if (exc(0,1,1) == 1) then + spin_trace = .True. + else return - else - ! Mono beta - h1 = exc(1,1,2) - if(.not.is_integer_in_string(h1,orb_bitmask,N_int))return - h1 = list_orb_reverse(h1) - p1 = exc(1,2,2) - if(.not.is_integer_in_string(p1,orb_bitmask,N_int))return - p1 = list_orb_reverse(p1) - do i = 1, n_occ_ab(2) - h2 = occ(i,2) - if(.not.is_integer_in_string(h2,orb_bitmask,N_int))cycle - h2 = list_orb_reverse(h2) - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h1 - keys(2,nkeys) = h2 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = h2 - keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 - enddo - endif endif - end - subroutine orb_range_off_diag_double_to_all_states_aa_dm_buffer(det_1,det_2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) +! if(beta_beta.or.spin_trace)then + call get_single_excitation(det_1,det_2,exc,phase,N_int) + if (exc(0,1,1) == 1) then + return + else + ! Mono beta + h1 = exc(1,1,2) + if(.not.is_integer_in_string_local(h1,orb_bitmask,N_int))return + p1 = exc(1,2,2) + if(.not.is_integer_in_string_local(p1,orb_bitmask,N_int))return + + call bitstring_to_list_ab(det_1, occ, n_occ_ab, N_int) + h1 = list_orb_reverse(h1) + p1 = list_orb_reverse(p1) + + phase = 0.5d0*phase + do i = 1, n_occ_ab(2) + h2 = occ(i,2) + if(.not.is_integer_in_string_local(h2,orb_bitmask,N_int))cycle + h2 = list_orb_reverse(h2) + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h1 + keys(2,nkeys) = h2 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = h2 + keys(4,nkeys) = p1 + + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + enddo + endif +! endif +end + + +subroutine orb_range_off_diag_double_to_all_states_aa_dm_buffer(det_1,det_2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) use bitmasks BEGIN_DOC - ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for - ! - ! a given couple of determinant det_1, det_2 being a ALPHA/ALPHA DOUBLE excitation with respect to one another - ! - ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 - ! - ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation - ! - ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals - ! - ! ispin determines which spin-spin component of the two-rdm you will update - ! - ! ispin == 1 :: alpha/ alpha - ! ispin == 2 :: beta / beta - ! ispin == 3 :: alpha/ beta - ! ispin == 4 :: spin traced <=> total two-rdm - ! - ! here, only ispin == 1 or 4 will do something + ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for + ! + ! a given couple of determinant det_1, det_2 being a ALPHA/ALPHA DOUBLE excitation with respect to one another + ! + ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 + ! + ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + ! + ! here, only ispin == 1 or 4 will do something END_DOC implicit none - integer, intent(in) :: ispin,sze_buff,N_st - integer(bit_kind), intent(in) :: det_1(N_int),det_2(N_int) - integer, intent(in) :: list_orb_reverse(mo_num) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - - - integer :: i,j,h1,h2,p1,p2,istate + integer, intent(in) :: ispin,sze_buff,N_st + integer(bit_kind), intent(in) :: det_1(N_int),det_2(N_int) + integer, intent(in) :: list_orb_reverse(mo_num) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + + + integer :: i,j,h1,h2,p1,p2,istate integer :: exc(0:2,2) double precision :: phase - + logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - logical :: is_integer_in_string - alpha_alpha = .False. - beta_beta = .False. - alpha_beta = .False. + logical :: is_integer_in_string_local + alpha_alpha = .False. +! beta_beta = .False. +! alpha_beta = .False. spin_trace = .False. if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. + alpha_alpha = .True. else if(ispin == 4)then - spin_trace = .True. + spin_trace = .True. + else + return endif call get_double_excitation_spin(det_1,det_2,exc,phase,N_int) h1 =exc(1,1) if(list_orb_reverse(h1).lt.0)return - h1 = list_orb_reverse(h1) h2 =exc(2,1) if(list_orb_reverse(h2).lt.0)return - h2 = list_orb_reverse(h2) p1 =exc(1,2) if(list_orb_reverse(p1).lt.0)return - p1 = list_orb_reverse(p1) p2 =exc(2,2) if(list_orb_reverse(p2).lt.0)return + + h1 = list_orb_reverse(h1) + h2 = list_orb_reverse(h2) + p1 = list_orb_reverse(p1) p2 = list_orb_reverse(p2) - if(alpha_alpha.or.spin_trace)then + + phase = 0.5d0*phase +! if(alpha_alpha.or.spin_trace)then nkeys += 1 - + do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = c_1(istate) * phase enddo keys(1,nkeys) = h1 keys(2,nkeys) = h2 @@ -783,16 +816,16 @@ subroutine orb_range_off_diag_double_to_all_states_aa_dm_buffer(det_1,det_2,c_1, nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = - c_1(istate) * phase enddo keys(1,nkeys) = h1 keys(2,nkeys) = h2 keys(3,nkeys) = p2 keys(4,nkeys) = p1 - + nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = c_1(istate) * phase enddo keys(1,nkeys) = h2 keys(2,nkeys) = h1 @@ -801,66 +834,64 @@ subroutine orb_range_off_diag_double_to_all_states_aa_dm_buffer(det_1,det_2,c_1, nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = - c_1(istate) * phase enddo keys(1,nkeys) = h2 keys(2,nkeys) = h1 keys(3,nkeys) = p1 keys(4,nkeys) = p2 - endif - end +! endif +end - subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) +subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) use bitmasks BEGIN_DOC - ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for - ! - ! a given couple of determinant det_1, det_2 being a BETA /BETA DOUBLE excitation with respect to one another - ! - ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 - ! - ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation - ! - ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals - ! - ! ispin determines which spin-spin component of the two-rdm you will update - ! - ! ispin == 1 :: alpha/ alpha - ! ispin == 2 :: beta / beta - ! ispin == 3 :: alpha/ beta - ! ispin == 4 :: spin traced <=> total two-rdm - ! - ! here, only ispin == 2 or 4 will do something + ! routine that update the OFF DIAGONAL PART of the two body rdms in a specific range of orbitals for + ! + ! a given couple of determinant det_1, det_2 being a BETA /BETA DOUBLE excitation with respect to one another + ! + ! c_1 is supposed to be a scalar quantity, such as state averaged coef of the determinant det_1 + ! + ! big_array(dim1,dim1,dim1,dim1) is the two-body rdm to be updated in physicist notation + ! + ! orb_bitmask(N_int) is the bitmask for the orbital range, list_orb_reverse(mo_num) is the inverse range of orbitals + ! + ! ispin determines which spin-spin component of the two-rdm you will update + ! + ! ispin == 1 :: alpha/ alpha + ! ispin == 2 :: beta / beta + ! ispin == 3 :: alpha/ beta + ! ispin == 4 :: spin traced <=> total two-rdm + ! + ! here, only ispin == 2 or 4 will do something END_DOC implicit none - - integer, intent(in) :: ispin,sze_buff,N_st - integer(bit_kind), intent(in) :: det_1(N_int),det_2(N_int) - integer, intent(in) :: list_orb_reverse(mo_num) - double precision, intent(in) :: c_1(N_st) - double precision, intent(out) :: values(N_st,sze_buff) - integer , intent(out) :: keys(4,sze_buff) - integer , intent(inout):: nkeys - - integer :: i,j,h1,h2,p1,p2,istate + + integer, intent(in) :: ispin,sze_buff,N_st + integer(bit_kind), intent(in) :: det_1(N_int),det_2(N_int) + integer, intent(in) :: list_orb_reverse(mo_num) + double precision, intent(in) :: c_1(N_st) + double precision, intent(out) :: values(N_st,sze_buff) + integer , intent(out) :: keys(4,sze_buff) + integer , intent(inout) :: nkeys + + integer :: i,j,h1,h2,p1,p2,istate integer :: exc(0:2,2) double precision :: phase logical :: alpha_alpha,beta_beta,alpha_beta,spin_trace - logical :: is_integer_in_string - alpha_alpha = .False. + logical :: is_integer_in_string_local +! alpha_alpha = .False. beta_beta = .False. - alpha_beta = .False. +! alpha_beta = .False. spin_trace = .False. - if( ispin == 1)then - alpha_alpha = .True. - else if(ispin == 2)then - beta_beta = .True. - else if(ispin == 3)then - alpha_beta = .True. + if(ispin == 2)then + beta_beta = .True. else if(ispin == 4)then - spin_trace = .True. + spin_trace = .True. + else + return endif - + call get_double_excitation_spin(det_1,det_2,exc,phase,N_int) h1 =exc(1,1) if(list_orb_reverse(h1).lt.0)return @@ -874,10 +905,12 @@ subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1, p2 =exc(2,2) if(list_orb_reverse(p2).lt.0)return p2 = list_orb_reverse(p2) - if(beta_beta.or.spin_trace)then + +! if(beta_beta.or.spin_trace)then + phase = 0.5d0*phase nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = c_1(istate) * phase enddo keys(1,nkeys) = h1 keys(2,nkeys) = h2 @@ -886,16 +919,16 @@ subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1, nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = - c_1(istate) * phase enddo keys(1,nkeys) = h1 keys(2,nkeys) = h2 keys(3,nkeys) = p2 keys(4,nkeys) = p1 - + nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = c_1(istate) * phase enddo keys(1,nkeys) = h2 keys(2,nkeys) = h1 @@ -904,12 +937,12 @@ subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1, nkeys += 1 do istate = 1, N_st - values(istate,nkeys) = - 0.5d0 * c_1(istate) * phase + values(istate,nkeys) = - c_1(istate) * phase enddo keys(1,nkeys) = h2 keys(2,nkeys) = h1 keys(3,nkeys) = p1 keys(4,nkeys) = p2 - endif - end +! endif +end From 2655f996228808592ab2e146f98eb52aa65292c5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 26 Feb 2025 15:14:51 +0100 Subject: [PATCH 095/175] Accelerated 2rdm --- src/two_rdm_routines/davidson_like_2rdm.irp.f | 156 ++++++++++++------ 1 file changed, 103 insertions(+), 53 deletions(-) diff --git a/src/two_rdm_routines/davidson_like_2rdm.irp.f b/src/two_rdm_routines/davidson_like_2rdm.irp.f index 0e6899f8..342b4318 100644 --- a/src/two_rdm_routines/davidson_like_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_2rdm.irp.f @@ -13,7 +13,7 @@ subroutine orb_range_2_rdm_openmp(big_array,dim1,norb,list_orb,ispin,u_0,N_st,sz END_DOC integer, intent(in) :: N_st,sze integer, intent(in) :: dim1,norb,list_orb(norb),ispin - double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1) + double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,N_st) double precision, intent(in) :: u_0(sze,N_st) integer :: k @@ -50,7 +50,7 @@ subroutine orb_range_2_rdm_openmp_work(big_array,dim1,norb,list_orb,ispin,u_t,N_ END_DOC integer, intent(in) :: N_st,sze,istart,iend,ishift,istep integer, intent(in) :: dim1,norb,list_orb(norb),ispin - double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1) + double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,N_st) double precision, intent(in) :: u_t(N_st,N_det) integer :: k @@ -91,7 +91,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin integer, intent(in) :: N_st,sze,istart,iend,ishift,istep double precision, intent(in) :: u_t(N_st,N_det) integer, intent(in) :: dim1,norb,list_orb(norb),ispin - double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1) + double precision, intent(inout) :: big_array(dim1,dim1,dim1,dim1,N_st) integer(omp_lock_kind) :: lock_2rdm integer :: i,j,k,l @@ -155,6 +155,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin ! Prepare the array of all alpha single excitations ! ------------------------------------------------- + double precision, allocatable :: big_array_local(:,:,:,:,:) + PROVIDE N_int nthreads_davidson elec_alpha_num !$OMP PARALLEL DEFAULT(NONE) NUM_THREADS(nthreads_davidson) & !$OMP SHARED(psi_bilinear_matrix_rows, N_det,lock_2rdm,& @@ -174,7 +176,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin !$OMP buffer, doubles, n_doubles, & !$OMP tmp_det2, idx, l, kcol_prev, & !$OMP singles_a, n_singles_a, singles_b, & - !$OMP n_singles_b, nkeys, keys, values) + !$OMP n_singles_b, nkeys, keys, values, big_array_local) ! Alpha/Beta double excitations ! ============================= @@ -185,6 +187,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin singles_b(maxab), & doubles(maxab), & idx(maxab)) + allocate( big_array_local(N_states,dim1, dim1, dim1, dim1) ) + big_array_local(:,:,:,:,:) = 0.d0 kcol_prev=-1 @@ -256,30 +260,32 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin do l= 1, N_states c_1(l) = u_t(l,l_a) * u_t(l,k_a) enddo - if(alpha_beta)then - ! only ONE contribution - if (nkeys+1 .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 - endif - else if (spin_trace)then - ! TWO contributions +! if(alpha_beta)then +! ! only ONE contribution +! if (nkeys+1 .ge. sze_buff) then +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! nkeys = 0 +! endif +! else if (spin_trace)then +! ! TWO contributions if (nkeys+2 .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif - endif +! endif call orb_range_off_diag_double_to_all_states_ab_dm_buffer(tmp_det,tmp_det2,c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) enddo endif enddo -! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) -! nkeys = 0 enddo - !$OMP END DO + !$OMP END DO NOWAIT +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) + nkeys = 0 !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep @@ -334,33 +340,36 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin ! ---------------------------------- tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, kcol) - do i=1,n_singles_a - l_a = singles_a(i) - ASSERT (l_a <= N_det) + if(alpha_beta.or.spin_trace.or.alpha_alpha)then + do i=1,n_singles_a + l_a = singles_a(i) + ASSERT (l_a <= N_det) - lrow = psi_bilinear_matrix_rows(l_a) - ASSERT (lrow <= N_det_alpha_unique) + lrow = psi_bilinear_matrix_rows(l_a) + ASSERT (lrow <= N_det_alpha_unique) + + tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) + do l= 1, N_states + c_1(l) = u_t(l,l_a) * u_t(l,k_a) + enddo - tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, lrow) - do l= 1, N_states - c_1(l) = u_t(l,l_a) * u_t(l,k_a) - enddo - if(alpha_beta.or.spin_trace.or.alpha_alpha)then ! increment the alpha/beta part for single excitations if (nkeys+ 2 * elec_alpha_num .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif call orb_range_off_diag_single_to_all_states_ab_dm_buffer(tmp_det, tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) ! increment the alpha/alpha part for single excitations if (nkeys+4 * elec_alpha_num .ge. sze_buff ) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif call orb_range_off_diag_single_to_all_states_aa_dm_buffer(tmp_det,tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) - endif - enddo + enddo + endif ! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) ! nkeys = 0 @@ -380,7 +389,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin c_1(l) = u_t(l,l_a) * u_t(l,k_a) enddo if (nkeys+4 .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif call orb_range_off_diag_double_to_all_states_aa_dm_buffer(tmp_det(1,1),psi_det_alpha_unique(1, lrow),c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) @@ -435,33 +445,37 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin ! ---------------------------------- tmp_det2(1:$N_int,1) = psi_det_alpha_unique(1:$N_int, krow) - do i=1,n_singles_b - l_b = singles_b(i) - ASSERT (l_b <= N_det) + if(alpha_beta.or.spin_trace.or.beta_beta)then + do i=1,n_singles_b + l_b = singles_b(i) + ASSERT (l_b <= N_det) - lcol = psi_bilinear_matrix_transp_columns(l_b) - ASSERT (lcol <= N_det_beta_unique) + lcol = psi_bilinear_matrix_transp_columns(l_b) + ASSERT (lcol <= N_det_beta_unique) + + tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol) + l_a = psi_bilinear_matrix_transp_order(l_b) + do l= 1, N_states + c_1(l) = u_t(l,l_a) * u_t(l,k_a) + enddo - tmp_det2(1:$N_int,2) = psi_det_beta_unique (1:$N_int, lcol) - l_a = psi_bilinear_matrix_transp_order(l_b) - do l= 1, N_states - c_1(l) = u_t(l,l_a) * u_t(l,k_a) - enddo - if(alpha_beta.or.spin_trace.or.beta_beta)then ! increment the alpha/beta part for single excitations if (nkeys+2 * elec_alpha_num .ge. sze_buff ) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif call orb_range_off_diag_single_to_all_states_ab_dm_buffer(tmp_det, tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) ! increment the beta /beta part for single excitations if (nkeys+4 * elec_alpha_num .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif call orb_range_off_diag_single_to_all_states_bb_dm_buffer(tmp_det, tmp_det2,c_1,N_st,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) - endif - enddo + enddo + endif + ! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) ! nkeys = 0 @@ -481,7 +495,8 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin c_1(l) = u_t(l,l_a) * u_t(l,k_a) enddo if (nkeys+4 .ge. sze_buff) then - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 endif call orb_range_off_diag_double_to_all_states_bb_dm_buffer(tmp_det(1,2),psi_det_beta_unique(1, lcol),c_1,N_st,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) @@ -517,16 +532,28 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin c_1(l) = u_t(l,k_a) * u_t(l,k_a) enddo - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) - nkeys = 0 + if (nkeys+elec_alpha_num*elec_alpha_num .ge. sze_buff) then +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) + nkeys = 0 + endif + call orb_range_diag_to_all_states_2_rdm_dm_buffer(tmp_det,c_1,N_states,orb_bitmask,list_orb_reverse,ispin,sze_buff,nkeys,keys,values) - call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + +! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) + call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 end do - !$OMP END DO + !$OMP END DO NOWAIT deallocate(buffer, singles_a, singles_b, doubles, idx, keys, values) - !$OMP END PARALLEL + !$OMP CRITICAL + do i=1,N_states + big_array(:,:,:,:,i) = big_array(:,:,:,:,i) + big_array_local(i,:,:,:,:) + enddo + !$OMP END CRITICAL + deallocate(big_array_local) + !$OMP END PARALLEL end @@ -593,3 +620,26 @@ subroutine update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,loc end +subroutine update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) + use omp_lib + implicit none + integer, intent(in) :: n_st,nkeys,dim1 + integer, intent(in) :: keys(4,nkeys) + double precision, intent(in) :: values(n_st,nkeys) + double precision, intent(inout) :: big_array_local(n_st,dim1,dim1,dim1,dim1) + + integer :: istate + integer :: i,h1,h2,p1,p2 + + do i = 1, nkeys + do istate = 1, N_st + h1 = keys(1,i) + h2 = keys(2,i) + p1 = keys(3,i) + p2 = keys(4,i) + big_array_local(istate,h1,h2,p1,p2) = big_array_local(istate,h1,h2,p1,p2) + values(istate,i) + enddo + enddo + +end + From 1d5f2f37351775a51ac61404985ef07a9901b188 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 26 Feb 2025 15:26:22 +0100 Subject: [PATCH 096/175] Optim in 2RDM --- src/two_rdm_routines/davidson_like_2rdm.irp.f | 8 +-- src/two_rdm_routines/update_rdm.irp.f | 72 +++++++++---------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/two_rdm_routines/davidson_like_2rdm.irp.f b/src/two_rdm_routines/davidson_like_2rdm.irp.f index 342b4318..d92f1924 100644 --- a/src/two_rdm_routines/davidson_like_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_2rdm.irp.f @@ -632,11 +632,11 @@ subroutine update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_arr integer :: i,h1,h2,p1,p2 do i = 1, nkeys + h1 = keys(1,i) + h2 = keys(2,i) + p1 = keys(3,i) + p2 = keys(4,i) do istate = 1, N_st - h1 = keys(1,i) - h2 = keys(2,i) - p1 = keys(3,i) - p2 = keys(4,i) big_array_local(istate,h1,h2,p1,p2) = big_array_local(istate,h1,h2,p1,p2) + values(istate,i) enddo enddo diff --git a/src/two_rdm_routines/update_rdm.irp.f b/src/two_rdm_routines/update_rdm.irp.f index 978f6e33..f01706f0 100644 --- a/src/two_rdm_routines/update_rdm.irp.f +++ b/src/two_rdm_routines/update_rdm.irp.f @@ -592,6 +592,15 @@ subroutine orb_range_off_diag_single_to_all_states_aa_dm_buffer(det_1,det_2,c_1, keys(3,nkeys) = p1 keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + nkeys += 1 do istate = 1, N_st values(istate,nkeys) = - c_1(istate) * phase @@ -609,15 +618,6 @@ subroutine orb_range_off_diag_single_to_all_states_aa_dm_buffer(det_1,det_2,c_1, keys(2,nkeys) = h1 keys(3,nkeys) = h2 keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 enddo else return @@ -706,6 +706,15 @@ subroutine orb_range_off_diag_single_to_all_states_bb_dm_buffer(det_1,det_2,c_1, keys(3,nkeys) = p1 keys(4,nkeys) = h2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p1 + keys(4,nkeys) = h2 + nkeys += 1 do istate = 1, N_st values(istate,nkeys) = - c_1(istate) * phase @@ -723,15 +732,6 @@ subroutine orb_range_off_diag_single_to_all_states_bb_dm_buffer(det_1,det_2,c_1, keys(2,nkeys) = h1 keys(3,nkeys) = h2 keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p1 - keys(4,nkeys) = h2 enddo endif ! endif @@ -814,6 +814,15 @@ subroutine orb_range_off_diag_double_to_all_states_aa_dm_buffer(det_1,det_2,c_1, keys(3,nkeys) = p1 keys(4,nkeys) = p2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p1 + keys(4,nkeys) = p2 + nkeys += 1 do istate = 1, N_st values(istate,nkeys) = - c_1(istate) * phase @@ -831,15 +840,6 @@ subroutine orb_range_off_diag_double_to_all_states_aa_dm_buffer(det_1,det_2,c_1, keys(2,nkeys) = h1 keys(3,nkeys) = p2 keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p1 - keys(4,nkeys) = p2 ! endif end @@ -917,6 +917,15 @@ subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1, keys(3,nkeys) = p1 keys(4,nkeys) = p2 + nkeys += 1 + do istate = 1, N_st + values(istate,nkeys) = - c_1(istate) * phase + enddo + keys(1,nkeys) = h2 + keys(2,nkeys) = h1 + keys(3,nkeys) = p1 + keys(4,nkeys) = p2 + nkeys += 1 do istate = 1, N_st values(istate,nkeys) = - c_1(istate) * phase @@ -934,15 +943,6 @@ subroutine orb_range_off_diag_double_to_all_states_bb_dm_buffer(det_1,det_2,c_1, keys(2,nkeys) = h1 keys(3,nkeys) = p2 keys(4,nkeys) = p1 - - nkeys += 1 - do istate = 1, N_st - values(istate,nkeys) = - c_1(istate) * phase - enddo - keys(1,nkeys) = h2 - keys(2,nkeys) = h1 - keys(3,nkeys) = p1 - keys(4,nkeys) = p2 ! endif end From db48267259b6d8c627bb6987925714945c590895 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 27 Feb 2025 13:07:59 +0100 Subject: [PATCH 097/175] 1/sqrt(2) in basis correction proj --- external/ezfio | 2 +- src/mu_of_r/mu_of_r_conditions.irp.f | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/ezfio b/external/ezfio index d02132ea..dba01c4f 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 +Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index 3ad52a05..ba3675d4 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -269,7 +269,7 @@ ! epsilon mu_of_r_projector_mo(ipoint) = 1.d0/(2.d0*dacos(-1.d0) * mu_of_r_projector_mo(ipoint)**(2.d0/3.d0)) ! mu - mu_of_r_projector_mo(ipoint) = 1.d0/dsqrt( mu_of_r_projector_mo(ipoint) ) + mu_of_r_projector_mo(ipoint) = 1.d0/dsqrt( 2.d0*mu_of_r_projector_mo(ipoint) ) enddo END_PROVIDER From de26e8494ec59afdbae0e8f3c70337d94f498e1d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 28 Feb 2025 11:39:43 +0100 Subject: [PATCH 098/175] Added do_mo_cholesky keyword --- src/mo_two_e_ints/EZFIO.cfg | 6 ++++++ src/mo_two_e_ints/cholesky.irp.f | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/mo_two_e_ints/EZFIO.cfg b/src/mo_two_e_ints/EZFIO.cfg index f26bfb61..8844b8a6 100644 --- a/src/mo_two_e_ints/EZFIO.cfg +++ b/src/mo_two_e_ints/EZFIO.cfg @@ -1,3 +1,9 @@ +[do_mo_cholesky] +type: logical +doc: Use Cholesky decomposition of MO integrals in CI calculations +interface: ezfio,provider,ocaml +default: False + [io_mo_cholesky] type: Disk_access doc: Read/Write |MO| Cholesky integrals from/to disk [ Write | Read | None ] diff --git a/src/mo_two_e_ints/cholesky.irp.f b/src/mo_two_e_ints/cholesky.irp.f index 062e52e2..f4e390af 100644 --- a/src/mo_two_e_ints/cholesky.irp.f +++ b/src/mo_two_e_ints/cholesky.irp.f @@ -1,12 +1,3 @@ -BEGIN_PROVIDER [ logical, do_mo_cholesky ] - implicit none - BEGIN_DOC - ! If True, use Cholesky vectors for MO integrals - END_DOC - do_mo_cholesky = do_ao_cholesky -! do_mo_cholesky = .False. -END_PROVIDER - BEGIN_PROVIDER [ integer, cholesky_mo_num ] &BEGIN_PROVIDER [ integer, cholesky_mo_num_split, (1:5)] implicit none From 61ddf14ab9665ac8af4f2bd0aac07b4d071a5c69 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 28 Feb 2025 18:04:16 +0100 Subject: [PATCH 099/175] Added average mu(r) with rho^2 --- .../basis_correction/print_routine.irp.f | 3 +- src/mu_of_r/mu_of_r_conditions.irp.f | 30 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/plugins/local/basis_correction/print_routine.irp.f b/plugins/local/basis_correction/print_routine.irp.f index 8879fd5d..cc9744f2 100644 --- a/plugins/local/basis_correction/print_routine.irp.f +++ b/plugins/local/basis_correction/print_routine.irp.f @@ -79,7 +79,8 @@ subroutine print_basis_correction print*,'' print*,'**************' do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) , state ',istate,' = ',mu_average_prov(istate) + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) [rho ], state ',istate,' = ',mu_average_prov(istate) + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) [rho^2], state ',istate,' = ',mu_average_prov2(istate) enddo end diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index ba3675d4..d13605f6 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -211,7 +211,7 @@ END_PROVIDER - BEGIN_PROVIDER [double precision, mu_average_prov, (N_states)] +BEGIN_PROVIDER [double precision, mu_average_prov, (N_states)] implicit none BEGIN_DOC ! average value of mu(r) weighted with the total one-e density and divided by the number of electrons @@ -233,7 +233,33 @@ enddo mu_average_prov(istate) = mu_average_prov(istate) / elec_num_grid_becke(istate) enddo - END_PROVIDER +END_PROVIDER + +BEGIN_PROVIDER [double precision, mu_average_prov2, (N_states)] + implicit none + BEGIN_DOC + ! average value of mu(r) weighted with square of the total one-e density + ! + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! + ! in the one- and two-body density matrix are excluded + END_DOC + integer :: ipoint,istate + double precision :: weight,density,norm + mu_average_prov2 = 0.d0 + do istate = 1, N_states + norm = 0.d0 + do ipoint = 1, n_points_final_grid + weight =final_weight_at_r_vector(ipoint) + density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle + mu_average_prov2(istate) += mu_of_r_prov(ipoint,istate) * weight * density*density + norm = norm + density*density*weight + enddo + mu_average_prov2(istate) = mu_average_prov2(istate) / norm + enddo +END_PROVIDER BEGIN_PROVIDER [double precision, mu_of_r_projector_mo, (n_points_final_grid) ] From 7d940958a3978b6dee271a3487e14d4a6a8d076f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Mar 2025 18:36:40 +0100 Subject: [PATCH 100/175] Update irpf90 --- external/ezfio | 2 +- external/irpf90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 diff --git a/external/irpf90 b/external/irpf90 index 4ab1b175..bd35d581 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 +Subproject commit bd35d581d917c452054c074b88667fe4b5e7ca27 From fa75be002a1fe17c9fd68041e2429084f609c94d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Mar 2025 18:45:46 +0100 Subject: [PATCH 101/175] Fix irpf90 --- external/irpf90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/irpf90 b/external/irpf90 index bd35d581..43160c60 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit bd35d581d917c452054c074b88667fe4b5e7ca27 +Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b From 1775df957c53f5139076e79f963e2191ca8c4d64 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 7 Mar 2025 15:31:48 +0100 Subject: [PATCH 102/175] Added geometry optimization script --- scripts/qp_cipsi_rsh | 1 + scripts/qp_cipsi_rsh_mu_of_r | 1 + scripts/qp_geom_opt.py | 136 +++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+) create mode 120000 scripts/qp_cipsi_rsh create mode 120000 scripts/qp_cipsi_rsh_mu_of_r create mode 100755 scripts/qp_geom_opt.py diff --git a/scripts/qp_cipsi_rsh b/scripts/qp_cipsi_rsh new file mode 120000 index 00000000..c3d4376b --- /dev/null +++ b/scripts/qp_cipsi_rsh @@ -0,0 +1 @@ +/home/scemama/qp2/plugins/qp_plugins_lct/stable/rsdft_cipsi/qp_cipsi_rsh \ No newline at end of file diff --git a/scripts/qp_cipsi_rsh_mu_of_r b/scripts/qp_cipsi_rsh_mu_of_r new file mode 120000 index 00000000..feef7119 --- /dev/null +++ b/scripts/qp_cipsi_rsh_mu_of_r @@ -0,0 +1 @@ +/home/scemama/qp2/plugins/qp_plugins_lct/stable/rsdft_cipsi/qp_cipsi_rsh_mu_of_r \ No newline at end of file diff --git a/scripts/qp_geom_opt.py b/scripts/qp_geom_opt.py new file mode 100755 index 00000000..240a411f --- /dev/null +++ b/scripts/qp_geom_opt.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Usage: + qp_geom_opt [-s state] [-r executable] [-f] [-t tolerance] + +Options: + -s --state= Excited state to optimize + -f --scf Perform an SCF after each geomety change + -r --qp_run=executable Excited state to optimize + -t --tol=tolerance Convergence criterion on the energy +""" + + +try: + from docopt import docopt + from module_handler import ModuleHandler, get_dict_child + from module_handler import get_l_module_descendant + from qp_path import QP_SRC, QP_PLUGINS, QP_DATA, QP_ROOT +except ImportError: + print("Please check if you have sourced the ${QP_ROOT}/quantum_package.rc") + print("(`source ${QP_ROOT}/quantum_package.rc`)") + print(sys.exit(1)) + + +import numpy as np +import subprocess +from scipy.optimize import minimize +from ezfio import ezfio + +import sys + + +def set_unbuffered_output(): + """Ensure sys.stdout is unbuffered or line-buffered in a portable way.""" + if hasattr(sys.stdout, "reconfigure"): # Python 3.7+ + sys.stdout.reconfigure(line_buffering=True) + else: + sys.stdout = open(sys.stdout.fileno(), mode='w', buffering=1) + +set_unbuffered_output() + + + + +def get_energy(file, state, arguments): + """Compute the energy of the given state by calling Quantum Package.""" + if not arguments["--qp_run"]: + raise ValueError("--qp_run option missing") + + if arguments["--scf"]: + executable = "scf" + else: + executable = "save_ortho_mos" + + result = subprocess.run(f"qp_run {executable} {file} > {file}.energy.out", + shell=True, capture_output=True, text=True, check=True + ) + + executable = arguments["--qp_run"] + result = subprocess.run( f"qp_run {executable} {file} > {file}.energy.out", + shell=True) + + energy = None + with open(f"{file}.energy.out", 'r') as f: + for line in f: + if "Energy of state" in line and f"{state}" in line: + energy = float(line.split()[-1]) # Extracts the energy value + + return energy + raise ValueError("Energy not found in Quantum Package output. Update script {sys.argv[0]}") + +def set_coordinates(coord): + """Update the nuclear coordinates in EZFIO.""" + ezfio.set_nuclei_nucl_coord(coord) + + +def get_coordinates(): + """Retrieve the current nuclear coordinates from EZFIO.""" + return np.array(ezfio.get_nuclei_nucl_coord()) + + +def energy_function(coord, file, state, arguments): + """Wrapper for the energy calculation, ensuring coordinates are updated.""" + set_coordinates(coord) + energy = get_energy(file, state, arguments) + + label = ezfio.get_nuclei_nucl_label() + num_atoms = len(label) + coord = coord.reshape(3, num_atoms).T # Reshape into (num_atoms, 3) + coord_angstrom = coord * 0.529177 # Convert atomic units to angstroms + + print(num_atoms) + print(f"Energy: {energy:15.10f}") + for i, (x, y, z) in enumerate(coord_angstrom): + print(f"{label[i]:3s} {x:15.8f} {y:15.8f} {z:15.8f}") # Replace 'X' with actual atomic symbols + return energy + + +def optimize_geometry(file, state, arguments): + """Perform geometry optimization using SciPy's minimize function.""" + + x0 = get_coordinates().flatten() + + if arguments["--tol"]: + tolerance = float(tol=arguments["--tol"]) + else: + tolerance = 1.e-3 + + result = minimize(energy_function, x0, args=(file, state, arguments), method='BFGS', jac=None, tol=tolerance, options={'eps': 1.e-3}) + + if result.success: + print("Optimization successful!") + print("Final energy:", result.fun) + print("Optimized coordinates:", result.x) + else: + print("Optimization failed:", result.message) + + set_coordinates(result.x) # Store the optimized geometry + return result + + +def main(arguments): + if arguments["--state"]: + state=arguments["--state"] + else: + state=1 + ezfio_filename = arguments[""] + ezfio.set_file(ezfio_filename) + + optimize_geometry(ezfio_filename, state, arguments) + + +if __name__ == "__main__": + ARG = docopt(__doc__) + main(ARG) From ad0c807a53c909b7c59b6fcae6d92d3fdcb8bf23 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 7 Mar 2025 15:41:18 +0100 Subject: [PATCH 103/175] Change for Powell in geom_opt --- scripts/qp_geom_opt.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/qp_geom_opt.py b/scripts/qp_geom_opt.py index 240a411f..73c8ce8e 100755 --- a/scripts/qp_geom_opt.py +++ b/scripts/qp_geom_opt.py @@ -107,7 +107,16 @@ def optimize_geometry(file, state, arguments): else: tolerance = 1.e-3 - result = minimize(energy_function, x0, args=(file, state, arguments), method='BFGS', jac=None, tol=tolerance, options={'eps': 1.e-3}) + result = minimize(energy_function, x0, args=(file, state, arguments), + method='Powell', + tol=tolerance, + options={'xtol': tolerance, 'ftol': tolerance}) + +# result = minimize(energy_function, x0, args=(file, state, arguments), +# method='BFGS', +# jac=None, +# tol=tolerance, +# options={'eps': 1.e-3}) if result.success: print("Optimization successful!") From 69d5811d14dbaebce578aedd5ebf3d81b179ae22 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 7 Mar 2025 15:54:55 +0100 Subject: [PATCH 104/175] Change for Powell in geom_opt --- scripts/qp_geom_opt.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/qp_geom_opt.py b/scripts/qp_geom_opt.py index 73c8ce8e..c089a5d8 100755 --- a/scripts/qp_geom_opt.py +++ b/scripts/qp_geom_opt.py @@ -80,10 +80,16 @@ def get_coordinates(): return np.array(ezfio.get_nuclei_nucl_coord()) +memo_energy = {} def energy_function(coord, file, state, arguments): """Wrapper for the energy calculation, ensuring coordinates are updated.""" + h = np.array_str(coord) + if h in memo_energy: + return memo_energy[h] + set_coordinates(coord) energy = get_energy(file, state, arguments) + memo_energy[h] = energy label = ezfio.get_nuclei_nucl_label() num_atoms = len(label) From 3552856ca79f40687f331a885dbb603857fcc38b Mon Sep 17 00:00:00 2001 From: eginer Date: Tue, 11 Mar 2025 18:37:00 +0100 Subject: [PATCH 105/175] working on extra_basis_int --- external/ezfio | 2 +- .../extra_basis_int/extra_basis_int.irp.f | 22 ++++++++++---- .../local/extra_basis_int/pot_ao_ints.irp.f | 29 +++++++++++++++++++ src/ao_extra_basis/qp_copy_extra_basis | 2 +- 4 files changed, 47 insertions(+), 8 deletions(-) diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 1d35b1c2..13c31f36 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -11,18 +11,28 @@ program extra_basis_int ! call routine_pot_ne ! call routine_test_pot_ne_extra_mixed ! call routine_test_coul_1s - call print_v_ne_extra_basis - call print_v_ne_basis +! call print_v_ne_extra_basis +! call print_v_ne_basis + call test_v_ne_a_extra_basis end +subroutine test_v_ne_a_extra_basis + implicit none + integer :: i,j + do i = 1, ao_extra_num + write(*,'(100(F16.10,X))')pot_vne_A_extra_basis(1:ao_extra_num,i) + enddo +end + + subroutine test_overlap implicit none integer :: i,j - do i = 1, ao_extra_num - do j = 1, ao_extra_num - write(33,*)ao_extra_overlap(j,i) - enddo + do i = 1, ao_num +! do j = 1, ao_num + write(33,'(100(F16.10,X))')ao_extra_overlap_mixed(i,1:ao_extra_num) +! enddo enddo end diff --git a/plugins/local/extra_basis_int/pot_ao_ints.irp.f b/plugins/local/extra_basis_int/pot_ao_ints.irp.f index 5f3af244..1828f980 100644 --- a/plugins/local/extra_basis_int/pot_ao_ints.irp.f +++ b/plugins/local/extra_basis_int/pot_ao_ints.irp.f @@ -1,3 +1,32 @@ +BEGIN_PROVIDER [ double precision, pot_vne_A_extra_basis, (ao_extra_num,ao_extra_num)] + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\sum_{R in nuclei} -Z $ + ! + ! + ! where $\chi_i(r)$ AND $\chi_j(r)$ belongs to the extra basis + END_DOC + integer :: mu,nu,k_nucl + double precision :: mu_in, R_nucl(3),charge_nucl, integral + double precision :: NAI_pol_mult_erf_ao_extra + mu_in = 10.d0**10 + pot_vne_A_extra_basis = 0.d0 + do mu = 1, ao_extra_num + do nu = 1, ao_extra_num + do k_nucl = 1, nucl_num + R_nucl(1:3) = nucl_coord_transp(1:3,k_nucl) + charge_nucl = nucl_charge(k_nucl) + integral = NAI_pol_mult_erf_ao_extra(mu, nu, mu_in, R_nucl) + pot_vne_A_extra_basis(nu,mu) += -integral * charge_nucl + enddo + enddo + enddo + +END_PROVIDER + + double precision function NAI_pol_mult_erf_ao_extra(i_ao, j_ao, mu_in, C_center) diff --git a/src/ao_extra_basis/qp_copy_extra_basis b/src/ao_extra_basis/qp_copy_extra_basis index cb435e18..6d0e17b8 100755 --- a/src/ao_extra_basis/qp_copy_extra_basis +++ b/src/ao_extra_basis/qp_copy_extra_basis @@ -58,7 +58,7 @@ do done i=primitives_normalized newfile=primitives_normalized_extra -cp ${EZFIO_extra}/ao_basis/$i ${EZFIO_target}/ao_extra_basis/$newfile +cp ${EZFIO_extra}/basis/$i ${EZFIO_target}/ao_extra_basis/$newfile echo "COPYING ALL DATA FROM "$EZFIO_extra"/aux_quantities/ to "${EZFIO_target}"/ao_extra_basis/" i=data_one_e_dm_tot_ao.gz From a9a91f5a9fae8e34de7eed39b70d6a957607072f Mon Sep 17 00:00:00 2001 From: eginer Date: Tue, 11 Mar 2025 23:51:57 +0100 Subject: [PATCH 106/175] modified fit_1s_basis.irp.f --- external/irpf90 | 2 +- plugins/local/extra_basis_int/coul_1s.irp.f | 10 +++++ .../local/extra_basis_int/pot_ao_ints.irp.f | 44 ++++++++++++++----- .../local/extra_basis_int/v_mixed_extra.irp.f | 27 ++++++++++++ src/ao_extra_basis/fit_1s_basis.irp.f | 1 + 5 files changed, 72 insertions(+), 12 deletions(-) diff --git a/external/irpf90 b/external/irpf90 index 43160c60..4ab1b175 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b +Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 diff --git a/plugins/local/extra_basis_int/coul_1s.irp.f b/plugins/local/extra_basis_int/coul_1s.irp.f index 964ed36a..62ec4331 100644 --- a/plugins/local/extra_basis_int/coul_1s.irp.f +++ b/plugins/local/extra_basis_int/coul_1s.irp.f @@ -11,6 +11,11 @@ double precision function coul_full_ao_pq_r_1s(p,q,R,R_p,R_q) double precision, intent(in) :: R(3),R_p(3),R_q(3) integer, intent(in) :: p,q double precision :: coef,dist,P_pq(3),coefaos + if(.not.ao_extra_only_1s)then + print*,'You are using a function assuming that the extra basis is fitted on 1s functions' + print*,'But this is not the case apparently ... stopping' + stop + endif coefaos= ao_extra_coef_normalized(p,1) * ao_extra_coef_normalized(q,1) coef = inv_pi_gamma_pq_3_2_ao_extra(p,q) * E_pq_ao_extra(p,q) P_pq = ao_extra_expo(p,1) * R_p + ao_extra_expo(q,1) * R_q @@ -40,6 +45,11 @@ double precision function coul_pq_r_1s(p,q,R,R_p,R_q) double precision, intent(in) :: R(3),R_p(3),R_q(3) integer, intent(in) :: p,q double precision :: dist,P_pq(3) + if(.not.ao_extra_only_1s)then + print*,'You are using a function assuming that the extra basis is fitted on 1s functions' + print*,'But this is not the case apparently ... stopping' + stop + endif P_pq = ao_extra_expo(p,1) * R_p + ao_extra_expo(q,1) * R_q P_pq = P_pq * inv_gamma_pq_ao_extra(q,p) dist = (P_pq(1)-R(1)) * (P_pq(1)-R(1)) diff --git a/plugins/local/extra_basis_int/pot_ao_ints.irp.f b/plugins/local/extra_basis_int/pot_ao_ints.irp.f index 1828f980..5a7d7580 100644 --- a/plugins/local/extra_basis_int/pot_ao_ints.irp.f +++ b/plugins/local/extra_basis_int/pot_ao_ints.irp.f @@ -3,23 +3,45 @@ BEGIN_DOC ! ! Computes the following integral : - ! $\sum_{R in nuclei} -Z $ + ! $\sum_{R in the USUAL nuclei} -Z $ ! ! - ! where $\chi_i(r)$ AND $\chi_j(r)$ belongs to the extra basis + ! where $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis END_DOC - integer :: mu,nu,k_nucl - double precision :: mu_in, R_nucl(3),charge_nucl, integral - double precision :: NAI_pol_mult_erf_ao_extra - mu_in = 10.d0**10 + integer :: mu,nu + double precision :: v_nucl_extra_ao pot_vne_A_extra_basis = 0.d0 do mu = 1, ao_extra_num do nu = 1, ao_extra_num - do k_nucl = 1, nucl_num - R_nucl(1:3) = nucl_coord_transp(1:3,k_nucl) - charge_nucl = nucl_charge(k_nucl) - integral = NAI_pol_mult_erf_ao_extra(mu, nu, mu_in, R_nucl) - pot_vne_A_extra_basis(nu,mu) += -integral * charge_nucl + pot_vne_A_extra_basis(nu,mu)= v_nucl_extra_ao(mu,nu) + enddo + enddo + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, pot_vne_extra_basis, (ao_num,ao_num)] + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\sum_{R in EXTRA nuclei} -Z $ + ! + ! + ! where $\chi_i(r)$ AND $\chi_j(r)$ belongs to the USUAL basis + END_DOC + integer :: mu,nu,k_nucl + double precision :: mu_in, R_nucl(3),charge_nucl, integral + double precision :: NAI_pol_mult_erf_ao + mu_in = 10.d0**10 + pot_vne_extra_basis = 0.d0 + do mu = 1, ao_num + do nu = 1, ao_num + do k_nucl = 1, extra_nucl_num + R_nucl(1:3) = extra_nucl_coord_transp(1:3,k_nucl) + charge_nucl = extra_nucl_charge(k_nucl) + integral = NAI_pol_mult_erf_ao(mu, nu, mu_in, R_nucl) + pot_vne_extra_basis(nu,mu) += -integral * charge_nucl enddo enddo enddo diff --git a/plugins/local/extra_basis_int/v_mixed_extra.irp.f b/plugins/local/extra_basis_int/v_mixed_extra.irp.f index ac856692..15958ab5 100644 --- a/plugins/local/extra_basis_int/v_mixed_extra.irp.f +++ b/plugins/local/extra_basis_int/v_mixed_extra.irp.f @@ -1,3 +1,6 @@ +!!! TODO:: optimize when "ao_extra_only_1s" is True + + double precision function v_extra_nucl_extra_ao(i_ao,j_ao) implicit none BEGIN_DOC @@ -23,6 +26,30 @@ double precision function v_extra_nucl_extra_ao(i_ao,j_ao) enddo end +double precision function v_extra_nucl_ao(i_ao,j_ao) + implicit none + BEGIN_DOC + ! + ! Computes the following integral : + ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne(r)$. + ! + ! + ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the REGULAR basis + ! + ! and v_ne(r) is the Coulomb potential coming from the EXTRA nuclei + END_DOC + integer, intent(in) ::i_ao,j_ao + integer :: i + double precision :: mu_in, coord(3),charge, integral + double precision :: NAI_pol_mult_erf_ao + mu_in = 1.d+10 + do i = 1, extra_nucl_num + coord(1:3) = extra_nucl_coord_transp(1:3,i) + charge = extra_nucl_charge(i) + v_extra_nucl_ao += -NAI_pol_mult_erf_ao(i_ao, j_ao, mu_in, coord) * charge + enddo +end + double precision function v_nucl_extra_ao(i_ao,j_ao) implicit none diff --git a/src/ao_extra_basis/fit_1s_basis.irp.f b/src/ao_extra_basis/fit_1s_basis.irp.f index ef09d5b2..9c788173 100644 --- a/src/ao_extra_basis/fit_1s_basis.irp.f +++ b/src/ao_extra_basis/fit_1s_basis.irp.f @@ -31,6 +31,7 @@ program fit_1s_basis call ezfio_set_extra_nuclei_extra_nucl_label(new_nucl_label_1s) ! call ezfio_set_ao_extra_basis_ao_extra_num(n_func_tot) + call ezfio_set_ao_extra_basis_ao_extra_only_1s(.True.) call ezfio_set_ao_extra_basis_ao_extra_center(ao_extra_center) call ezfio_set_ao_extra_basis_ao_extra_nucl(new_ao_nucl_1s) call ezfio_set_ao_extra_basis_ao_extra_prim_num(new_ao_prim_num_1s) From a6091ef989993ea447c63d5dda4a56bf33ecec7c Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 12 Mar 2025 11:18:35 +0100 Subject: [PATCH 107/175] two_e_int.irp.f is OK --- .../extra_basis_int/extra_basis_int.irp.f | 19 ++++- .../extra_basis_int/ref_extra_basis.irp.f | 19 ++++- plugins/local/extra_basis_int/two_e_int.irp.f | 71 +++++++++++++++++++ 3 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 plugins/local/extra_basis_int/two_e_int.irp.f diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 13c31f36..1f2919ba 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -13,7 +13,8 @@ program extra_basis_int ! call routine_test_coul_1s ! call print_v_ne_extra_basis ! call print_v_ne_basis - call test_v_ne_a_extra_basis +! call test_v_ne_a_extra_basis + call print_v_ee_mixed_direct end @@ -199,3 +200,19 @@ subroutine print_v_ne_basis print*,'accu = ',accu end + +subroutine print_v_ee_mixed_direct + implicit none + integer :: i,j,k,l + double precision :: ao_two_e_integral_mixed_direct + do i = 1, ao_num + do j = 1, ao_num + do k = 1, ao_extra_num + do l = 1, ao_extra_num + write(34,*)ao_two_e_integral_mixed_direct(i, j, k, l) + enddo + enddo + enddo + enddo + +end diff --git a/plugins/local/extra_basis_int/ref_extra_basis.irp.f b/plugins/local/extra_basis_int/ref_extra_basis.irp.f index 39055fd0..8265bb9c 100644 --- a/plugins/local/extra_basis_int/ref_extra_basis.irp.f +++ b/plugins/local/extra_basis_int/ref_extra_basis.irp.f @@ -6,7 +6,8 @@ program pouet ! call routine_pot_ne_extra ! call ref_pot_ne_mixed ! call ref_pot_ne - call ref_pot_ne_extra_mixed +! call ref_pot_ne_extra_mixed + call ref_v_ee_mixed_direct end @@ -113,3 +114,19 @@ subroutine ref_pot_ne_extra_mixed enddo enddo end + +subroutine ref_v_ee_mixed_direct + implicit none + integer :: i,j,k,l + double precision :: ao_two_e_integral + do i = 1, 15 + do j = 1, 15 + do k = 16, ao_num + do l = 16, ao_num + write(33,*)ao_two_e_integral(i, j, k, l) + enddo + enddo + enddo + enddo + +end diff --git a/plugins/local/extra_basis_int/two_e_int.irp.f b/plugins/local/extra_basis_int/two_e_int.irp.f new file mode 100644 index 00000000..a055c437 --- /dev/null +++ b/plugins/local/extra_basis_int/two_e_int.irp.f @@ -0,0 +1,71 @@ +double precision function ao_two_e_integral_mixed_direct(i, j, k, l) + + BEGIN_DOC + ! integral of the AO basis or (ij|kl) + ! i(r1) j(r1) 1/r12 k(r2) l(r2) + ! + ! where i,j belong to the REGULAR AO basis and k,l to the EXTRA basis + END_DOC + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: i, j, k, l + + integer :: p, q, r, s + integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3) + integer :: iorder_p(3), iorder_q(3) + double precision :: I_center(3), J_center(3), K_center(3), L_center(3) + double precision :: integral + double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp + double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq + double precision :: general_primitive_integral + + dim1 = n_pt_max_integrals + + num_i = ao_nucl(i) + num_j = ao_nucl(j) + num_k = ao_extra_nucl(k) + num_l = ao_extra_nucl(l) + ao_two_e_integral_mixed_direct = 0.d0 + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_power(j,p) + K_power(p) = ao_extra_power(k,p) + L_power(p) = ao_extra_power(l,p) + I_center(p) = nucl_coord(num_i,p) + J_center(p) = nucl_coord(num_j,p) + K_center(p) = extra_nucl_coord(num_k,p) + L_center(p) = extra_nucl_coord(num_l,p) + enddo + + double precision :: coef1, coef2, coef3, coef4 + double precision :: p_inv,q_inv + + do p = 1, ao_prim_num(i) + coef1 = ao_coef_normalized_ordered_transp(p,i) + do q = 1, ao_prim_num(j) + coef2 = coef1*ao_coef_normalized_ordered_transp(q,j) + call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,& + ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), & + I_power,J_power,I_center,J_center,dim1) + p_inv = 1.d0/pp + do r = 1, ao_extra_prim_num(k) + coef3 = coef2*ao_extra_coef_normalized_ordered_transp(r,k) + do s = 1, ao_extra_prim_num(l) + coef4 = coef3*ao_extra_coef_normalized_ordered_transp(s,l) + call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,& + ao_extra_expo_ordered_transp(r,k),ao_extra_expo_ordered_transp(s,l), & + K_power,L_power,K_center,L_center,dim1) + q_inv = 1.d0/qq + integral = general_primitive_integral(dim1, & + P_new,P_center,fact_p,pp,p_inv,iorder_p, & + Q_new,Q_center,fact_q,qq,q_inv,iorder_q) + ao_two_e_integral_mixed_direct = ao_two_e_integral_mixed_direct + coef4 * integral + enddo ! s + enddo ! r + enddo ! q + enddo ! p + +end From 52fdf18e74bf7551280299aeee51cfd18d59d2e8 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 12 Mar 2025 11:25:27 +0100 Subject: [PATCH 108/175] added exchange integrals --- .../extra_basis_int/extra_basis_int.irp.f | 19 ++++- .../extra_basis_int/ref_extra_basis.irp.f | 19 ++++- plugins/local/extra_basis_int/two_e_int.irp.f | 76 ++++++++++++++++++- 3 files changed, 111 insertions(+), 3 deletions(-) diff --git a/plugins/local/extra_basis_int/extra_basis_int.irp.f b/plugins/local/extra_basis_int/extra_basis_int.irp.f index 1f2919ba..59b90374 100644 --- a/plugins/local/extra_basis_int/extra_basis_int.irp.f +++ b/plugins/local/extra_basis_int/extra_basis_int.irp.f @@ -14,7 +14,8 @@ program extra_basis_int ! call print_v_ne_extra_basis ! call print_v_ne_basis ! call test_v_ne_a_extra_basis - call print_v_ee_mixed_direct +! call print_v_ee_mixed_direct + call print_v_ee_mixed_exchange end @@ -216,3 +217,19 @@ subroutine print_v_ee_mixed_direct enddo end + +subroutine print_v_ee_mixed_exchange + implicit none + integer :: i,j,k,l + double precision :: ao_two_e_integral_mixed_exchange + do i = 1, ao_num + do j = 1, ao_extra_num + do k = 1, ao_num + do l = 1, ao_extra_num + write(34,*)ao_two_e_integral_mixed_exchange(i, j, k, l) + enddo + enddo + enddo + enddo + +end diff --git a/plugins/local/extra_basis_int/ref_extra_basis.irp.f b/plugins/local/extra_basis_int/ref_extra_basis.irp.f index 8265bb9c..70d77733 100644 --- a/plugins/local/extra_basis_int/ref_extra_basis.irp.f +++ b/plugins/local/extra_basis_int/ref_extra_basis.irp.f @@ -7,7 +7,8 @@ program pouet ! call ref_pot_ne_mixed ! call ref_pot_ne ! call ref_pot_ne_extra_mixed - call ref_v_ee_mixed_direct +! call ref_v_ee_mixed_direct + call ref_v_ee_mixed_exchange end @@ -130,3 +131,19 @@ subroutine ref_v_ee_mixed_direct enddo end + +subroutine ref_v_ee_mixed_exchange + implicit none + integer :: i,j,k,l + double precision :: ao_two_e_integral + do i = 1, 15 + do j = 16, ao_num + do k = 1, 15 + do l = 16, ao_num + write(33,*)ao_two_e_integral(i, j, k, l) + enddo + enddo + enddo + enddo + +end diff --git a/plugins/local/extra_basis_int/two_e_int.irp.f b/plugins/local/extra_basis_int/two_e_int.irp.f index a055c437..2cde4153 100644 --- a/plugins/local/extra_basis_int/two_e_int.irp.f +++ b/plugins/local/extra_basis_int/two_e_int.irp.f @@ -3,8 +3,9 @@ double precision function ao_two_e_integral_mixed_direct(i, j, k, l) BEGIN_DOC ! integral of the AO basis or (ij|kl) ! i(r1) j(r1) 1/r12 k(r2) l(r2) + ! A A B B ! - ! where i,j belong to the REGULAR AO basis and k,l to the EXTRA basis + ! where i,j belong to the REGULAR AO basis (system A) and k,l to the EXTRA basis (system B) END_DOC implicit none @@ -69,3 +70,76 @@ double precision function ao_two_e_integral_mixed_direct(i, j, k, l) enddo ! p end + +double precision function ao_two_e_integral_mixed_exchange(i, j, k, l) + + BEGIN_DOC + ! integral of the AO basis or (ij|kl) + ! i(r1) j(r1) 1/r12 k(r2) l(r2) + ! A B A B + ! + ! where i,k belong to the REGULAR AO basis (system A) and j,l to the EXTRA basis (system B) + END_DOC + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: i, j, k, l + + integer :: p, q, r, s + integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3) + integer :: iorder_p(3), iorder_q(3) + double precision :: I_center(3), J_center(3), K_center(3), L_center(3) + double precision :: integral + double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp + double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq + double precision :: general_primitive_integral + + dim1 = n_pt_max_integrals + + num_i = ao_nucl(i) + num_j = ao_extra_nucl(j) + num_k = ao_nucl(k) + num_l = ao_extra_nucl(l) + ao_two_e_integral_mixed_exchange = 0.d0 + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_extra_power(j,p) + K_power(p) = ao_power(k,p) + L_power(p) = ao_extra_power(l,p) + I_center(p) = nucl_coord(num_i,p) + J_center(p) = extra_nucl_coord(num_j,p) + K_center(p) = nucl_coord(num_k,p) + L_center(p) = extra_nucl_coord(num_l,p) + enddo + + double precision :: coef1, coef2, coef3, coef4 + double precision :: p_inv,q_inv + + do p = 1, ao_prim_num(i) + coef1 = ao_coef_normalized_ordered_transp(p,i) + do q = 1, ao_extra_prim_num(j) + coef2 = coef1*ao_extra_coef_normalized_ordered_transp(q,j) + call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,& + ao_expo_ordered_transp(p,i),ao_extra_expo_ordered_transp(q,j), & + I_power,J_power,I_center,J_center,dim1) + p_inv = 1.d0/pp + do r = 1, ao_prim_num(k) + coef3 = coef2*ao_coef_normalized_ordered_transp(r,k) + do s = 1, ao_extra_prim_num(l) + coef4 = coef3*ao_extra_coef_normalized_ordered_transp(s,l) + call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,& + ao_expo_ordered_transp(r,k),ao_extra_expo_ordered_transp(s,l), & + K_power,L_power,K_center,L_center,dim1) + q_inv = 1.d0/qq + integral = general_primitive_integral(dim1, & + P_new,P_center,fact_p,pp,p_inv,iorder_p, & + Q_new,Q_center,fact_q,qq,q_inv,iorder_q) + ao_two_e_integral_mixed_exchange = ao_two_e_integral_mixed_exchange + coef4 * integral + enddo ! s + enddo ! r + enddo ! q + enddo ! p + +end From ffe7a8485f56c15a0b099a04c680a1fbd9eb57e9 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 12 Mar 2025 12:25:09 +0100 Subject: [PATCH 109/175] added direct, exchange between extra_basis and usual basis, together with a tuto in ao_extra_basis --- .../local/extra_basis_int/ao_overlap.irp.f | 6 +++-- .../local/extra_basis_int/pot_ao_ints.irp.f | 1 - .../local/extra_basis_int/v_mixed_extra.irp.f | 12 ++++----- src/ao_extra_basis/README.rst | 5 +++- src/ao_extra_basis/tuto/He_A.xyz | 3 +++ src/ao_extra_basis/tuto/example_copy.sh | 26 +++++++++++++++++++ src/ao_extra_basis/tuto/h2o.xyz | 7 +++++ 7 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 src/ao_extra_basis/tuto/He_A.xyz create mode 100755 src/ao_extra_basis/tuto/example_copy.sh create mode 100644 src/ao_extra_basis/tuto/h2o.xyz diff --git a/plugins/local/extra_basis_int/ao_overlap.irp.f b/plugins/local/extra_basis_int/ao_overlap.irp.f index 4f8debb6..9e45e690 100644 --- a/plugins/local/extra_basis_int/ao_overlap.irp.f +++ b/plugins/local/extra_basis_int/ao_overlap.irp.f @@ -4,7 +4,7 @@ BEGIN_PROVIDER [double precision, ao_extra_overlap , (ao_extra_num, ao_extra_num)] BEGIN_DOC - ! Overlap between atomic basis functions: + ! Overlap between atomic basis functions belonging to the EXTRA BASIS ! ! :math:`\int \chi_i(r) \chi_j(r) dr` END_DOC @@ -69,7 +69,9 @@ BEGIN_PROVIDER [double precision, ao_extra_overlap_mixed , (ao_num, ao_extra_num)] BEGIN_DOC - ! Overlap between atomic basis functions: + ! Overlap between atomic basis functions: + ! + ! first index belongs to the REGULAR AO basis, second to the EXTRA basis ! ! END_DOC diff --git a/plugins/local/extra_basis_int/pot_ao_ints.irp.f b/plugins/local/extra_basis_int/pot_ao_ints.irp.f index 5a7d7580..f52e7579 100644 --- a/plugins/local/extra_basis_int/pot_ao_ints.irp.f +++ b/plugins/local/extra_basis_int/pot_ao_ints.irp.f @@ -5,7 +5,6 @@ ! Computes the following integral : ! $\sum_{R in the USUAL nuclei} -Z $ ! - ! ! where $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis END_DOC integer :: mu,nu diff --git a/plugins/local/extra_basis_int/v_mixed_extra.irp.f b/plugins/local/extra_basis_int/v_mixed_extra.irp.f index 15958ab5..8b8ce92e 100644 --- a/plugins/local/extra_basis_int/v_mixed_extra.irp.f +++ b/plugins/local/extra_basis_int/v_mixed_extra.irp.f @@ -9,9 +9,9 @@ double precision function v_extra_nucl_extra_ao(i_ao,j_ao) ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne^{extra}(r)$. ! ! - ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis + ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis (system B) ! - ! and v_ne^{extra}(r) is the Coulomb potential coming from the EXTRA nuclei + ! and v_ne^{extra}(r) is the Coulomb potential coming from the EXTRA nuclei (system B) END_DOC integer, intent(in) ::i_ao,j_ao double precision :: mu_in,charge,coord(3) @@ -34,9 +34,9 @@ double precision function v_extra_nucl_ao(i_ao,j_ao) ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne(r)$. ! ! - ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the REGULAR basis + ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the REGULAR basis (system A) ! - ! and v_ne(r) is the Coulomb potential coming from the EXTRA nuclei + ! and v_ne(r) is the Coulomb potential coming from the EXTRA nuclei (system B) END_DOC integer, intent(in) ::i_ao,j_ao integer :: i @@ -59,9 +59,9 @@ double precision function v_nucl_extra_ao(i_ao,j_ao) ! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) v_ne(r)$. ! ! - ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis + ! where BOTH $\chi_i(r)$ AND $\chi_j(r)$ belongs to the EXTRA basis (system B) ! - ! and v_ne(r) is the Coulomb potential coming from the REGULAR nuclei + ! and v_ne(r) is the Coulomb potential coming from the REGULAR nuclei (system A) END_DOC integer, intent(in) ::i_ao,j_ao double precision :: mu_in,charge,coord(3) diff --git a/src/ao_extra_basis/README.rst b/src/ao_extra_basis/README.rst index f60d71c0..5f850255 100644 --- a/src/ao_extra_basis/README.rst +++ b/src/ao_extra_basis/README.rst @@ -5,7 +5,9 @@ extra_basis Plugin to handle an extra basis, which is attached to the extra_nuclei. It is essentially a duplication of all important quantities (coefficients, exponents and so on) of the usual |AO| basis. -An interesting feature is the possibility to fit any basis made at most with "p" functions onto a purely "s" basis. +Check in the directory "tuto" for a simple example of how to create a fictious system "B" attached independently to a system "A" + +Another interesting feature is the possibility to fit any basis made at most with "p" functions onto a purely "s" basis. This is done with the various scripts here: - qp_fit_1s_basis : script that creates an |EZFIO| folder corresponding to an .xyz file and a basis fitted with only "s" functions @@ -13,3 +15,4 @@ This is done with the various scripts here: Ex: qp_add_extra_fit_system LiH.ezfio/ h2o.xyz # takes the EZFIO folder "LiH.ezfio" and creates all necessary additional basis and nuclei based on h2o.xyz, but only with 1s functions. + diff --git a/src/ao_extra_basis/tuto/He_A.xyz b/src/ao_extra_basis/tuto/He_A.xyz new file mode 100644 index 00000000..d5285ade --- /dev/null +++ b/src/ao_extra_basis/tuto/He_A.xyz @@ -0,0 +1,3 @@ +1 +He atom "A" +He 0. 0. 0. diff --git a/src/ao_extra_basis/tuto/example_copy.sh b/src/ao_extra_basis/tuto/example_copy.sh new file mode 100755 index 00000000..0677b183 --- /dev/null +++ b/src/ao_extra_basis/tuto/example_copy.sh @@ -0,0 +1,26 @@ +source ~/qp2/quantum_package.rc +## Example of how to generate an additional h2o molecule, stored as a extra basis/nuclei etc .. to an He + +sys_B=h2o.xyz +basis_B=sto-3g +output_B=${sys_B%.xyz}_${basis_B} + +sys_A=He_A.xyz +basis_A=cc-pvtz +output_A=${sys_A%.xyz}_${basis_A}_extra_${output_B} + +# we create the system "B" that will be attached as an "extra system" to the syste "A" +qp create_ezfio -b $basis_B $sys_B -o ${output_B} +# we perform an HF calculation to obtain the AO density matrix +qp run scf +# we save the density matrix in the EZFIO +qp run save_one_e_dm +# we create the system "A" +qp create_ezfio -b $basis_A $sys_A -o ${output_A} +# We perform an SCF calculation +qp run scf +# we copy the system "B" information as extra nuclei/basis etc in the EZFIO of system "A" +qp_copy_extra_basis ${output_B} ${output_A} + +# we execute an example of progra that prints a lot of useful integrals/information on the A-B interaction +qp run test_extra_basis | tee ${output_A}.test_extra_basis diff --git a/src/ao_extra_basis/tuto/h2o.xyz b/src/ao_extra_basis/tuto/h2o.xyz new file mode 100644 index 00000000..d3928214 --- /dev/null +++ b/src/ao_extra_basis/tuto/h2o.xyz @@ -0,0 +1,7 @@ +3 + +O 0.000000 -0.399441 3.000000 +H 0.761232 0.199721 3.000000 +H -0.761232 0.199721 3.000000 + + From 2037939abb877d983991d9a15dfff361549a6972 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 12 Mar 2025 12:29:29 +0100 Subject: [PATCH 110/175] corrected a bug in qp2/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f --- plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f b/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f index e71d49fc..68d965cb 100644 --- a/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f +++ b/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f @@ -30,6 +30,7 @@ ! have the same number of functions END_DOC integer :: i,j + double precision :: accu double precision, allocatable :: inv_overlap_times_integrals(:,:) ! = h S^{-1} allocate(inv_overlap_times_integrals(ao_num,ao_num)) ! routine that computes the product of two matrices, you can check it with From d84edaad5f386a316280e02a9deb2c7821ac6057 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 13 Mar 2025 14:36:24 +0100 Subject: [PATCH 111/175] Fix ao_sphe_overlap --- etc/openmp.rc | 2 +- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 49 +++++++++++----------- src/mo_basis/mos.irp.f | 9 ++++ 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/etc/openmp.rc b/etc/openmp.rc index 7f71c9b8..a8ced5a0 100644 --- a/etc/openmp.rc +++ b/etc/openmp.rc @@ -1 +1 @@ -export OMP_NESTED=True +#export OMP_NESTED=True 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 eff7e7be..747d9183 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -1,5 +1,5 @@ BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_num)] -&BEGIN_PROVIDER [ integer, ao_cart_to_sphe_num ] +&BEGIN_PROVIDER [ integer, ao_sphe_num ] implicit none BEGIN_DOC ! Coefficients to go from cartesian to spherical coordinates in the current @@ -13,23 +13,23 @@ ao_cart_to_sphe_coef(:,:) = 0.d0 ! Assume order provided by ao_power_index i = 1 - ao_cart_to_sphe_num = 0 + ao_sphe_num = 0 do while (i <= ao_num) select case ( ao_l(i) ) case (0) - ao_cart_to_sphe_num += 1 - ao_cart_to_sphe_coef(i,ao_cart_to_sphe_num) = 1.d0 + ao_sphe_num += 1 + ao_cart_to_sphe_coef(i,ao_sphe_num) = 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_cart_to_sphe_num+k) = cart_to_sphe_$SHELL(j,k) + ao_cart_to_sphe_coef(i+j-1,ao_sphe_num+k) = cart_to_sphe_$SHELL(j,k) enddo enddo i += size(cart_to_sphe_$SHELL,1) - ao_cart_to_sphe_num += size(cart_to_sphe_$SHELL,2) + ao_sphe_num += size(cart_to_sphe_$SHELL,2) endif SUBST [ SHELL ] 1;; @@ -49,36 +49,36 @@ END_PROVIDER -BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_overlap, (ao_cart_to_sphe_num,ao_cart_to_sphe_num) ] +BEGIN_PROVIDER [ double precision, ao_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] implicit none BEGIN_DOC ! |AO| overlap matrix in the spherical basis set END_DOC - double precision, allocatable :: S(:,:) - allocate (S(ao_cart_to_sphe_num,ao_num)) + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) - call dgemm('T','N',ao_cart_to_sphe_num,ao_num,ao_num, 1.d0, & + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), & - ao_overlap,size(ao_overlap,1), 0.d0, & - S, size(S,1)) + S_inv,size(ao_overlap,1), 0.d0, & + tmp, size(tmp,1)) - call dgemm('N','N',ao_cart_to_sphe_num,ao_cart_to_sphe_num,ao_num, 1.d0, & - S, size(S,1), & + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + tmp, size(tmp,1), & ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), 0.d0, & - ao_cart_to_sphe_overlap,size(ao_cart_to_sphe_overlap,1)) + ao_sphe_overlap,size(ao_sphe_overlap,1)) - deallocate(S) + deallocate(tmp) END_PROVIDER -BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_cart_to_sphe_num,ao_num) ] +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_sphe_num,ao_num) ] implicit none BEGIN_DOC ! Inverse of :c:data:`ao_cart_to_sphe_coef` END_DOC call get_pseudo_inverse(ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1),& - ao_num,ao_cart_to_sphe_num, & + ao_num,ao_sphe_num, & ao_cart_to_sphe_inv, size(ao_cart_to_sphe_inv,1), lin_dep_cutoff) END_PROVIDER @@ -120,17 +120,17 @@ double precision, allocatable :: S(:,:) - allocate(S(ao_cart_to_sphe_num,ao_cart_to_sphe_num)) + allocate(S(ao_sphe_num,ao_sphe_num)) S = 0.d0 - do i=1,ao_cart_to_sphe_num + do i=1,ao_sphe_num S(i,i) = 1.d0 enddo - ao_ortho_canonical_num = ao_cart_to_sphe_num - call ortho_canonical(ao_cart_to_sphe_overlap, size(ao_cart_to_sphe_overlap,1), & - ao_cart_to_sphe_num, S, size(S,1), ao_ortho_canonical_num, lin_dep_cutoff) + ao_ortho_canonical_num = ao_sphe_num + call ortho_canonical(ao_sphe_overlap, size(ao_sphe_overlap,1), & + ao_sphe_num, S, size(S,1), ao_ortho_canonical_num, lin_dep_cutoff) - call dgemm('N','N', ao_num, ao_ortho_canonical_num, ao_cart_to_sphe_num, 1.d0, & + call dgemm('N','N', ao_num, ao_ortho_canonical_num, ao_sphe_num, 1.d0, & ao_cart_to_sphe_coef, size(ao_cart_to_sphe_coef,1), & S, size(S,1), & 0.d0, ao_ortho_canonical_coef, size(ao_ortho_canonical_coef,1)) @@ -167,3 +167,4 @@ enddo enddo END_PROVIDER + diff --git a/src/mo_basis/mos.irp.f b/src/mo_basis/mos.irp.f index 1ed859ee..a8b5441d 100644 --- a/src/mo_basis/mos.irp.f +++ b/src/mo_basis/mos.irp.f @@ -346,3 +346,12 @@ subroutine ao_ortho_cano_to_ao(A_ao,LDA_ao,A,LDA) deallocate(T) end + +BEGIN_PROVIDER [ double precision, mo_coef_spherical] + implicit none + BEGIN_DOC + ! MO coefficients in the basis of spherical harmonics AOs. + END_DOC + +END_PROVIDER + From 8ae207b3432f8ac3aab44b21614e1bb6ee213c51 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 14 Mar 2025 18:11:37 +0100 Subject: [PATCH 112/175] Implemented cartesian -> spherical AO conversion --- scripts/qp_import_trexio.py | 5 +- src/ao_basis/aos.irp.f | 25 +++++ src/ao_basis/spherical_to_cartesian.irp.f | 120 +++++++++++++++++++-- src/ao_one_e_ints/ao_one_e_ints.irp.f | 16 +++ src/ao_one_e_ints/ao_ortho_canonical.irp.f | 48 +++++---- src/ao_one_e_ints/ao_overlap.irp.f | 23 ++++ src/ao_one_e_ints/kin_ao_ints.irp.f | 22 ++++ src/ao_one_e_ints/pot_ao_ints.irp.f | 22 ++++ src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f | 64 +++++++++++ src/mo_basis/mos.irp.f | 12 ++- src/trexio/EZFIO.cfg | 7 ++ src/trexio/export_trexio_routines.irp.f | 110 +++++++++++++------ src/utils/linear_algebra.irp.f | 9 -- 13 files changed, 402 insertions(+), 81 deletions(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index a515efba..b8d0d8ed 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -271,12 +271,11 @@ def write_ezfio(trexio_filename, filename): if basis_type.lower() == "gaussian" and not cartesian: try: import trexio_tools - fd, tmp = tempfile.mkstemp() - os.close(fd) + tmp = "cartesian_"+trexio_filename retcode = subprocess.call(["trexio", "convert-to", "-t", "cartesian", "-o", tmp, trexio_filename]) trexio_file_cart = trexio.File(tmp,mode='r',back_end=trexio.TREXIO_AUTO) cartesian = trexio.read_ao_cartesian(trexio_file_cart) - os.unlink(tmp) + ezfio.set_trexio_trexio_file(tmp) except: pass diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index 440cc865..d9381015 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -20,7 +20,22 @@ ao_shell(k) = i enddo enddo +END_PROVIDER +BEGIN_PROVIDER [ integer, ao_sphe_shell, (ao_sphe_num) ] + implicit none + BEGIN_DOC + ! Index of the shell to which the AO corresponds + END_DOC + integer :: i, j, k, n + k=0 + do i=1,shell_num + n = shell_ang_mom(i) + do j=-n,n + k = k+1 + ao_sphe_shell(k) = i + enddo + enddo END_PROVIDER BEGIN_PROVIDER [ integer, ao_first_of_shell, (shell_num) ] @@ -133,6 +148,16 @@ enddo enddo +END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_sphe_coef_normalization_factor, (ao_sphe_num) ] + implicit none + BEGIN_DOC + ! Normalization factor in spherical AO basis + END_DOC + + ao_sphe_coef_normalization_factor(:) = 1.d0 + END_PROVIDER BEGIN_PROVIDER [ double precision, ao_coef_normalized_ordered, (ao_num,ao_prim_num_max) ] diff --git a/src/ao_basis/spherical_to_cartesian.irp.f b/src/ao_basis/spherical_to_cartesian.irp.f index 336161f8..53a60413 100644 --- a/src/ao_basis/spherical_to_cartesian.irp.f +++ b/src/ao_basis/spherical_to_cartesian.irp.f @@ -4,7 +4,8 @@ ! First index is the index of the cartesian AO, obtained by ao_power_index ! Second index is the index of the spherical AO -BEGIN_PROVIDER [ double precision, cart_to_sphe_0, (1,1) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_0, (1,1) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_0, (1) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=0 @@ -12,10 +13,12 @@ cart_to_sphe_0 = 0.d0 cart_to_sphe_0 ( 1, 1) = 1.0d0 + cart_to_sphe_norm_0 (1) = 1.d0 END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_1, (3,3) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_1, (3,3) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_1, (3) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=1 @@ -25,10 +28,14 @@ cart_to_sphe_1 ( 3, 1) = 1.0d0 cart_to_sphe_1 ( 1, 2) = 1.0d0 cart_to_sphe_1 ( 2, 3) = 1.0d0 + cart_to_sphe_norm_1 (1) = 1.d0 + cart_to_sphe_norm_1 (2) = 1.d0 + cart_to_sphe_norm_1 (3) = 1.d0 END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_2, (6,5) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_2, (6,5) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_2, (6) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=2 @@ -43,10 +50,14 @@ cart_to_sphe_2 ( 1, 4) = 0.86602540378443864676d0 cart_to_sphe_2 ( 4, 4) = -0.86602540378443864676d0 cart_to_sphe_2 ( 2, 5) = 1.0d0 + + cart_to_sphe_norm_2 = (/ 1.0d0, 1.7320508075688772d0, 1.7320508075688772d0, 1.0d0, & + 1.7320508075688772d0, 1.0d0 /) END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_3, (10,7) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_3, (10,7) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_3, (10) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=3 @@ -69,10 +80,15 @@ cart_to_sphe_3 ( 4, 6) = -1.0606601717798212866d0 cart_to_sphe_3 ( 2, 7) = 1.0606601717798212866d0 cart_to_sphe_3 ( 7, 7) = -0.790569415042094833d0 + + cart_to_sphe_norm_3 = (/ 1.0d0, 2.23606797749979d0, 2.23606797749979d0, & + 2.23606797749979d0, 3.872983346207417d0, 2.23606797749979d0, 1.0d0, 2.23606797749979d0, & + 2.23606797749979d0, 1.d00 /) END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_4, (15,9) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_4, (15,9) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_4, (15) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=4 @@ -107,10 +123,18 @@ cart_to_sphe_4 (11, 8) = 0.73950997288745200532d0 cart_to_sphe_4 ( 2, 9) = 1.1180339887498948482d0 cart_to_sphe_4 ( 7, 9) = -1.1180339887498948482d0 + + cart_to_sphe_norm_4 = (/ 1.0d0, 2.6457513110645907d0, 2.6457513110645907d0, & + 3.4156502553198664d0, 5.916079783099616d0, 3.415650255319866d0, & + 2.6457513110645907d0, 5.916079783099616d0, 5.916079783099616d0, & + 2.6457513110645907d0, 1.0d0, 2.6457513110645907d0, 3.415650255319866d0, & + 2.6457513110645907d0, 1.d00 /) + END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_5, (21,11) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_5, (21,11) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_5, (21) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=5 @@ -163,10 +187,18 @@ cart_to_sphe_5 ( 2,11) = 1.169267933366856683d0 cart_to_sphe_5 ( 7,11) = -1.5309310892394863114d0 cart_to_sphe_5 (16,11) = 0.7015607600201140098d0 + + cart_to_sphe_norm_5 = (/ 1.0d0, 3.0d0, 3.0d0, 4.58257569495584d0, & + 7.937253933193773d0, 4.58257569495584d0, 4.58257569495584d0, & + 10.246950765959598d0, 10.246950765959598d0, 4.582575694955841d0, 3.0d0, & + 7.937253933193773d0, 10.246950765959598d0, 7.937253933193773d0, 3.0d0, 1.0d0, & + 3.0d0, 4.58257569495584d0, 4.582575694955841d0, 3.0d0, 1.d00 /) + END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_6, (28,13) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_6, (28,13) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_6, (28) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=6 @@ -243,10 +275,22 @@ cart_to_sphe_6 ( 2,13) = 1.2151388809514737933d0 cart_to_sphe_6 ( 7,13) = -1.9764235376052370825d0 cart_to_sphe_6 (16,13) = 1.2151388809514737933d0 + + cart_to_sphe_norm_6 = (/ 1.0d0, 3.3166247903554003d0, 3.3166247903554003d0, & + 5.744562646538029d0, 9.949874371066201d0, 5.744562646538029d0, & + 6.797058187186571d0, 15.198684153570666d0, 15.198684153570664d0, & + 6.797058187186572d0, 5.744562646538029d0, 15.198684153570666d0, & + 19.621416870348583d0, 15.198684153570666d0, 5.744562646538029d0, & + 3.3166247903554003d0, 9.949874371066201d0, 15.198684153570664d0, & + 15.198684153570666d0, 9.9498743710662d0, 3.3166247903554003d0, 1.0d0, & + 3.3166247903554003d0, 5.744562646538029d0, 6.797058187186572d0, & + 5.744562646538029d0, 3.3166247903554003d0, 1.d00 /) + END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_7, (36,15) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_7, (36,15) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_7, (36) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=7 @@ -355,10 +399,25 @@ cart_to_sphe_7 ( 7,15) = -2.4456993503903949804d0 cart_to_sphe_7 (16,15) = 1.96875d0 cart_to_sphe_7 (29,15) = -0.64725984928774934788d0 + + cart_to_sphe_norm_7 = (/ 1.0d0, 3.6055512754639896d0, 3.605551275463989d0, & + 6.904105059069327d0, 11.958260743101398d0, 6.904105059069326d0, & + 9.26282894152753d0, 20.712315177207984d0, 20.71231517720798d0, & + 9.26282894152753d0, 9.26282894152753d0, 24.507141816213494d0, & + 31.63858403911275d0, 24.507141816213494d0, 9.262828941527529d0, & + 6.904105059069327d0, 20.712315177207984d0, 31.63858403911275d0, & + 31.63858403911275d0, 20.71231517720798d0, 6.904105059069327d0, & + 3.6055512754639896d0, 11.958260743101398d0, 20.71231517720798d0, & + 24.507141816213494d0, 20.71231517720798d0, 11.958260743101398d0, & + 3.6055512754639896d0, 1.0d0, 3.605551275463989d0, 6.904105059069326d0, & + 9.26282894152753d0, 9.262828941527529d0, 6.904105059069327d0, & + 3.6055512754639896d0, 1.d00 /) + END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_8, (45,17) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_8, (45,17) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_8, (45) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=8 @@ -506,10 +565,28 @@ cart_to_sphe_8 ( 7,17) = -2.9348392204684739765d0 cart_to_sphe_8 (16,17) = 2.9348392204684739765d0 cart_to_sphe_8 (29,17) = -1.2945196985754986958d0 + + cart_to_sphe_norm_8 = (/ 1.0d0, 3.872983346207417d0, 3.872983346207417d0, & + 8.062257748298551d0, 13.964240043768942d0, 8.06225774829855d0, & + 11.958260743101398d0, 26.739483914241877d0, 26.739483914241877d0, & + 11.958260743101398d0, 13.55939315961975d0, 35.874782229304195d0, & + 46.31414470763765d0, 35.874782229304195d0, 13.55939315961975d0, & + 11.958260743101398d0, 35.874782229304195d0, 54.79963503528103d0, & + 54.79963503528103d0, 35.874782229304195d0, 11.958260743101398d0, & + 8.062257748298551d0, 26.739483914241877d0, 46.31414470763765d0, & + 54.79963503528103d0, 46.314144707637645d0, 26.739483914241877d0, & + 8.06225774829855d0, 3.872983346207417d0, 13.964240043768942d0, & + 26.739483914241877d0, 35.874782229304195d0, 35.874782229304195d0, & + 26.739483914241877d0, 13.96424004376894d0, 3.8729833462074166d0, 1.0d0, & + 3.872983346207417d0, 8.06225774829855d0, 11.958260743101398d0, & + 13.55939315961975d0, 11.958260743101398d0, 8.06225774829855d0, & + 3.8729833462074166d0, 1.d0 /) + END_PROVIDER -BEGIN_PROVIDER [ double precision, cart_to_sphe_9, (55,19) ] + BEGIN_PROVIDER [ double precision, cart_to_sphe_9, (55,19) ] +&BEGIN_PROVIDER [ double precision, cart_to_sphe_norm_9, (55) ] implicit none BEGIN_DOC ! Spherical -> Cartesian Transformation matrix for l=9 @@ -703,5 +780,28 @@ cart_to_sphe_9 (16,19) = 4.1179360680974030877d0 cart_to_sphe_9 (29,19) = -2.3781845426185916576d0 cart_to_sphe_9 (46,19) = 0.60904939217552380708d0 + + cart_to_sphe_norm_9 = (/ 1.0d0, 4.1231056256176615d0, 4.1231056256176615d0, & + 9.219544457292889d0, 15.968719422671313d0, 9.219544457292889d0, & + 14.86606874731851d0, 33.24154027718933d0, 33.24154027718933d0, & + 14.866068747318508d0, 18.635603405463275d0, 49.30517214248421d0, & + 63.652703529910404d0, 49.30517214248421d0, 18.635603405463275d0, & + 18.635603405463275d0, 55.90681021638982d0, 85.39906322671229d0, & + 85.39906322671229d0, 55.90681021638983d0, 18.635603405463275d0, & + 14.86606874731851d0, 49.30517214248421d0, 85.39906322671229d0, & + 101.04553429023969d0, 85.3990632267123d0, 49.30517214248421d0, & + 14.866068747318508d0, 9.219544457292889d0, 33.24154027718933d0, & + 63.652703529910404d0, 85.39906322671229d0, 85.3990632267123d0, & + 63.65270352991039d0, 33.24154027718933d0, 9.219544457292887d0, & + 4.1231056256176615d0, 15.968719422671313d0, 33.24154027718933d0, & + 49.30517214248421d0, 55.90681021638983d0, 49.30517214248421d0, & + 33.24154027718933d0, 15.968719422671313d0, 4.1231056256176615d0, 1.0d0, & + 4.1231056256176615d0, 9.219544457292889d0, 14.866068747318508d0, & + 18.635603405463275d0, 18.635603405463275d0, 14.866068747318508d0, & + 9.219544457292887d0, 4.1231056256176615d0, 1.d0 /) + END_PROVIDER + + + diff --git a/src/ao_one_e_ints/ao_one_e_ints.irp.f b/src/ao_one_e_ints/ao_one_e_ints.irp.f index 2c6b8e7e..8b0edfbc 100644 --- a/src/ao_one_e_ints/ao_one_e_ints.irp.f +++ b/src/ao_one_e_ints/ao_one_e_ints.irp.f @@ -45,3 +45,19 @@ END_PROVIDER + BEGIN_PROVIDER [ double precision, ao_sphe_one_e_integrals,(ao_sphe_num,ao_sphe_num)] +&BEGIN_PROVIDER [ double precision, ao_sphe_one_e_integrals_diag,(ao_sphe_num)] + implicit none + integer :: i,j,n,l + BEGIN_DOC + ! One-electron Hamiltonian in the spherical |AO| basis. + END_DOC + + ao_sphe_one_e_integrals = ao_sphe_integrals_n_e + ao_sphe_kinetic_integrals + + do j = 1, ao_num + ao_sphe_one_e_integrals_diag(j) = ao_sphe_one_e_integrals(j,j) + enddo + +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 747d9183..4e4d33f0 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -1,9 +1,12 @@ BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_num)] +&BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_normalization, (ao_num)] &BEGIN_PROVIDER [ integer, ao_sphe_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 @@ -11,6 +14,7 @@ integer :: prev prev = 0 ao_cart_to_sphe_coef(:,:) = 0.d0 + ao_cart_to_sphe_normalization(:) = 1.d0 ! Assume order provided by ao_power_index i = 1 ao_sphe_num = 0 @@ -19,6 +23,7 @@ case (0) ao_sphe_num += 1 ao_cart_to_sphe_coef(i,ao_sphe_num) = 1.d0 + ao_cart_to_sphe_normalization(i) = 1.d0 i += 1 BEGIN_TEMPLATE case ($SHELL) @@ -28,6 +33,9 @@ ao_cart_to_sphe_coef(i+j-1,ao_sphe_num+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_num += size(cart_to_sphe_$SHELL,2) endif @@ -47,39 +55,35 @@ end select enddo +print *, ao_cart_to_sphe_normalization(:) END_PROVIDER -BEGIN_PROVIDER [ double precision, ao_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_sphe_num,ao_num) ] implicit none BEGIN_DOC - ! |AO| overlap matrix in the spherical basis set + ! Inverse of :c:data:`ao_cart_to_sphe_coef` END_DOC - double precision, allocatable :: tmp(:,:) - allocate (tmp(ao_sphe_num,ao_num)) - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & - ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), & - S_inv,size(ao_overlap,1), 0.d0, & - tmp, size(tmp,1)) + ! Normalize + integer :: m,k + double precision, allocatable :: S(:,:), R(:,:), Rinv(:,:), Sinv(:,:) - call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & - tmp, size(tmp,1), & - ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), 0.d0, & - ao_sphe_overlap,size(ao_sphe_overlap,1)) + k = size(ao_cart_to_sphe_coef,1) + m = size(ao_cart_to_sphe_coef,2) - deallocate(tmp) + allocate(S(k,k), R(k,m), Rinv(m,k), Sinv(k,k)) -END_PROVIDER + R(:,:) = ao_cart_to_sphe_coef(:,:) -BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_sphe_num,ao_num) ] - implicit none - BEGIN_DOC - ! Inverse of :c:data:`ao_cart_to_sphe_coef` - END_DOC + call dgemm('N','T', m, m, k, 1.d0, R, k, R, k, 0.d0, S, m) + call get_pseudo_inverse(S, k, k, m, Sinv, k, 1.d-20) + call dgemm('T','T', m, m, k, 1.d0, R, k, Sinv, k, 0.d0, Rinv, m) + + integer :: i + do i=1,ao_num + ao_cart_to_sphe_inv(:,i) = Rinv(:,i) !/ ao_cart_to_sphe_normalization(i) + enddo - call get_pseudo_inverse(ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1),& - ao_num,ao_sphe_num, & - ao_cart_to_sphe_inv, size(ao_cart_to_sphe_inv,1), lin_dep_cutoff) END_PROVIDER diff --git a/src/ao_one_e_ints/ao_overlap.irp.f b/src/ao_one_e_ints/ao_overlap.irp.f index e5341f6a..cc676c4b 100644 --- a/src/ao_one_e_ints/ao_overlap.irp.f +++ b/src/ao_one_e_ints/ao_overlap.irp.f @@ -308,3 +308,26 @@ END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! |AO| overlap matrix in the spherical basis set + END_DOC + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & + ao_overlap,size(ao_overlap,1), 0.d0, & + tmp, size(tmp,1)) + + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + tmp, size(tmp,1), & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & + ao_sphe_overlap,size(ao_sphe_overlap,1)) + + deallocate(tmp) + +END_PROVIDER + diff --git a/src/ao_one_e_ints/kin_ao_ints.irp.f b/src/ao_one_e_ints/kin_ao_ints.irp.f index 49eb56ad..f450721d 100644 --- a/src/ao_one_e_ints/kin_ao_ints.irp.f +++ b/src/ao_one_e_ints/kin_ao_ints.irp.f @@ -190,3 +190,25 @@ endif END_PROVIDER + +BEGIN_PROVIDER [ double precision, ao_sphe_kinetic_integrals, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! |AO| kinetic inntegrals matrix in the spherical basis set + END_DOC + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & + ao_kinetic_integrals,size(ao_kinetic_integrals,1), 0.d0, & + tmp, size(tmp,1)) + + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + tmp, size(tmp,1), & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & + ao_sphe_kinetic_integrals,size(ao_sphe_kinetic_integrals,1)) + + deallocate(tmp) + +END_PROVIDER diff --git a/src/ao_one_e_ints/pot_ao_ints.irp.f b/src/ao_one_e_ints/pot_ao_ints.irp.f index 776b5ec0..c1544a5d 100644 --- a/src/ao_one_e_ints/pot_ao_ints.irp.f +++ b/src/ao_one_e_ints/pot_ao_ints.irp.f @@ -609,3 +609,25 @@ double precision function V_r(n,alpha) end + +BEGIN_PROVIDER [ double precision, ao_sphe_integrals_n_e, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! |AO| VneVne inntegrals matrix in the spherical basis set + END_DOC + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & + ao_integrals_n_e,size(ao_integrals_n_e,1), 0.d0, & + tmp, size(tmp,1)) + + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + tmp, size(tmp,1), & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & + ao_sphe_integrals_n_e,size(ao_sphe_integrals_n_e,1)) + + deallocate(tmp) + +END_PROVIDER diff --git a/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f b/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f index e75ca056..851f26d8 100644 --- a/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f +++ b/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f @@ -296,3 +296,67 @@ enddo END_PROVIDER +BEGIN_PROVIDER [ double precision, ao_sphe_pseudo_integrals_local, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! |AO| pseudo_integrals_local matrix in the spherical basis set + END_DOC + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & + ao_pseudo_integrals_local,size(ao_pseudo_integrals_local,1), 0.d0, & + tmp, size(tmp,1)) + + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + tmp, size(tmp,1), & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & + ao_sphe_pseudo_integrals_local,size(ao_sphe_pseudo_integrals_local,1)) + + deallocate(tmp) + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_sphe_pseudo_integrals_non_local, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! |AO| pseudo_integrals_non_local matrix in the spherical basis set + END_DOC + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & + ao_pseudo_integrals_non_local,size(ao_pseudo_integrals_non_local,1), 0.d0, & + tmp, size(tmp,1)) + + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + tmp, size(tmp,1), & + ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & + ao_sphe_pseudo_integrals_non_local,size(ao_sphe_pseudo_integrals_non_local,1)) + + deallocate(tmp) + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_sphe_pseudo_integrals, (ao_sphe_num,ao_sphe_num)] + implicit none + BEGIN_DOC + ! Pseudo-potential integrals in the |AO| basis set. + END_DOC + + ao_sphe_pseudo_integrals = 0.d0 + if (do_pseudo) then + if (pseudo_klocmax > 0) then + ao_sphe_pseudo_integrals += ao_sphe_pseudo_integrals_local + endif + if (pseudo_kmax > 0) then + ao_sphe_pseudo_integrals += ao_sphe_pseudo_integrals_non_local + endif + endif + +END_PROVIDER + diff --git a/src/mo_basis/mos.irp.f b/src/mo_basis/mos.irp.f index a8b5441d..1eecca6c 100644 --- a/src/mo_basis/mos.irp.f +++ b/src/mo_basis/mos.irp.f @@ -347,11 +347,19 @@ subroutine ao_ortho_cano_to_ao(A_ao,LDA_ao,A,LDA) end -BEGIN_PROVIDER [ double precision, mo_coef_spherical] +BEGIN_PROVIDER [ double precision, mo_sphe_coef, (ao_sphe_num, mo_num) ] implicit none BEGIN_DOC ! MO coefficients in the basis of spherical harmonics AOs. END_DOC - + double precision, allocatable :: tmp(:,:) + allocate (tmp(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_coef,ao_num, & + mo_coef,size(mo_coef,1), 0.d0, & + mo_sphe_coef, size(mo_sphe_coef,1)) + + deallocate (tmp) END_PROVIDER diff --git a/src/trexio/EZFIO.cfg b/src/trexio/EZFIO.cfg index 88828520..22dbea00 100644 --- a/src/trexio/EZFIO.cfg +++ b/src/trexio/EZFIO.cfg @@ -22,6 +22,13 @@ doc: If True, export MO coefficients interface: ezfio, ocaml, provider default: True +[export_cartesian] +type: logical +doc: If False, export everything in the spherical AO basis +interface: ezfio, ocaml, provider +default: True + + [export_ao_one_e_ints] type: logical doc: If True, export one-electron integrals in AO basis diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index cf1327b6..53b21dc9 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -77,6 +77,7 @@ subroutine export_trexio(update,full_path) rc = trexio_read_metadata_code_num(f(k), code_num) if (rc == TREXIO_ATTR_MISSING) then i = 1 + code_num = 0 code(:) = "" else rc = trexio_read_metadata_code(f(k), code, 64) @@ -97,6 +98,7 @@ subroutine export_trexio(update,full_path) rc = trexio_read_metadata_author_num(f(k), author_num) if (rc == TREXIO_ATTR_MISSING) then i = 1 + author_num = 0 author(:) = "" else rc = trexio_read_metadata_author(f(k), author, 64) @@ -305,35 +307,46 @@ subroutine export_trexio(update,full_path) print *, 'AOs' - rc = trexio_write_ao_num(f(1), ao_num) - call trexio_assert(rc, TREXIO_SUCCESS) + if (export_cartesian) then + rc = trexio_write_ao_cartesian(f(1), 1) + call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_write_ao_cartesian(f(1), 1) - call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_write_ao_num(f(1), ao_num) + call trexio_assert(rc, TREXIO_SUCCESS) + + rc = trexio_write_ao_shell(f(1), ao_shell) + call trexio_assert(rc, TREXIO_SUCCESS) + + if (ezfio_convention >= 20250211) then + rc = trexio_write_ao_normalization(f(1), ao_coef_normalization_factor) + else + + allocate(factor(ao_num)) + do i=1,ao_num + l = ao_first_of_shell(ao_shell(i)) + factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0)) + enddo + rc = trexio_write_ao_normalization(f(1), factor) + deallocate(factor) + endif + + call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_write_ao_shell(f(1), ao_shell) - call trexio_assert(rc, TREXIO_SUCCESS) - if (ezfio_convention >= 20250211) then - rc = trexio_write_ao_normalization(f(1), ao_coef_normalization_factor) else - integer :: pow0(3), powA(3), nz - double precision :: normA, norm0, C_A(3), overlap_x, overlap_z, overlap_y, c - nz=100 + rc = trexio_write_ao_cartesian(f(1), 0) + call trexio_assert(rc, TREXIO_SUCCESS) - C_A(1) = 0.d0 - C_A(2) = 0.d0 - C_A(3) = 0.d0 + rc = trexio_write_ao_num(f(1), ao_sphe_num) + call trexio_assert(rc, TREXIO_SUCCESS) + + rc = trexio_write_ao_shell(f(1), ao_sphe_shell) + call trexio_assert(rc, TREXIO_SUCCESS) + + rc = trexio_write_ao_normalization(f(1), ao_sphe_coef_normalization_factor) + call trexio_assert(rc, TREXIO_SUCCESS) - allocate(factor(ao_num)) - do i=1,ao_num - l = ao_first_of_shell(ao_shell(i)) - factor(i) = (ao_coef_normalized(i,1)+tiny(1.d0))/(ao_coef_normalized(l,1)+tiny(1.d0)) - enddo - rc = trexio_write_ao_normalization(f(1), factor) - deallocate(factor) endif - call trexio_assert(rc, TREXIO_SUCCESS) endif @@ -341,23 +354,45 @@ subroutine export_trexio(update,full_path) ! ------------------ if (export_ao_one_e_ints) then - print *, 'AO one-e integrals' - rc = trexio_write_ao_1e_int_overlap(f(1),ao_overlap) - call trexio_assert(rc, TREXIO_SUCCESS) + double precision, allocatable :: tmp_ao(:,:) + if (export_cartesian) then + print *, 'AO one-e integrals (cartesian)' - rc = trexio_write_ao_1e_int_kinetic(f(1),ao_kinetic_integrals) - call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_write_ao_1e_int_overlap(f(1),ao_overlap) + call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_write_ao_1e_int_potential_n_e(f(1),ao_integrals_n_e) - call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_write_ao_1e_int_kinetic(f(1),ao_kinetic_integrals) + call trexio_assert(rc, TREXIO_SUCCESS) - if (do_pseudo) then - rc = trexio_write_ao_1e_int_ecp(f(1), ao_pseudo_integrals_local + ao_pseudo_integrals_non_local) + rc = trexio_write_ao_1e_int_potential_n_e(f(1),ao_integrals_n_e) call trexio_assert(rc, TREXIO_SUCCESS) - endif - rc = trexio_write_ao_1e_int_core_hamiltonian(f(1),ao_one_e_integrals) + if (do_pseudo) then + rc = trexio_write_ao_1e_int_ecp(f(1), ao_pseudo_integrals) + call trexio_assert(rc, TREXIO_SUCCESS) + endif + + rc = trexio_write_ao_1e_int_core_hamiltonian(f(1),ao_one_e_integrals) + else + print *, 'AO one-e integrals (spherical)' + + rc = trexio_write_ao_1e_int_overlap(f(1),ao_sphe_overlap) + call trexio_assert(rc, TREXIO_SUCCESS) + + rc = trexio_write_ao_1e_int_kinetic(f(1),ao_sphe_kinetic_integrals) + call trexio_assert(rc, TREXIO_SUCCESS) + + rc = trexio_write_ao_1e_int_potential_n_e(f(1),ao_sphe_integrals_n_e) + call trexio_assert(rc, TREXIO_SUCCESS) + + if (do_pseudo) then + rc = trexio_write_ao_1e_int_ecp(f(1), ao_sphe_pseudo_integrals) + call trexio_assert(rc, TREXIO_SUCCESS) + endif + + rc = trexio_write_ao_1e_int_core_hamiltonian(f(1),ao_sphe_one_e_integrals) + endif call trexio_assert(rc, TREXIO_SUCCESS) end if @@ -465,8 +500,13 @@ subroutine export_trexio(update,full_path) call trexio_assert(rc, TREXIO_SUCCESS) enddo - rc = trexio_write_mo_coefficient(f(1), mo_coef) - call trexio_assert(rc, TREXIO_SUCCESS) + if (export_cartesian) then + rc = trexio_write_mo_coefficient(f(1), mo_coef) + call trexio_assert(rc, TREXIO_SUCCESS) + else + rc = trexio_write_mo_coefficient(f(1), mo_sphe_coef) + call trexio_assert(rc, TREXIO_SUCCESS) + endif if ( (trim(mo_label) == 'Canonical').and. & (export_mo_two_e_ints_cholesky.or.export_mo_two_e_ints) ) then diff --git a/src/utils/linear_algebra.irp.f b/src/utils/linear_algebra.irp.f index 4e7ca87d..629a998b 100644 --- a/src/utils/linear_algebra.irp.f +++ b/src/utils/linear_algebra.irp.f @@ -1392,15 +1392,6 @@ subroutine get_pseudo_inverse(A, LDA, m, n, C, LDC, cutoff) call dgemm('T', 'T', n, m, n_svd, 1.d0, Vt, size(Vt,1), U, size(U,1), 0.d0, C, size(C,1)) -! C = 0.d0 -! do i=1,m -! do j=1,n -! do k=1,n_svd -! C(j,i) = C(j,i) + U(i,k) * D(k) * Vt(k,j) -! enddo -! enddo -! enddo - deallocate(U,D,Vt,work,A_tmp) end From b5543cb37a8ab47716d1946f59322c0a6f2e7a1d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 14 Mar 2025 22:34:49 +0100 Subject: [PATCH 113/175] Introduced ao_sphe_num --- external/irpf90 | 2 +- src/ao_basis/aos.irp.f | 13 +++++++++++++ src/ao_one_e_ints/ao_ortho_canonical.irp.f | 17 +++++++++-------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/external/irpf90 b/external/irpf90 index 4ab1b175..43160c60 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 +Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index d9381015..02eedf53 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -22,6 +22,19 @@ enddo END_PROVIDER +BEGIN_PROVIDER [ integer, ao_sphe_num ] + implicit none + BEGIN_DOC + ! Number of spherical AOs + END_DOC + integer :: n, i + ao_sphe_num=0 + do i=1,shell_num + n = shell_ang_mom(i) + ao_sphe_num += 2*n+1 + enddo +END_PROVIDER + BEGIN_PROVIDER [ integer, ao_sphe_shell, (ao_sphe_num) ] implicit none BEGIN_DOC 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 4e4d33f0..b19be1e2 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -1,6 +1,5 @@ BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_num)] &BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_normalization, (ao_num)] -&BEGIN_PROVIDER [ integer, ao_sphe_num ] implicit none BEGIN_DOC ! Coefficients to go from cartesian to spherical coordinates in the current @@ -11,18 +10,18 @@ integer :: i integer, external :: ao_power_index integer :: ibegin,j,k - integer :: prev + integer :: prev, ao_sphe_count prev = 0 ao_cart_to_sphe_coef(:,:) = 0.d0 ao_cart_to_sphe_normalization(:) = 1.d0 ! Assume order provided by ao_power_index i = 1 - ao_sphe_num = 0 + ao_sphe_count = 0 do while (i <= ao_num) select case ( ao_l(i) ) case (0) - ao_sphe_num += 1 - ao_cart_to_sphe_coef(i,ao_sphe_num) = 1.d0 + 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 @@ -30,14 +29,14 @@ 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_num+k) = cart_to_sphe_$SHELL(j,k) + 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_num += size(cart_to_sphe_$SHELL,2) + ao_sphe_count += size(cart_to_sphe_$SHELL,2) endif SUBST [ SHELL ] 1;; @@ -55,7 +54,9 @@ end select enddo -print *, ao_cart_to_sphe_normalization(:) + 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_inv, (ao_sphe_num,ao_num) ] From a4b2bea36fd8cbd9262018289c64ef9897048c51 Mon Sep 17 00:00:00 2001 From: joguenzl Date: Mon, 17 Mar 2025 15:50:45 +0100 Subject: [PATCH 114/175] Further basis spoofing for NAO import --- scripts/qp_import_trexio.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 23f48eef..9f2df06b 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -209,6 +209,7 @@ def write_ezfio(trexio_filename, filename): nucl_index = trexio.read_basis_nucleus_index(trexio_file) exponent = [1.]*prim_num coefficient = [1.]*prim_num + prim_factor = [1.]*prim_num shell_index = [i for i in range(shell_num)] ao_shell = trexio.read_ao_shell(trexio_file) @@ -220,6 +221,9 @@ def write_ezfio(trexio_filename, filename): ezfio.set_basis_basis_nucleus_index([ x+1 for x in nucl_index ]) ezfio.set_basis_prim_expo(exponent) ezfio.set_basis_prim_coef(coefficient) + ezfio.set_basis_prim_normalization_factor(prim_factor) + ezfio.set_basis_primitives_normalized(True) + ezfio.set_basis_ao_normalized(False) nucl_shell_num = [] prev = None @@ -283,7 +287,7 @@ def write_ezfio(trexio_filename, filename): ezfio.set_ao_basis_ao_num(ao_num) - if cartesian and basis_type.lower() == "gaussian" and shell_num > 0: + if cartesian and basis_type.lower() in ["gaussian", "numerical"] and shell_num > 0: ao_shell = trexio.read_ao_shell(trexio_file_cart) at = [ nucl_index[i]+1 for i in ao_shell ] ezfio.set_ao_basis_ao_nucl(at) From 2c737621702765c45d87da56ef8fea5e5cf5a3d6 Mon Sep 17 00:00:00 2001 From: joguenzl Date: Mon, 17 Mar 2025 16:46:12 +0100 Subject: [PATCH 115/175] Allow import of core_hamiltonian if kinetic and nuclear matrices are not provided --- src/trexio/import_trexio_integrals.irp.f | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index d85a0283..17da55a3 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -119,6 +119,28 @@ subroutine run(f) call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e('Read') endif + ! Some codes only provide ao_1e_int_core_hamiltonian rather than + ! kinetic and nuclear potentials separately, so we need tneed to work + ! around that. This is needed for non-GTO basis sets since some QP + ! functions will try to calculate these matrices from the nonexisting + ! GTO basis if they are not set. + if (trexio_has_ao_1e_int_core_hamiltonian(f) == TREXIO_SUCCESS .and. & + trexio_has_ao_1e_int_potential_n_e(f) /= TREXIO_SUCCESS .and. & + trexio_has_ao_1e_int_kinetic(f) /= TREXIO_SUCCESS) then + rc = trexio_read_ao_1e_int_core_hamiltonian(f, A) + if (rc /= TREXIO_SUCCESS) then + print *, irp_here + print *, 'Error reading AO core Hamiltonian.' + call trexio_assert(rc, TREXIO_SUCCESS) + stop -1 + endif + call ezfio_set_ao_one_e_ints_ao_integrals_n_e(A) + call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e('Read') + A=0.d0 + call ezfio_set_ao_one_e_ints_ao_integrals_kinetic(A) + call ezfio_set_ao_one_e_ints_io_ao_integrals_kinetic('Read') + endif + deallocate(A,B) ! AO 2e integrals From 120a94e3b50386bea2616b155af672c5aa5fd4a6 Mon Sep 17 00:00:00 2001 From: joguenzl Date: Mon, 17 Mar 2025 17:55:36 +0100 Subject: [PATCH 116/175] Fix type --- src/trexio/import_trexio_integrals.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index 17da55a3..0fda2ff0 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -120,7 +120,7 @@ subroutine run(f) endif ! Some codes only provide ao_1e_int_core_hamiltonian rather than - ! kinetic and nuclear potentials separately, so we need tneed to work + ! kinetic and nuclear potentials separately, so we need to work ! around that. This is needed for non-GTO basis sets since some QP ! functions will try to calculate these matrices from the nonexisting ! GTO basis if they are not set. From 854b917735c9a9e1acc81f83ae1cb70ceea58544 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 19 Mar 2025 17:15:26 +0100 Subject: [PATCH 117/175] Fixed guess --- .../basis_correction/weak_corr_func.irp.f | 65 ++++++++++++------- scripts/qp_import_trexio.py | 4 +- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 26 +++++++- src/ao_two_e_ints/two_e_integrals.irp.f | 15 ++++- src/scf_utils/roothaan_hall_scf.irp.f | 6 +- 5 files changed, 86 insertions(+), 30 deletions(-) diff --git a/plugins/local/basis_correction/weak_corr_func.irp.f b/plugins/local/basis_correction/weak_corr_func.irp.f index 6af5e49d..a31ff3af 100644 --- a/plugins/local/basis_correction/weak_corr_func.irp.f +++ b/plugins/local/basis_correction/weak_corr_func.irp.f @@ -1,13 +1,13 @@ - BEGIN_PROVIDER [double precision, ecmd_lda_mu_of_r, (N_states)] + BEGIN_PROVIDER [double precision, ecmd_lda_mu_of_r, (N_states)] BEGIN_DOC -! ecmd_lda_mu_of_r = multi-determinantal Ecmd within the LDA approximation with mu(r) , +! ecmd_lda_mu_of_r = multi-determinantal Ecmd within the LDA approximation with mu(r) , ! ! see equation 40 in J. Chem. Phys. 149, 194301 (2018); https://doi.org/10.1063/1.5052714 END_DOC implicit none integer :: ipoint,istate - double precision :: rho_a, rho_b, ec + double precision :: rho_a, rho_b, ec, rho, p2 double precision :: wall0,wall1,weight,mu logical :: dospin dospin = .true. ! JT dospin have to be set to true for open shell @@ -15,31 +15,52 @@ ecmd_lda_mu_of_r = 0.d0 call wall_time(wall0) - do istate = 1, N_states - do ipoint = 1, n_points_final_grid - ! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018) - mu = mu_of_r_prov(ipoint,istate) - weight = final_weight_at_r_vector(ipoint) - rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) - rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate) - ! Ecmd within the LDA approximation of PRB 73, 155111 (2006) - call ESRC_MD_LDAERF (mu,rho_a,rho_b,dospin,ec) - if(isnan(ec))then - print*,'ec is nan' - stop - endif - ecmd_lda_mu_of_r(istate) += weight * ec + if (mu_of_r_potential.EQ."proj")then + do istate = 1, N_states + do ipoint = 1, n_points_final_grid + ! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018) + mu = mu_of_r_prov(ipoint,istate) + weight = final_weight_at_r_vector(ipoint) + rho = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + p2 = !TODO + rho_a = 0.5d0*(rho - dsqrt(-p2 + rho*rho)) + rho_b = 0.5d0*(rho + dsqrt(-p2 + rho*rho)) + ! Ecmd within the LDA approximation of PRB 73, 155111 (2006) + call ESRC_MD_LDAERF (mu,rho_a,rho_b,dospin,ec) + if(isnan(ec))then + print*,'ec is nan' + stop + endif + ecmd_lda_mu_of_r(istate) += weight * ec + enddo enddo - enddo + else + do istate = 1, N_states + do ipoint = 1, n_points_final_grid + ! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018) + mu = mu_of_r_prov(ipoint,istate) + weight = final_weight_at_r_vector(ipoint) + rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) + rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + ! Ecmd within the LDA approximation of PRB 73, 155111 (2006) + call ESRC_MD_LDAERF (mu,rho_a,rho_b,dospin,ec) + if(isnan(ec))then + print*,'ec is nan' + stop + endif + ecmd_lda_mu_of_r(istate) += weight * ec + enddo + enddo + endif call wall_time(wall1) print*,'Time for ecmd_lda_mu_of_r :',wall1-wall0 - END_PROVIDER +END_PROVIDER BEGIN_PROVIDER [double precision, ecmd_pbe_ueg_mu_of_r, (N_states)] BEGIN_DOC ! ecmd_pbe_ueg_mu_of_r = multi-determinantal Ecmd within the PBE-UEG approximation with mu(r) , - ! + ! ! see Eqs. 13-14b in Phys.Chem.Lett.2019, 10, 2931 2937; https://pubs.acs.org/doi/10.1021/acs.jpclett.9b01176 ! ! Based on the PBE-on-top functional (see Eqs. 26, 27 of J. Chem. Phys.150, 084103 (2019); doi: 10.1063/1.5082638) @@ -53,7 +74,7 @@ double precision :: g0_UEG_mu_inf ecmd_pbe_ueg_mu_of_r = 0.d0 - + print*,'Providing ecmd_pbe_ueg_mu_of_r ...' call wall_time(wall0) do istate = 1, N_states @@ -69,7 +90,7 @@ grad_rho_b(1:3) = one_e_dm_and_grad_beta_in_r(1:3,ipoint,istate) ! We take the on-top pair density of the UEG which is (1-zeta^2) rhoc^2 g0 = 4 rhoa * rhob * g0 - on_top = 4.d0 * rho_a * rho_b * g0_UEG_mu_inf(rho_a,rho_b) + on_top = 4.d0 * rho_a * rho_b * g0_UEG_mu_inf(rho_a,rho_b) ! The form of interpolated (mu=0 ---> mu=infinity) functional originally introduced in JCP, 150, 084103 1-10 (2019) call ec_md_pbe_on_top_general(mu,rho_a,rho_b,grad_rho_a,grad_rho_b,on_top,eps_c_md_PBE) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 00c1a40c..156c4344 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -524,11 +524,11 @@ def conv(i): alpha = [ uint64_to_int64(int(i,2)) for i in qp_bitmasks.string_to_bitmask(alpha_s) ][::-1] beta = [ uint64_to_int64(int(i,2)) for i in qp_bitmasks.string_to_bitmask(beta_s ) ][::-1] ezfio.set_determinants_bit_kind(8) - ezfio.set_determinants_n_int(1+mo_num//64) + ezfio.set_determinants_n_int(1+(mo_num-1)//64) ezfio.set_determinants_n_det(1) ezfio.set_determinants_n_states(1) - ezfio.set_determinants_psi_det(alpha+beta) ezfio.set_determinants_psi_coef([[1.0]]) + ezfio.set_determinants_psi_det(alpha+beta) print("OK") 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 b19be1e2..bdfa2096 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -59,6 +59,28 @@ endif END_PROVIDER +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! T^T . S . T + END_DOC + double precision, allocatable :: S(:,:) + allocate (S(ao_sphe_num,ao_num)) + + call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), & + ao_overlap,size(ao_overlap,1), 0.d0, & + S, size(S,1)) + + call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + S, size(S,1), & + ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), 0.d0, & + ao_cart_to_sphe_overlap,size(ao_cart_to_sphe_overlap,1)) + + deallocate(S) + +END_PROVIDER + BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_sphe_num,ao_num) ] implicit none BEGIN_DOC @@ -82,7 +104,7 @@ integer :: i do i=1,ao_num - ao_cart_to_sphe_inv(:,i) = Rinv(:,i) !/ ao_cart_to_sphe_normalization(i) + ao_cart_to_sphe_inv(:,i) = Rinv(:,i) enddo END_PROVIDER @@ -132,7 +154,7 @@ enddo ao_ortho_canonical_num = ao_sphe_num - call ortho_canonical(ao_sphe_overlap, size(ao_sphe_overlap,1), & + call ortho_canonical(ao_cart_to_sphe_overlap, size(ao_cart_to_sphe_overlap,1), & ao_sphe_num, S, size(S,1), ao_ortho_canonical_num, lin_dep_cutoff) call dgemm('N','N', ao_num, ao_ortho_canonical_num, ao_sphe_num, 1.d0, & diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index 1cb7617e..a04eae69 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -649,11 +649,20 @@ double precision function general_primitive_integral(dim, & ! call multiply_poly(d_poly ,n_pt_tmp ,Iz_pol,n_Iz,d1,n_pt_out) if (ior(n_pt_tmp,n_Iz) >= 0) then ! Bottleneck here - do ib=0,n_pt_tmp + if (ic > ib) then + do ib=0,n_pt_tmp + d1(ib:) = d1(ib:) + Iz_pol(:) * d_poly(ib) + enddo + else do ic = 0,n_Iz - d1(ib+ic) = d1(ib+ic) + Iz_pol(ic) * d_poly(ib) + d1(ic:) = d1(ic:) + Iz_pol(ic) * d_poly(:) enddo - enddo + endif +! do ib=0,n_pt_tmp +! do ic = 0,n_Iz +! d1(ib+ic) = d1(ib+ic) + Iz_pol(ic) * d_poly(ib) +! enddo +! enddo do n_pt_out = n_pt_tmp+n_Iz, 0, -1 if (d1(n_pt_out) /= 0.d0) exit diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index 4ba0964a..66bedb07 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -222,7 +222,7 @@ subroutine Roothaan_Hall_SCF endif - ! Identify degenerate MOs and force them to be on the axes + ! Identify degenerate MOs and combine them to force them to be on the axes allocate(S(ao_num,ao_num)) i=1 do while (i Date: Thu, 20 Mar 2025 11:49:21 +0100 Subject: [PATCH 118/175] Fix basis correction --- .../basis_correction/weak_corr_func.irp.f | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/plugins/local/basis_correction/weak_corr_func.irp.f b/plugins/local/basis_correction/weak_corr_func.irp.f index a31ff3af..99ea504b 100644 --- a/plugins/local/basis_correction/weak_corr_func.irp.f +++ b/plugins/local/basis_correction/weak_corr_func.irp.f @@ -10,21 +10,28 @@ double precision :: rho_a, rho_b, ec, rho, p2 double precision :: wall0,wall1,weight,mu logical :: dospin + double precision, external :: g0_UEG_mu_inf dospin = .true. ! JT dospin have to be set to true for open shell print*,'Providing ecmd_lda_mu_of_r ...' ecmd_lda_mu_of_r = 0.d0 call wall_time(wall0) - if (mu_of_r_potential.EQ."proj")then + if (mu_of_r_potential.EQ."proj_DUMMY")then do istate = 1, N_states do ipoint = 1, n_points_final_grid ! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018) mu = mu_of_r_prov(ipoint,istate) weight = final_weight_at_r_vector(ipoint) - rho = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) - p2 = !TODO - rho_a = 0.5d0*(rho - dsqrt(-p2 + rho*rho)) - rho_b = 0.5d0*(rho + dsqrt(-p2 + rho*rho)) + rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) + rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + rho = rho_a + rho_b +! p2 = rho_a*rho_b +! We take the on-top pair density of the UEG which is (1-zeta^2) rhoc^2 g0 = 4 rhoa * rhob * g0 + p2 = 4.d0 * rho_a * rho_b * g0_UEG_mu_inf(rho_a,rho_b) + rho_a = 0.5d0*(rho + dsqrt(rho*rho - 4.d0*p2)) + rho_b = 0.5d0*(rho - dsqrt(rho*rho - 4.d0*p2)) +! rho_a = 0.5d0*rho +! rho_b = 0.5d0*rho ! Ecmd within the LDA approximation of PRB 73, 155111 (2006) call ESRC_MD_LDAERF (mu,rho_a,rho_b,dospin,ec) if(isnan(ec))then @@ -71,7 +78,7 @@ double precision :: weight integer :: ipoint,istate double precision :: eps_c_md_PBE,mu,rho_a,rho_b,grad_rho_a(3),grad_rho_b(3),on_top - double precision :: g0_UEG_mu_inf + double precision, external :: g0_UEG_mu_inf ecmd_pbe_ueg_mu_of_r = 0.d0 From 9c1f81180076f5721d53123013437e2374e4c390 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 20 Mar 2025 12:14:31 +0100 Subject: [PATCH 119/175] Fixed representations in spherical AOs --- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 5 ++-- src/ao_one_e_ints/ao_overlap.irp.f | 4 ++-- src/ao_one_e_ints/kin_ao_ints.irp.f | 4 ++-- src/ao_one_e_ints/pot_ao_ints.irp.f | 4 ++-- src/mo_basis/mos.irp.f | 27 ++++++++++++++++++---- src/scf_utils/roothaan_hall_scf.irp.f | 4 ---- 6 files changed, 31 insertions(+), 17 deletions(-) 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 bdfa2096..523e49f7 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -99,8 +99,9 @@ R(:,:) = ao_cart_to_sphe_coef(:,:) call dgemm('N','T', m, m, k, 1.d0, R, k, R, k, 0.d0, S, m) - call get_pseudo_inverse(S, k, k, m, Sinv, k, 1.d-20) - call dgemm('T','T', m, m, k, 1.d0, R, k, Sinv, k, 0.d0, Rinv, m) + call get_pseudo_inverse(S, k, k, m, Sinv, k, 1.d-12) + call dgemm('T','N', m, m, k, 1.d0, R, k, Sinv, k, 0.d0, Rinv, m) + integer :: i do i=1,ao_num diff --git a/src/ao_one_e_ints/ao_overlap.irp.f b/src/ao_one_e_ints/ao_overlap.irp.f index cc676c4b..17eb7cbc 100644 --- a/src/ao_one_e_ints/ao_overlap.irp.f +++ b/src/ao_one_e_ints/ao_overlap.irp.f @@ -317,12 +317,12 @@ double precision, allocatable :: tmp(:,:) allocate (tmp(ao_sphe_num,ao_num)) - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + call dgemm('N','N',ao_sphe_num,ao_num,ao_num, 1.d0, & ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & ao_overlap,size(ao_overlap,1), 0.d0, & tmp, size(tmp,1)) - call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + call dgemm('N','T',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & tmp, size(tmp,1), & ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & ao_sphe_overlap,size(ao_sphe_overlap,1)) diff --git a/src/ao_one_e_ints/kin_ao_ints.irp.f b/src/ao_one_e_ints/kin_ao_ints.irp.f index f450721d..1e3e684d 100644 --- a/src/ao_one_e_ints/kin_ao_ints.irp.f +++ b/src/ao_one_e_ints/kin_ao_ints.irp.f @@ -199,12 +199,12 @@ double precision, allocatable :: tmp(:,:) allocate (tmp(ao_sphe_num,ao_num)) - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + call dgemm('N','N',ao_sphe_num,ao_num,ao_num, 1.d0, & ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & ao_kinetic_integrals,size(ao_kinetic_integrals,1), 0.d0, & tmp, size(tmp,1)) - call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + call dgemm('N','T',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & tmp, size(tmp,1), & ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & ao_sphe_kinetic_integrals,size(ao_sphe_kinetic_integrals,1)) diff --git a/src/ao_one_e_ints/pot_ao_ints.irp.f b/src/ao_one_e_ints/pot_ao_ints.irp.f index c1544a5d..b4b4aa02 100644 --- a/src/ao_one_e_ints/pot_ao_ints.irp.f +++ b/src/ao_one_e_ints/pot_ao_ints.irp.f @@ -618,12 +618,12 @@ double precision function V_r(n,alpha) double precision, allocatable :: tmp(:,:) allocate (tmp(ao_sphe_num,ao_num)) - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + call dgemm('N','N',ao_sphe_num,ao_num,ao_num, 1.d0, & ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), & ao_integrals_n_e,size(ao_integrals_n_e,1), 0.d0, & tmp, size(tmp,1)) - call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & + call dgemm('N','T',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & tmp, size(tmp,1), & ao_cart_to_sphe_inv,size(ao_cart_to_sphe_inv,1), 0.d0, & ao_sphe_integrals_n_e,size(ao_sphe_integrals_n_e,1)) diff --git a/src/mo_basis/mos.irp.f b/src/mo_basis/mos.irp.f index 1eecca6c..4da8ac9b 100644 --- a/src/mo_basis/mos.irp.f +++ b/src/mo_basis/mos.irp.f @@ -352,14 +352,31 @@ subroutine ao_ortho_cano_to_ao(A_ao,LDA_ao,A,LDA) BEGIN_DOC ! MO coefficients in the basis of spherical harmonics AOs. END_DOC - double precision, allocatable :: tmp(:,:) - allocate (tmp(ao_sphe_num,ao_num)) + double precision, allocatable, dimension (:,:) :: C0, S, tmp + allocate(C0(ao_sphe_num,mo_num), S(mo_num,mo_num), tmp(mo_num,ao_sphe_num)) - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & + call dgemm('T','N',ao_sphe_num,mo_num,ao_num, 1.d0, & ao_cart_to_sphe_coef,ao_num, & mo_coef,size(mo_coef,1), 0.d0, & - mo_sphe_coef, size(mo_sphe_coef,1)) + C0, size(C0,1)) - deallocate (tmp) + ! C0^T S S^0 + call dgemm('T','N',mo_num,ao_sphe_num,ao_sphe_num, 1.d0, & + C0,size(C0,1), & + ao_sphe_overlap,size(ao_sphe_overlap,1), 0.d0, & + tmp, size(tmp,1)) + + call dgemm('N','N',mo_num,mo_num,ao_sphe_num, 1.d0, & + tmp, size(tmp,1), & + C0,size(C0,1), 0.d0, & + S, size(S,1)) + + integer :: m + m = ao_sphe_num + mo_sphe_coef = C0 + call ortho_lowdin(S,size(S,1),mo_num,mo_sphe_coef,ao_sphe_num,m,1.d-10) + + + deallocate (tmp, S, C0) END_PROVIDER diff --git a/src/scf_utils/roothaan_hall_scf.irp.f b/src/scf_utils/roothaan_hall_scf.irp.f index 66bedb07..7a73121b 100644 --- a/src/scf_utils/roothaan_hall_scf.irp.f +++ b/src/scf_utils/roothaan_hall_scf.irp.f @@ -239,10 +239,6 @@ subroutine Roothaan_Hall_SCF endif i = j enddo - TOUCH mo_coef - call mo_as_eigvectors_of_mo_matrix(Fock_matrix_mo,size(Fock_matrix_mo,1), & - size(Fock_matrix_mo,2),mo_label,1,.true.) - call restore_symmetry(ao_num, mo_num, mo_coef, size(mo_coef,1), 1.d-10) if(do_mom)then call reorder_mo_max_overlap From 66ce7bba22a3c75380a3370a6bf0ce04c6043c3d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 20 Mar 2025 15:19:26 +0100 Subject: [PATCH 120/175] Fixed trexio bug when $USERB is not specified --- src/trexio/export_trexio_routines.irp.f | 42 +++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index 53b21dc9..0c70b5e6 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -72,7 +72,7 @@ subroutine export_trexio(update,full_path) character*(64) :: code(100), author(100), user character*(64), parameter :: qp2_code = "QuantumPackage" - call getenv("USER",user) + call getenv('USER',user) do k=1,N_states rc = trexio_read_metadata_code_num(f(k), code_num) if (rc == TREXIO_ATTR_MISSING) then @@ -95,25 +95,27 @@ subroutine export_trexio(update,full_path) call trexio_assert(rc, TREXIO_SUCCESS) endif - rc = trexio_read_metadata_author_num(f(k), author_num) - if (rc == TREXIO_ATTR_MISSING) then - i = 1 - author_num = 0 - author(:) = "" - else - rc = trexio_read_metadata_author(f(k), author, 64) - do i=1, author_num - if (trim(author(i)) == trim(user)) then - exit - endif - enddo - endif - if (i == author_num+1) then - author(i) = user - rc = trexio_write_metadata_author_num(f(k), i) - call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_write_metadata_author(f(k), author, 64) - call trexio_assert(rc, TREXIO_SUCCESS) + if (trim(user) /= '') then + rc = trexio_read_metadata_author_num(f(k), author_num) + if (rc == TREXIO_ATTR_MISSING) then + i = 1 + author_num = 0 + author(:) = "" + else + rc = trexio_read_metadata_author(f(k), author, 64) + do i=1, author_num + if (trim(author(i)) == trim(user)) then + exit + endif + enddo + endif + if (i == author_num+1) then + author(i) = user + rc = trexio_write_metadata_author_num(f(k), i) + call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_write_metadata_author(f(k), author, 64) + call trexio_assert(rc, TREXIO_SUCCESS) + endif endif enddo From b1fa902513adff33b1af3727f4e8ce9abf2bafdf Mon Sep 17 00:00:00 2001 From: eginer Date: Thu, 20 Mar 2025 15:35:13 +0100 Subject: [PATCH 121/175] added test_extra_basis --- .../extra_basis_int/test_extra_basis.irp.f | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 plugins/local/extra_basis_int/test_extra_basis.irp.f diff --git a/plugins/local/extra_basis_int/test_extra_basis.irp.f b/plugins/local/extra_basis_int/test_extra_basis.irp.f new file mode 100644 index 00000000..b394c47a --- /dev/null +++ b/plugins/local/extra_basis_int/test_extra_basis.irp.f @@ -0,0 +1,58 @@ +program test_extra_basis + implicit none + integer :: i, j, k, l + double precision :: ao_two_e_integral_mixed_direct + print*,'System B nuclei information' + do i = 1, extra_nucl_num + print*,'charge',extra_nucl_charge(i) + print*,'position' + print*,extra_nucl_coord_transp(1:3,i) + enddo + print*,'System A nuclei information' + do i = 1, nucl_num + print*,'charge',nucl_charge(i) + print*,'position' + print*,nucl_coord_transp(1:3,i) + enddo + print*,'vne from B on the basis functions of A' + do i = 1, ao_num + do j = 1, ao_num + print*,j,i,pot_vne_extra_basis(j,i) + enddo + enddo + print*,'vne from A on the basis functions of B' + do i = 1, ao_extra_num + do j = 1, ao_extra_num + print*,j,i,pot_vne_A_extra_basis(j,i) + enddo + enddo + print*,'Density matrix from system A' + do i = 1, ao_num + do j = 1, ao_num + print*,j,i,one_e_dm_ao(j,i) + enddo + enddo + print*,'Density matrix from system B' + output=trim(ezfio_filename)//'.one_e_dm_b' + i_unit_output = getUnitAndOpen(output,'w') + do i = 1, ao_extra_num + do j = 1, ao_extra_num + write(i_unit_output,'(2(I3,X),F16.10)')j,i,ao_extra_one_e_dm(j,i,1) + enddo + enddo + print*,'Two electron integrals between A and B' + character*(128) :: output + integer :: i_unit_output,getUnitAndOpen + output=trim(ezfio_filename)//'.two_e_ints' + i_unit_output = getUnitAndOpen(output,'w') + do i = 1, ao_num + do j = 1, ao_num + do k = 1, ao_extra_num + do l = 1, ao_extra_num + write(i_unit_output,'(4(I3,X),F16.10)')i,j,k,l,ao_two_e_integral_mixed_direct(i, j, k, l) + enddo + enddo + enddo + enddo + +end From 976c5aeb5eb36ff682a48f5d839b7fd51700ca02 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 21 Mar 2025 23:13:55 +0100 Subject: [PATCH 122/175] Add a few functions for spherical/cartesian arrays --- scripts/qp_cipsi_rsh | 1 - scripts/qp_exc_energy.py | 3 + src/ao_basis/aos.irp.f | 14 ++-- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 84 ++++++++++++---------- src/mo_basis/mo_class.irp.f | 39 ++++++++++ src/mo_one_e_ints/ao_to_mo.irp.f | 84 ++++++++++++++++++++++ 6 files changed, 182 insertions(+), 43 deletions(-) delete mode 120000 scripts/qp_cipsi_rsh diff --git a/scripts/qp_cipsi_rsh b/scripts/qp_cipsi_rsh deleted file mode 120000 index c3d4376b..00000000 --- a/scripts/qp_cipsi_rsh +++ /dev/null @@ -1 +0,0 @@ -/home/scemama/qp2/plugins/qp_plugins_lct/stable/rsdft_cipsi/qp_cipsi_rsh \ No newline at end of file diff --git a/scripts/qp_exc_energy.py b/scripts/qp_exc_energy.py index e08866e3..e3060349 100755 --- a/scripts/qp_exc_energy.py +++ b/scripts/qp_exc_energy.py @@ -1,6 +1,9 @@ #!/usr/bin/env python3 # Computes the error on the excitation energy of a CIPSI run. +# see "QUESTDB: a database of highly-accurate excitation energies for the electronic structure community" +# doi:10.1002/wcms.1517 or arXiv:2011.14675 + def student(p,df): import scipy diff --git a/src/ao_basis/aos.irp.f b/src/ao_basis/aos.irp.f index 02eedf53..ef871538 100644 --- a/src/ao_basis/aos.irp.f +++ b/src/ao_basis/aos.irp.f @@ -28,11 +28,15 @@ ! Number of spherical AOs END_DOC integer :: n, i - ao_sphe_num=0 - do i=1,shell_num - n = shell_ang_mom(i) - ao_sphe_num += 2*n+1 - enddo + if (ao_cartesian) then + ao_sphe_num = ao_num + else + ao_sphe_num=0 + do i=1,shell_num + n = shell_ang_mom(i) + ao_sphe_num += 2*n+1 + enddo + endif END_PROVIDER BEGIN_PROVIDER [ integer, ao_sphe_shell, (ao_sphe_num) ] 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 523e49f7..e015c89e 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -14,45 +14,55 @@ prev = 0 ao_cart_to_sphe_coef(:,:) = 0.d0 ao_cart_to_sphe_normalization(:) = 1.d0 - ! 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) + + 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_coef(i+j-1,ao_sphe_count+k) = cart_to_sphe_$SHELL(j,k) + ao_cart_to_sphe_normalization(i+j-1) = cart_to_sphe_norm_$SHELL(j) 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 + 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") diff --git a/src/mo_basis/mo_class.irp.f b/src/mo_basis/mo_class.irp.f index 7705e414..8017e119 100644 --- a/src/mo_basis/mo_class.irp.f +++ b/src/mo_basis/mo_class.irp.f @@ -31,3 +31,42 @@ IRP_ENDIF END_PROVIDER + + + +BEGIN_PROVIDER [ integer, mo_symmetry , (mo_num) ] + implicit none + BEGIN_DOC +! MOs with the same integer belong to the same irrep. + END_DOC + + logical :: has + PROVIDE ezfio_filename + if (mpi_master) then + if (size(mo_symmetry) == 0) return + + call ezfio_has_mo_basis_mo_symmetry(has) + if (has) then +! write(6,'(A)') '.. >>>>> [ IO READ: mo_symmetry ] <<<<< ..' + call ezfio_get_mo_basis_mo_symmetry(mo_symmetry) + else + mo_symmetry(:) = 1 + call ezfio_set_mo_basis_mo_symmetry(mo_symmetry) + endif + 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' + integer :: ierr + call MPI_BCAST( mo_symmetry, (mo_num), MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + stop 'Unable to read mo_symmetry with MPI' + endif + IRP_ENDIF + +! call write_time(6) + +END_PROVIDER diff --git a/src/mo_one_e_ints/ao_to_mo.irp.f b/src/mo_one_e_ints/ao_to_mo.irp.f index 7ebc4638..72c1328d 100644 --- a/src/mo_one_e_ints/ao_to_mo.irp.f +++ b/src/mo_one_e_ints/ao_to_mo.irp.f @@ -73,3 +73,87 @@ subroutine mo_to_ao_no_overlap(A_mo,LDA_mo,A_ao,LDA_ao) END_DOC call mo_to_ao(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_num) END_PROVIDER + + + +! --- + + +subroutine mo_to_ao_sphe(A_mo,LDA_mo,A_ao,LDA_ao) + implicit none + BEGIN_DOC + ! Transform A from the MO basis to the AO basis + ! + ! $(S.C).A_{mo}.(S.C)^\dagger$ + END_DOC + integer, intent(in) :: LDA_ao,LDA_mo + double precision, intent(in) :: A_mo(LDA_mo,mo_num) + double precision, intent(out) :: A_ao(LDA_ao,ao_sphe_num) + double precision, allocatable :: T(:,:) + + allocate ( T(mo_num,ao_sphe_num) ) + + call dgemm('N','T', mo_num, ao_sphe_num, mo_num, & + 1.d0, A_mo,size(A_mo,1), & + S_mo_sphe_coef, size(S_mo_sphe_coef,1), & + 0.d0, T, size(T,1)) + + call dgemm('N','N', ao_sphe_num, ao_sphe_num, mo_num, & + 1.d0, S_mo_sphe_coef, size(S_mo_sphe_coef,1), & + T, size(T,1), & + 0.d0, A_ao, size(A_ao,1)) + + deallocate(T) +end + +subroutine mo_to_ao_sphe_no_overlap(A_mo,LDA_mo,A_ao,LDA_ao) + implicit none + BEGIN_DOC + ! $C.A_{mo}.C^\dagger$ + END_DOC + integer, intent(in) :: LDA_ao,LDA_mo + double precision, intent(in) :: A_mo(LDA_mo,mo_num) + double precision, intent(out) :: A_ao(LDA_ao,ao_sphe_num) + double precision, allocatable :: T(:,:) + + allocate ( T(mo_num,ao_sphe_num) ) + + call dgemm('N','T', mo_num, ao_sphe_num, mo_num, & + 1.d0, A_mo,size(A_mo,1), & + mo_sphe_coef, size(mo_sphe_coef,1), & + 0.d0, T, size(T,1)) + + call dgemm('N','N', ao_sphe_num, ao_sphe_num, mo_num, & + 1.d0, mo_sphe_coef, size(mo_sphe_coef,1), & + T, size(T,1), & + 0.d0, A_ao, size(A_ao,1)) + + deallocate(T) +end + +BEGIN_PROVIDER [ double precision, S_mo_sphe_coef, (ao_sphe_num, mo_num) ] + implicit none + BEGIN_DOC + ! Product S.C where S is the overlap matrix in the AO basis and C the mo_sphe_coef matrix. + END_DOC + + call dgemm('N','N', ao_sphe_num, mo_num, ao_sphe_num, & + 1.d0, ao_overlap,size(ao_overlap,1), & + mo_sphe_coef, size(mo_coef,1), & + 0.d0, S_mo_coef, size(S_mo_coef,1)) + +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_sphe_one_e_integrals_from_mo, (ao_sphe_num, ao_sphe_num)] + implicit none + BEGIN_DOC +! Integrals of the one e hamiltonian obtained from the integrals on the MO basis +! +! WARNING : this is equal to ao_one_e_integrals only if the AO and MO basis have the same number of functions + END_DOC + call mo_to_ao_sphe(mo_one_e_integrals,mo_num,ao_one_e_integrals_from_mo,ao_sphe_num) +END_PROVIDER + + + From 910cffee7a996c54988e40d700184f8853ec59b1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 21 Mar 2025 23:36:07 +0100 Subject: [PATCH 123/175] Fixed integrals broken in 854b9177 --- external/ezfio | 2 +- external/irpf90 | 2 +- src/ao_two_e_ints/two_e_integrals.irp.f | 15 +++------------ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/external/ezfio b/external/ezfio index d02132ea..dba01c4f 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 +Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 diff --git a/external/irpf90 b/external/irpf90 index 43160c60..4ab1b175 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b +Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 diff --git a/src/ao_two_e_ints/two_e_integrals.irp.f b/src/ao_two_e_ints/two_e_integrals.irp.f index a04eae69..1cb7617e 100644 --- a/src/ao_two_e_ints/two_e_integrals.irp.f +++ b/src/ao_two_e_ints/two_e_integrals.irp.f @@ -649,20 +649,11 @@ double precision function general_primitive_integral(dim, & ! call multiply_poly(d_poly ,n_pt_tmp ,Iz_pol,n_Iz,d1,n_pt_out) if (ior(n_pt_tmp,n_Iz) >= 0) then ! Bottleneck here - if (ic > ib) then - do ib=0,n_pt_tmp - d1(ib:) = d1(ib:) + Iz_pol(:) * d_poly(ib) - enddo - else + do ib=0,n_pt_tmp do ic = 0,n_Iz - d1(ic:) = d1(ic:) + Iz_pol(ic) * d_poly(:) + d1(ib+ic) = d1(ib+ic) + Iz_pol(ic) * d_poly(ib) enddo - endif -! do ib=0,n_pt_tmp -! do ic = 0,n_Iz -! d1(ib+ic) = d1(ib+ic) + Iz_pol(ic) * d_poly(ib) -! enddo -! enddo + enddo do n_pt_out = n_pt_tmp+n_Iz, 0, -1 if (d1(n_pt_out) /= 0.d0) exit From bdcf7ec432bd69ba4a485e4641710aa4243e3148 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 22 Mar 2025 00:49:00 +0100 Subject: [PATCH 124/175] Fix spin_det_search_key --- src/determinants/spindeterminants.irp.f | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/determinants/spindeterminants.irp.f b/src/determinants/spindeterminants.irp.f index 2f497bd7..b087ec24 100644 --- a/src/determinants/spindeterminants.irp.f +++ b/src/determinants/spindeterminants.irp.f @@ -16,11 +16,10 @@ integer*8 function spin_det_search_key(det,Nint) integer(bit_kind), intent(in) :: det(Nint) integer(bit_kind), parameter :: unsigned_shift = 1_bit_kind-huge(1_bit_kind) ! 100...00 integer :: i - spin_det_search_key = det(1) + spin_det_search_key = det(1)+unsigned_shift do i=2,Nint spin_det_search_key = ieor(spin_det_search_key,det(i)) enddo - spin_det_search_key = spin_det_search_key+unsigned_shift end From 989fcb81b05a5476782a67c61cd1e67e143fad20 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 25 Mar 2025 17:17:37 +0100 Subject: [PATCH 125/175] Symmetrize pseudo one_e integrals --- .../basis_correction/print_routine.irp.f | 3 ++- src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f | 25 ++++++++++++++----- src/mu_of_r/mu_of_r_conditions.irp.f | 2 +- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/plugins/local/basis_correction/print_routine.irp.f b/plugins/local/basis_correction/print_routine.irp.f index cc9744f2..e4f42510 100644 --- a/plugins/local/basis_correction/print_routine.irp.f +++ b/plugins/local/basis_correction/print_routine.irp.f @@ -43,7 +43,8 @@ subroutine print_basis_correction else if(mu_of_r_potential.EQ."cas_full".or. & mu_of_r_potential.EQ."cas_truncated".or. & - mu_of_r_potential.EQ."pure_act") then + mu_of_r_potential.EQ."pure_act".or. & + mu_of_r_potential.EQ."proj_cas") then print*, '' print*,'Using a CAS-like two-body density to define mu(r)' print*,'This assumes that the CAS is a qualitative representation of the wave function ' diff --git a/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f b/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f index 851f26d8..f752614c 100644 --- a/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f +++ b/src/ao_one_e_ints/pot_ao_pseudo_ints.irp.f @@ -116,13 +116,14 @@ alpha = ao_expo_ordered_transp(l,j) do m=1,ao_prim_num(i) - beta = ao_expo_ordered_transp(m,i) - c = 0.d0 - if (dabs(ao_coef_normalized_ordered_transp(l,j)*ao_coef_normalized_ordered_transp(m,i))& < thresh) then cycle endif + + beta = ao_expo_ordered_transp(m,i) + c = 0.d0 + do k = 1, nucl_num Z = nucl_charge(k) @@ -154,6 +155,12 @@ !$OMP END DO !$OMP END PARALLEL + do i=1,ao_num + do j=1,i + ao_pseudo_integrals_local(j,i) = 0.5d0*(ao_pseudo_integrals_local(i,j) + ao_pseudo_integrals_local(i,j)) + ao_pseudo_integrals_local(i,j) = ao_pseudo_integrals_local(i,j) + enddo + enddo END_PROVIDER @@ -216,14 +223,14 @@ alpha = ao_expo_ordered_transp(l,j) do m=1,ao_prim_num(i) - beta = ao_expo_ordered_transp(m,i) - c = 0.d0 - if (dabs(ao_coef_normalized_ordered_transp(l,j)*ao_coef_normalized_ordered_transp(m,i))& < thresh) then cycle endif + beta = ao_expo_ordered_transp(m,i) + c = 0.d0 + do k = 1, nucl_num Z = nucl_charge(k) @@ -256,6 +263,12 @@ !$OMP END PARALLEL + do i=1,ao_num + do j=1,i + ao_pseudo_integrals_non_local(j,i) = 0.5d0*(ao_pseudo_integrals_non_local(i,j) + ao_pseudo_integrals_non_local(i,j)) + ao_pseudo_integrals_non_local(i,j) = ao_pseudo_integrals_non_local(i,j) + enddo + enddo END_PROVIDER BEGIN_PROVIDER [ double precision, pseudo_v_k_transp, (pseudo_klocmax,nucl_num) ] diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index d13605f6..f0b81eb8 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -38,7 +38,7 @@ do ipoint = 1, n_points_final_grid mu_of_r_prov(ipoint,istate) = mu_of_r_psi_cas(ipoint,istate) enddo - else if(mu_of_r_potential.EQ."proj")then + else if((mu_of_r_potential.EQ."proj").or.(mu_of_r_potential.EQ."proj_cas"))then do ipoint = 1, n_points_final_grid mu_of_r_prov(ipoint,istate) = mu_of_r_projector_mo(ipoint) enddo From e2550f6d99876962018764fe22a1a8def5ee0434 Mon Sep 17 00:00:00 2001 From: eginer Date: Tue, 1 Apr 2025 16:18:07 +0200 Subject: [PATCH 126/175] added the possibility to read/write the extra grid and modified the script to copy the grid --- external/irpf90 | 2 +- plugins/local/extra_basis_int/NEED | 1 + .../extra_basis_int/test_extra_basis.irp.f | 17 +++- src/ao_extra_basis/NEED | 1 + src/ao_extra_basis/qp_copy_extra_basis | 24 ++++- src/ao_extra_basis/write_extra_grid.irp.f | 13 +++ src/becke_numerical_grid/EZFIO.cfg | 18 ++++ .../extra_grid_vector.irp.f | 89 ++++++++++++------- .../grid_becke_vector.irp.f | 3 +- 9 files changed, 128 insertions(+), 40 deletions(-) create mode 100644 src/ao_extra_basis/write_extra_grid.irp.f diff --git a/external/irpf90 b/external/irpf90 index 43160c60..4ab1b175 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b +Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 diff --git a/plugins/local/extra_basis_int/NEED b/plugins/local/extra_basis_int/NEED index 0419f87f..76ae72cd 100644 --- a/plugins/local/extra_basis_int/NEED +++ b/plugins/local/extra_basis_int/NEED @@ -2,3 +2,4 @@ ao_extra_basis ao_one_e_ints ao_two_e_ints determinants +becke_numerical_grid diff --git a/plugins/local/extra_basis_int/test_extra_basis.irp.f b/plugins/local/extra_basis_int/test_extra_basis.irp.f index b394c47a..71663767 100644 --- a/plugins/local/extra_basis_int/test_extra_basis.irp.f +++ b/plugins/local/extra_basis_int/test_extra_basis.irp.f @@ -26,12 +26,21 @@ program test_extra_basis print*,j,i,pot_vne_A_extra_basis(j,i) enddo enddo - print*,'Density matrix from system A' + print*,'Density matrix from system A in the AO basis' do i = 1, ao_num - do j = 1, ao_num - print*,j,i,one_e_dm_ao(j,i) - enddo +! do j = 1, ao_num + write(*,'(100(F16.10,X))')one_e_dm_ao(:,i) +! enddo + enddo + + print*,'Density matrix from system A in the MO basis' + do i = 1, mo_num +! do j = 1, mo_num + write(*,'(100(F16.10,X))')one_e_dm_mo(:,i) +! enddo enddo + + print*,'Density matrix from system B' output=trim(ezfio_filename)//'.one_e_dm_b' i_unit_output = getUnitAndOpen(output,'w') diff --git a/src/ao_extra_basis/NEED b/src/ao_extra_basis/NEED index c4e8c3cf..1680d011 100644 --- a/src/ao_extra_basis/NEED +++ b/src/ao_extra_basis/NEED @@ -1,3 +1,4 @@ extra_nuclei basis ao_basis +becke_numerical_grid diff --git a/src/ao_extra_basis/qp_copy_extra_basis b/src/ao_extra_basis/qp_copy_extra_basis index 6d0e17b8..9d08392b 100755 --- a/src/ao_extra_basis/qp_copy_extra_basis +++ b/src/ao_extra_basis/qp_copy_extra_basis @@ -10,7 +10,8 @@ dir=${QP} EZFIO_extra=${1%/} EZFIO_extra=${EZFIO_extra%.xyz} EZFIO_target=${2%/} - +qp set_file ${EZFIO_extra} +qp run write_extra_grid echo "********** SCRIPT TO COPY DATA FROM EZFIO TO ANOTHER *********" @@ -65,3 +66,24 @@ i=data_one_e_dm_tot_ao.gz newfile=ao_extra_one_e_dm.gz cp ${EZFIO_extra}/aux_quantities/$i ${EZFIO_target}/ao_extra_basis/$newfile +echo "COPYING ALL DATA FROM "$EZFIO_extra" extra grid to "${EZFIO_target}"/becke_numerical_grid/" +## NPOINTS +i=n_points_extra_final_grid +newfile=n_points_extra_final_grid +cp ${EZFIO_extra}/becke_numerical_grid/$i ${EZFIO_target}/becke_numerical_grid/$newfile + +## WEIGHTS +i=final_weight_at_r_vector_extra.gz +newfile=final_weight_at_r_vector_extra.gz +cp ${EZFIO_extra}/becke_numerical_grid/$i ${EZFIO_target}/becke_numerical_grid/$newfile + +## GRID POINTS +i=final_grid_points_extra.gz +newfile=final_grid_points_extra.gz +cp ${EZFIO_extra}/becke_numerical_grid/$i ${EZFIO_target}/becke_numerical_grid/$newfile + +## INPUT/OUTPUT +i=io_extra_grid +newfile=io_extra_grid +cp ${EZFIO_extra}/becke_numerical_grid/$i ${EZFIO_target}/becke_numerical_grid/$newfile + diff --git a/src/ao_extra_basis/write_extra_grid.irp.f b/src/ao_extra_basis/write_extra_grid.irp.f new file mode 100644 index 00000000..ffeee5b7 --- /dev/null +++ b/src/ao_extra_basis/write_extra_grid.irp.f @@ -0,0 +1,13 @@ +program write_extra_grid_in_ezfio + implicit none + io_extra_grid = "Write" + touch io_extra_grid + call routine + +end + +subroutine routine + implicit none + provide final_grid_points_extra + call ezfio_set_becke_numerical_grid_io_extra_grid("Read") +end diff --git a/src/becke_numerical_grid/EZFIO.cfg b/src/becke_numerical_grid/EZFIO.cfg index e660fd6d..74973e34 100644 --- a/src/becke_numerical_grid/EZFIO.cfg +++ b/src/becke_numerical_grid/EZFIO.cfg @@ -38,6 +38,18 @@ type: integer doc: Total number of extra_grid points interface: ezfio +[final_grid_points_extra] +type: double precision +doc: Grid points on the extra grid +size: (3,becke_numerical_grid.n_points_extra_final_grid) +interface: ezfio + +[final_weight_at_r_vector_extra] +type: double precision +doc: Weights of the points on the extra grid +size: (becke_numerical_grid.n_points_extra_final_grid) +interface: ezfio + [extra_grid_type_sgn] type: integer doc: Type of extra_grid used for the Becke's numerical extra_grid. Can be, by increasing accuracy: [ 0 | 1 | 2 | 3 ] @@ -80,3 +92,9 @@ doc: method used to sample the radial space. Possible choices are [KNOWLES | GIL interface: ezfio,provider,ocaml default: KNOWLES +[io_extra_grid] +type: Disk_access +doc: Read/Write the extra grid from/to disk [ Write | Read | None ] +interface: ezfio,provider,ocaml +default: None + diff --git a/src/becke_numerical_grid/extra_grid_vector.irp.f b/src/becke_numerical_grid/extra_grid_vector.irp.f index e054e22c..bb0296a5 100644 --- a/src/becke_numerical_grid/extra_grid_vector.irp.f +++ b/src/becke_numerical_grid/extra_grid_vector.irp.f @@ -10,22 +10,30 @@ implicit none integer :: i, j, k, l - n_points_extra_final_grid = 0 - - do j = 1, nucl_num - do i = 1, n_points_extra_radial_grid -1 - do k = 1, n_points_extra_integration_angular - if(dabs(final_weight_at_r_extra(k,i,j)) < thresh_extra_grid) then - cycle - endif - n_points_extra_final_grid += 1 + if (read_extra_grid)then + print*,'Reading number of extra grid points ' + call ezfio_get_becke_numerical_grid_n_points_extra_final_grid(i) + n_points_extra_final_grid = i + else + print*,'Computing number of extra grid points and weights based on a sperical grid' + n_points_extra_final_grid = 0 + do j = 1, nucl_num + do i = 1, n_points_extra_radial_grid -1 + do k = 1, n_points_extra_integration_angular + if(dabs(final_weight_at_r_extra(k,i,j)) < thresh_extra_grid) then + cycle + endif + n_points_extra_final_grid += 1 + enddo enddo enddo - enddo - + print*, ' n max point = ', n_points_extra_integration_angular*(n_points_extra_radial_grid*nucl_num - 1) + endif print*, ' n_points_extra_final_grid = ', n_points_extra_final_grid - print*, ' n max point = ', n_points_extra_integration_angular*(n_points_extra_radial_grid*nucl_num - 1) - call ezfio_set_becke_numerical_grid_n_points_extra_final_grid(n_points_extra_final_grid) + if(write_extra_grid)then + print*,'Writing number of extra grid points and weights based on a sperical grid' + call ezfio_set_becke_numerical_grid_n_points_extra_final_grid(n_points_extra_final_grid) + endif END_PROVIDER @@ -54,26 +62,41 @@ call wall_time(wall0) print *, ' Providing extra_final_grid_points ...' - i_count = 0 - do j = 1, nucl_num - do i = 1, n_points_extra_radial_grid -1 - do k = 1, n_points_extra_integration_angular - if(dabs(final_weight_at_r_extra(k,i,j)) < thresh_extra_grid)then - cycle - endif - i_count += 1 - final_grid_points_extra(1,i_count) = grid_points_extra_per_atom(1,k,i,j) - final_grid_points_extra(2,i_count) = grid_points_extra_per_atom(2,k,i,j) - final_grid_points_extra(3,i_count) = grid_points_extra_per_atom(3,k,i,j) - final_weight_at_r_vector_extra(i_count) = final_weight_at_r_extra(k,i,j) - index_final_points_extra(1,i_count) = k - index_final_points_extra(2,i_count) = i - index_final_points_extra(3,i_count) = j - index_final_points_extra_reverse(k,i,j) = i_count - enddo - enddo - enddo - + + if (read_extra_grid)then + print*,'Reading extra grid points and weights' + call ezfio_get_becke_numerical_grid_final_grid_points_extra(final_grid_points_extra) + call ezfio_get_becke_numerical_grid_final_weight_at_r_vector_extra(final_weight_at_r_vector_extra) + index_final_points_extra = -10000000 + index_final_points_extra_reverse = -10000 + else + print*,'Computing extra grid points and weights based on a sperical grid' + i_count = 0 + do j = 1, nucl_num + do i = 1, n_points_extra_radial_grid -1 + do k = 1, n_points_extra_integration_angular + if(dabs(final_weight_at_r_extra(k,i,j)) < thresh_extra_grid)then + cycle + endif + i_count += 1 + final_grid_points_extra(1,i_count) = grid_points_extra_per_atom(1,k,i,j) + final_grid_points_extra(2,i_count) = grid_points_extra_per_atom(2,k,i,j) + final_grid_points_extra(3,i_count) = grid_points_extra_per_atom(3,k,i,j) + final_weight_at_r_vector_extra(i_count) = final_weight_at_r_extra(k,i,j) + index_final_points_extra(1,i_count) = k + index_final_points_extra(2,i_count) = i + index_final_points_extra(3,i_count) = j + index_final_points_extra_reverse(k,i,j) = i_count + enddo + enddo + enddo + endif + + if(write_extra_grid)then + print*,'Writing extra grid points and weights based on a sperical grid' + call ezfio_set_becke_numerical_grid_final_grid_points_extra(final_grid_points_extra) + call ezfio_set_becke_numerical_grid_final_weight_at_r_vector_extra(final_weight_at_r_vector_extra) + endif call wall_time(wall1) print *, ' wall time for extra_final_grid_points,', wall1 - wall0 call print_memory_usage() diff --git a/src/becke_numerical_grid/grid_becke_vector.irp.f b/src/becke_numerical_grid/grid_becke_vector.irp.f index f696b023..e9d4e3cf 100644 --- a/src/becke_numerical_grid/grid_becke_vector.irp.f +++ b/src/becke_numerical_grid/grid_becke_vector.irp.f @@ -22,7 +22,8 @@ print*,' n_points_final_grid = ', n_points_final_grid print*,' n max point = ', n_points_integration_angular*(n_points_radial_grid*nucl_num - 1) - call ezfio_set_becke_numerical_grid_n_points_final_grid(n_points_final_grid) + ! no reason to write in the EZFIO file the number of grid points ? +! call ezfio_set_becke_numerical_grid_n_points_final_grid(n_points_final_grid) END_PROVIDER From edfa7aeb5e4aa01b194d99294ce30649804704f7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 1 Apr 2025 20:29:11 +0200 Subject: [PATCH 127/175] Fixed qp_convert now using trexio in the middle --- bin/qp_convert_output_to_ezfio | 431 +++------------------------------ external/ezfio | 2 +- external/irpf90 | 2 +- scripts/qp_import_trexio.py | 7 +- 4 files changed, 33 insertions(+), 409 deletions(-) diff --git a/bin/qp_convert_output_to_ezfio b/bin/qp_convert_output_to_ezfio index 9c0441b8..58df65d9 100755 --- a/bin/qp_convert_output_to_ezfio +++ b/bin/qp_convert_output_to_ezfio @@ -13,11 +13,9 @@ Options: import sys import os -from functools import reduce -from ezfio import ezfio +import tempfile from docopt import docopt - try: QP_ROOT = os.environ["QP_ROOT"] QP_EZFIO = os.environ["QP_EZFIO"] @@ -30,401 +28,41 @@ else: QP_ROOT + "/install", QP_ROOT + "/scripts"] + sys.path -from resultsFile import * +from ezfio import ezfio +from qp_import_trexio import write_ezfio + try: - from resultsFile import * + from trexio_tools import trexio_run except: - print("Error: resultsFile Python library not installed") + print("Error: trexio-tools python package is not installed.") + print("Use pip install trexio-tools to install it.") sys.exit(1) - - -def write_ezfio(res, filename): - - res.clean_uncontractions() - ezfio.set_file(filename) - ezfio.set_ezfio_files_ezfio_convention(20250211) - - # _ - # |_ | _ _ _|_ ._ _ ._ _ - # |_ | (/_ (_ |_ | (_) | | _> - # - print("Electrons\t...\t", end=' ') - ezfio.set_electrons_elec_alpha_num(res.num_alpha) - ezfio.set_electrons_elec_beta_num(res.num_beta) - print("OK") - - # - # |\ | _ | _ o - # | \| |_| (_ | (/_ | - # - - print("Nuclei\t\t...\t", end=' ') - # ~#~#~#~ # - # I n i t # - # ~#~#~#~ # - - charge = [] - coord_x = [] - coord_y = [] - coord_z = [] - - # ~#~#~#~#~#~#~ # - # P a r s i n g # - # ~#~#~#~#~#~#~ # - - for a in res.geometry: - charge.append(a.charge) - if res.units == 'BOHR': - coord_x.append(a.coord[0]) - coord_y.append(a.coord[1]) - coord_z.append(a.coord[2]) - else: - coord_x.append(a.coord[0] / a0) - coord_y.append(a.coord[1] / a0) - coord_z.append(a.coord[2] / a0) - - - # ~#~#~#~#~ # - # W r i t e # - # ~#~#~#~#~ # - - ezfio.set_nuclei_nucl_num(len(res.geometry)) - ezfio.set_nuclei_nucl_charge(charge) - - # Transformt H1 into H - import re - p = re.compile(r'(\d*)$') - label = [p.sub("", x.name).capitalize() for x in res.geometry] - ezfio.set_nuclei_nucl_label(label) - - ezfio.set_nuclei_nucl_coord(coord_x + coord_y + coord_z) - print("OK") - - # _ - # /\ _ _ |_) _. _ o _ - # /--\ (_) _> |_) (_| _> | _> - # - - print("AOS\t\t...\t", end=' ') - # ~#~#~#~ # - # I n i t # - # ~#~#~#~ # - - at = [] - num_prim = [] - power_x = [] - power_y = [] - power_z = [] - coefficient = [] - exponent = [] - - res.convert_to_cartesian() - - # ~#~#~#~#~#~#~ # - # P a r s i n g # - # ~#~#~#~#~#~#~ # - - for b in res.basis: - c = b.center - for i, atom in enumerate(res.geometry): - if atom.coord == c: - at.append(i + 1) - num_prim.append(len(b.prim)) - s = b.sym - power_x.append(str.count(s, "x")) - power_y.append(str.count(s, "y")) - power_z.append(str.count(s, "z")) - coefficient.append(b.coef) - exponent.append([p.expo for p in b.prim]) - - # ~#~#~#~#~ # - # W r i t e # - # ~#~#~#~#~ # - - ezfio.set_ao_basis_ao_num(len(res.basis)) - ezfio.set_ao_basis_ao_nucl(at) - ezfio.set_ao_basis_ao_prim_num(num_prim) - ezfio.set_ao_basis_ao_power(power_x + power_y + power_z) - - # ~#~#~#~#~#~#~ # - # P a r s i n g # - # ~#~#~#~#~#~#~ # - - prim_num_max = ezfio.get_ao_basis_ao_prim_num_max() - - for i in range(len(res.basis)): - coefficient[i] += [0. for j in range(len(coefficient[i]), prim_num_max)] - exponent[i] += [0. for j in range(len(exponent[i]), prim_num_max)] - - coefficient = reduce(lambda x, y: x + y, coefficient, []) - exponent = reduce(lambda x, y: x + y, exponent, []) - - coef = [] - expo = [] - for i in range(prim_num_max): - for j in range(i, len(coefficient), prim_num_max): - coef.append(coefficient[j]) - expo.append(exponent[j]) - - # ~#~#~#~#~ # - # W r i t e # - # ~#~#~#~#~ # - - ezfio.set_ao_basis_ao_coef(coef) - ezfio.set_basis_ao_normalized(True) - ezfio.set_ao_basis_ao_expo(expo) - ezfio.set_ao_basis_ao_basis("Read by resultsFile") - - print("OK") - - # _ - # |_) _. _ o _ - # |_) (_| _> | _> - # - - print("Basis\t\t...\t", end=' ') - # ~#~#~#~ # - # I n i t # - # ~#~#~#~ # - - coefficient = [] - exponent = [] - - # ~#~#~#~#~#~#~ # - # P a r s i n g # - # ~#~#~#~#~#~#~ # - - inucl = {} - for i, a in enumerate(res.geometry): - inucl[a.coord] = i - - nbasis = 0 - nucl_index = [] - curr_center = -1 - nucl_shell_num = [] - ang_mom = [] - nshell = 0 - nshell_tot = 0 - shell_index = [] - shell_prim_num = [] - for b in res.basis: - s = b.sym - if str.count(s, "y") + str.count(s, "x") == 0: - c = inucl[b.center] - nshell += 1 - nshell_tot += 1 - if c != curr_center: - curr_center = c - nucl_shell_num.append(nshell) - nshell = 0 - nbasis += 1 - nucl_index.append(c+1) - coefficient += b.coef[:len(b.prim)] - exponent += [p.expo for p in b.prim] - ang_mom.append(str.count(s, "z")) - shell_prim_num.append(len(b.prim)) - shell_index += [nshell_tot] * len(b.prim) - - shell_num = len(ang_mom) - assert(shell_index[0] == 1) - assert(shell_index[-1] == shell_num) - - # ~#~#~#~#~ # - # W r i t e # - # ~#~#~#~#~ # - - ezfio.set_basis_basis("Read from ResultsFile") - ezfio.set_basis_shell_num(shell_num) - ezfio.set_basis_basis_nucleus_index(nucl_index) - ezfio.set_basis_prim_num(len(coefficient)) - - ezfio.set_basis_nucleus_shell_num(nucl_shell_num) - ezfio.set_basis_prim_coef(coefficient) - ezfio.set_basis_prim_expo(exponent) - ezfio.set_basis_shell_ang_mom(ang_mom) - ezfio.set_basis_shell_prim_num(shell_prim_num) - ezfio.set_basis_shell_index(shell_index) - - print("OK") - - # _ - # |\/| _ _ |_) _. _ o _ - # | | (_) _> |_) (_| _> | _> - # - - print("MOS\t\t...\t", end=' ') - # ~#~#~#~ # - # I n i t # - # ~#~#~#~ # - - MoTag = res.determinants_mo_type - ezfio.set_mo_basis_mo_label('Orthonormalized') - ezfio.set_determinants_mo_label('Orthonormalized') - MO_type = MoTag - allMOs = res.mo_sets[MO_type] - - # ~#~#~#~#~#~#~ # - # P a r s i n g # - # ~#~#~#~#~#~#~ # - - try: - closed = [(allMOs[i].eigenvalue, i) for i in res.closed_mos] - active = [(allMOs[i].eigenvalue, i) for i in res.active_mos] - virtual = [(allMOs[i].eigenvalue, i) for i in res.virtual_mos] - except: - closed = [] - virtual = [] - active = [(allMOs[i].eigenvalue, i) for i in range(len(allMOs))] - - closed = [x[1] for x in closed] - active = [x[1] for x in active] - virtual = [x[1] for x in virtual] - MOindices = closed + active + virtual - - MOs = [] - for i in MOindices: - MOs.append(allMOs[i]) - - mo_num = len(MOs) - while len(MOindices) < mo_num: - MOindices.append(len(MOindices)) - - MOmap = list(MOindices) - for i in range(len(MOindices)): - MOmap[i] = MOindices.index(i) - - energies = [] - for i in range(mo_num): - energies.append(MOs[i].eigenvalue) - - OccNum = [] - if res.occ_num is not None: - for i in MOindices: - OccNum.append(res.occ_num[MO_type][i]) - else: - for i in range(res.num_beta): - OccNum.append(2.) - for i in range(res.num_beta,res.num_alpha): - OccNum.append(1.) - - while len(OccNum) < mo_num: - OccNum.append(0.) - - MoMatrix = [] - sym0 = [i.sym for i in res.mo_sets[MO_type]] - sym = [i.sym for i in res.mo_sets[MO_type]] - for i in range(len(sym)): - sym[MOmap[i]] = sym0[i] - - irrep = {} - for i in sym: - irrep[i] = 0 - - for i, j in enumerate(irrep.keys()): - irrep[j] = i+1 - - sym = [ irrep[k] for k in sym ] - - MoMatrix = [] - for i in range(len(MOs)): - m = MOs[i] - for coef in m.vector: - MoMatrix.append(coef) - - while len(MoMatrix) < len(MOs[0].vector)**2: - MoMatrix.append(0.) - - # ~#~#~#~#~ # - # W r i t e # - # ~#~#~#~#~ # - - ezfio.set_mo_basis_mo_num(mo_num) - ezfio.set_mo_basis_mo_coef(MoMatrix) - ezfio.set_mo_basis_mo_occ(OccNum) - ezfio.set_mo_basis_mo_symmetry(sym) - - print("OK") - - - print("Pseudos\t\t...\t", end=' ') - try: - lmax = 0 - nucl_charge_remove = [] - klocmax = 0 - kmax = 0 - nucl_num = len(res.geometry) - for ecp in res.pseudo: - lmax_local = ecp['lmax'] - lmax = max(lmax_local, lmax) - nucl_charge_remove.append(ecp['zcore']) - klocmax = max(klocmax, len(ecp[str(lmax_local)])) - for l in range(lmax_local): - kmax = max(kmax, len(ecp[str(l)])) - lmax = lmax-1 - ezfio.set_pseudo_pseudo_lmax(lmax) - ezfio.set_pseudo_nucl_charge_remove(nucl_charge_remove) - ezfio.set_pseudo_pseudo_klocmax(klocmax) - ezfio.set_pseudo_pseudo_kmax(kmax) - pseudo_n_k = [[0 for _ in range(nucl_num)] for _ in range(klocmax)] - pseudo_v_k = [[0. for _ in range(nucl_num)] for _ in range(klocmax)] - pseudo_dz_k = [[0. for _ in range(nucl_num)] for _ in range(klocmax)] - pseudo_n_kl = [[[0 for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)] - pseudo_v_kl = [[[0. for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)] - pseudo_dz_kl = [[[0. for _ in range(nucl_num)] for _ in range(kmax)] for _ in range(lmax+1)] - for ecp in res.pseudo: - lmax_local = ecp['lmax'] - klocmax = len(ecp[str(lmax_local)]) - atom = ecp['atom']-1 - for kloc in range(klocmax): - try: - v, n, dz = ecp[str(lmax_local)][kloc] - pseudo_n_k[kloc][atom] = n-2 - pseudo_v_k[kloc][atom] = v - pseudo_dz_k[kloc][atom] = dz - except: - pass - for l in range(lmax_local): - for k in range(kmax): - try: - v, n, dz = ecp[str(l)][k] - pseudo_n_kl[l][k][atom] = n-2 - pseudo_v_kl[l][k][atom] = v - pseudo_dz_kl[l][k][atom] = dz - except: - pass - ezfio.set_pseudo_pseudo_n_k(pseudo_n_k) - ezfio.set_pseudo_pseudo_v_k(pseudo_v_k) - ezfio.set_pseudo_pseudo_dz_k(pseudo_dz_k) - ezfio.set_pseudo_pseudo_n_kl(pseudo_n_kl) - ezfio.set_pseudo_pseudo_v_kl(pseudo_v_kl) - ezfio.set_pseudo_pseudo_dz_kl(pseudo_dz_kl) - - n_alpha = res.num_alpha - n_beta = res.num_beta - for i in range(nucl_num): - charge[i] -= nucl_charge_remove[i] - ezfio.set_nuclei_nucl_charge(charge) - ezfio.set_electrons_elec_alpha_num(n_alpha) - ezfio.set_electrons_elec_beta_num(n_beta) - - except: - ezfio.set_pseudo_do_pseudo(False) - else: - ezfio.set_pseudo_do_pseudo(True) - - print("OK") - - - - def get_full_path(file_path): file_path = os.path.expanduser(file_path) file_path = os.path.expandvars(file_path) -# file_path = os.path.abspath(file_path) return file_path +class NoneDict(dict): + def __missing__(self, key): + return None + +def main(FILE,EZFIO_FILE): + with tempfile.NamedTemporaryFile(mode='w+b', delete=True, errors=None) as f: + trexio_file = f.name + + args = NoneDict() + args["convert-from"] = True + args["--input"] = FILE + args["--back_end"] = "hdf5" + args["--type"] = "gaussian" + args["TREXIO_FILE"] = trexio_file + + trexio_run.main(filename=trexio_file, args=args) + write_ezfio(trexio_file, EZFIO_FILE) + trexio_run.remove_trexio_file(trexio_file, overwrite=True) + if __name__ == '__main__': ARGUMENTS = docopt(__doc__) @@ -436,20 +74,5 @@ if __name__ == '__main__': else: EZFIO_FILE = "{0}.ezfio".format(FILE) - try: - RES_FILE = getFile(FILE) - except: - raise - else: - print(FILE, 'recognized as', str(RES_FILE).split('.')[-1].split()[0]) - - write_ezfio(RES_FILE, EZFIO_FILE) - sys.stdout.flush() - if os.system("qp_run save_ortho_mos "+EZFIO_FILE) != 0: - print("""Warning: You need to run - - qp run save_ortho_mos - -to be sure your MOs will be orthogonal, which is not the case when -the MOs are read from output files (not enough precision in output).""") + main (FILE,EZFIO_FILE) diff --git a/external/ezfio b/external/ezfio index dba01c4f..d02132ea 160000 --- a/external/ezfio +++ b/external/ezfio @@ -1 +1 @@ -Subproject commit dba01c4fe0ff7b84c5ecfb1c7c77ec68781311b3 +Subproject commit d02132ea79217c16fd24242e8f8b8a6c3ff68091 diff --git a/external/irpf90 b/external/irpf90 index 4ab1b175..43160c60 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 +Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 156c4344..72f24950 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -80,6 +80,8 @@ def create_x(accu,x,y,z): def write_ezfio(trexio_filename, filename): warnings = [] + while trexio_filename[-1] == '/': + trexio_filename = trexio_filename[:-1] trexio_file = trexio.File(trexio_filename,mode='r',back_end=trexio.TREXIO_AUTO) ezfio.set_file(filename) @@ -258,7 +260,6 @@ def write_ezfio(trexio_filename, filename): else: raise TypeError - print(basis_type) except: basis_type = "None" print("None") @@ -275,7 +276,7 @@ def write_ezfio(trexio_filename, filename): if basis_type.lower() == "gaussian" and not cartesian: try: import trexio_tools - tmp = "cartesian_"+trexio_filename + tmp = trexio_filename+"_cartesian" retcode = subprocess.call(["trexio", "convert-to", "-t", "cartesian", "-o", tmp, trexio_filename]) trexio_file_cart = trexio.File(tmp,mode='r',back_end=trexio.TREXIO_AUTO) cartesian = trexio.read_ao_cartesian(trexio_file_cart) @@ -357,7 +358,7 @@ def write_ezfio(trexio_filename, filename): else: if basis_type.lower() == "gaussian" and not cartesian: - warnings.append(f"Spherical AOs not handled by QP. Convert the TREXIO file using trexio_tools:\n trexio convert-to -t cartesian -o cartesian_{trexio_filename} {trexio_filename}") + warnings.append(f"Spherical AOs not handled by QP. Convert the TREXIO file using trexio_tools:\n trexio convert-to -t cartesian -o {trexio_filename}_cartesian {trexio_filename}") warnings.append("Integrals should be imported using:\n qp run import_trexio_integrals") print("None") From c9938913789fcbd37290f020c19262ed05cf508e Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 2 Apr 2025 11:17:54 +0200 Subject: [PATCH 128/175] added test_e_pol_grid.irp.f --- plugins/local/extra_basis_int/NEED | 1 + .../extra_basis_int/test_e_pol_grid.irp.f | 33 +++++++ src/ao_extra_basis/aos.irp.f | 95 +++++++++++++++++++ src/ao_extra_basis/tuto/example_copy.sh | 2 + 4 files changed, 131 insertions(+) create mode 100644 plugins/local/extra_basis_int/test_e_pol_grid.irp.f diff --git a/plugins/local/extra_basis_int/NEED b/plugins/local/extra_basis_int/NEED index 76ae72cd..f32faa74 100644 --- a/plugins/local/extra_basis_int/NEED +++ b/plugins/local/extra_basis_int/NEED @@ -3,3 +3,4 @@ ao_one_e_ints ao_two_e_ints determinants becke_numerical_grid +dft_utils_in_r diff --git a/plugins/local/extra_basis_int/test_e_pol_grid.irp.f b/plugins/local/extra_basis_int/test_e_pol_grid.irp.f new file mode 100644 index 00000000..7e8882b1 --- /dev/null +++ b/plugins/local/extra_basis_int/test_e_pol_grid.irp.f @@ -0,0 +1,33 @@ +program test_e_pol + implicit none + io_extra_grid = "Read" + touch io_extra_grid + call routine +end + +subroutine routine + implicit none + integer :: i1,i2 + double precision :: integral_12, r1(3), r2(3), weight1, weight2 + double precision :: dm_r1_alpha,dm_r1_beta,dm_r1,dm_r2 + integral_12 = 0.d0 + do i1 = 1, n_points_final_grid + r1(1) = final_grid_points(1,i1) + r1(2) = final_grid_points(2,i1) + r1(3) = final_grid_points(3,i1) + weight1 = final_weight_at_r_vector(i1) + call dm_dft_alpha_beta_at_r(r1,dm_r1_alpha,dm_r1_beta) + dm_r1 = dm_r1_alpha+dm_r1_beta ! rhoA(r1) + do i2 = 1, n_points_extra_final_grid + r2(1) = final_grid_points_extra(1,i2) + r2(2) = final_grid_points_extra(2,i2) + r2(3) = final_grid_points_extra(3,i2) + weight2 = final_weight_at_r_vector_extra(i2) + dm_r2 = ao_extra_one_e_dm_at_extra_r(i2) ! rhoB(r2) + integral_12 += dm_r1 * dm_r2 * weight1 * weight2 + enddo + enddo + print*,'integral_12 = ',integral_12 + +end + diff --git a/src/ao_extra_basis/aos.irp.f b/src/ao_extra_basis/aos.irp.f index 56d6fb04..39a2e9b2 100644 --- a/src/ao_extra_basis/aos.irp.f +++ b/src/ao_extra_basis/aos.irp.f @@ -323,3 +323,98 @@ integer function ao_extra_power_index(nx,ny,nz) ao_extra_l_char_space(i) = give_ao_extra_character_space enddo END_PROVIDER + + + --- + +double precision function ao_extra_value(i, r) + + BEGIN_DOC + ! Returns the value of the i-th ao belonging the EXTRA BASIS at point $\textbf{r}$ + END_DOC + + implicit none + integer, intent(in) :: i + double precision, intent(in) :: r(3) + + integer :: m, num_ao + integer :: power_ao(3) + double precision :: center_ao(3) + double precision :: beta + double precision :: accu, dx, dy, dz, r2 + + num_ao = ao_extra_nucl(i) + power_ao(1:3) = ao_extra_power(i,1:3) + center_ao(1:3) = extra_nucl_coord(num_ao,1:3) + dx = r(1) - center_ao(1) + dy = r(2) - center_ao(2) + dz = r(3) - center_ao(3) + r2 = dx*dx + dy*dy + dz*dz + dx = dx**power_ao(1) + dy = dy**power_ao(2) + dz = dz**power_ao(3) + + accu = 0.d0 + do m = 1, ao_extra_prim_num(i) + beta = ao_extra_expo_ordered_transp(m,i) + accu += ao_extra_coef_normalized_ordered_transp(m,i) * dexp(-beta*r2) + enddo + ao_extra_value = accu * dx * dy * dz + +end + + +subroutine give_all_aos_extra_at_r(r, tmp_array) + implicit none + BEGIN_dOC + ! + ! input : r == r(1) = x and so on + ! + ! output : tmp_array(i) = EXTRA aos(i) evaluated in $\textbf{r}$ + ! + END_DOC + double precision, intent(in) :: r(3) + double precision, intent(out) :: tmp_array(ao_extra_num) + integer :: i + double precision :: ao_extra_value + do i = 1, ao_extra_num + tmp_array(i) = ao_extra_value(i, r) + enddo +end + +double precision function extra_density_at_r(r) + implicit none + BEGIN_dOC + ! + ! input : r == r(1) = x and so on + ! + ! output : density corresponding to the extra system at r + ! + END_DOC + double precision, intent(in) :: r(3) + integer :: mu,nu + double precision, allocatable :: tmp_array(:) + allocate(tmp_array(ao_extra_num)) + call give_all_aos_extra_at_r(r, tmp_array) + extra_density_at_r = 0.d0 + do nu = 1, ao_extra_num + do mu = 1, ao_extra_num + extra_density_at_r += ao_extra_one_e_dm(mu,nu,1) * tmp_array(mu) * tmp_array(nu) + enddo + enddo +end + +BEGIN_PROVIDER [ double precision, ao_extra_one_e_dm_at_extra_r, (n_points_extra_final_grid)] + implicit none + BEGIN_DOC +! ao_extra_one_e_dm_at_extra_r(i) = extra density on the extra grid points + END_DOC + integer :: i + double precision :: extra_density_at_r, r(3) + do i = 1, n_points_extra_final_grid + r(1) = final_grid_points_extra(1,i) + r(2) = final_grid_points_extra(2,i) + r(3) = final_grid_points_extra(3,i) + ao_extra_one_e_dm_at_extra_r(i) = extra_density_at_r(r) + enddo +END_PROVIDER diff --git a/src/ao_extra_basis/tuto/example_copy.sh b/src/ao_extra_basis/tuto/example_copy.sh index 0677b183..e08b2825 100755 --- a/src/ao_extra_basis/tuto/example_copy.sh +++ b/src/ao_extra_basis/tuto/example_copy.sh @@ -15,6 +15,8 @@ qp create_ezfio -b $basis_B $sys_B -o ${output_B} qp run scf # we save the density matrix in the EZFIO qp run save_one_e_dm +# we specify a small grid for the system B +qp set becke_numerical_grid extra_grid_type_sgn 0 # we create the system "A" qp create_ezfio -b $basis_A $sys_A -o ${output_A} # We perform an SCF calculation From 29603f9d9139242d230084496cdc80216b9f4e61 Mon Sep 17 00:00:00 2001 From: eginer Date: Thu, 3 Apr 2025 17:31:08 +0200 Subject: [PATCH 129/175] adapted rs_ks_scf --- plugins/local/fci_tc_bi/fci_tc_bi_ortho.irp.f | 14 +++- .../local/tc_bi_ortho/diagonalize_tc_h.irp.f | 4 + plugins/local/tc_scf/tc_scf.irp.f | 4 +- scripts/qp_cipsi_rsh_mu_of_r | 1 - .../routines_save_integrals_erf.irp.f | 1 + src/dft_one_e/effective_pot.irp.f | 10 +++ src/kohn_sham_rs/fock_matrix_rs_ks.irp.f | 81 ------------------- 7 files changed, 31 insertions(+), 84 deletions(-) delete mode 120000 scripts/qp_cipsi_rsh_mu_of_r diff --git a/plugins/local/fci_tc_bi/fci_tc_bi_ortho.irp.f b/plugins/local/fci_tc_bi/fci_tc_bi_ortho.irp.f index f1de0fe3..f224d39d 100644 --- a/plugins/local/fci_tc_bi/fci_tc_bi_ortho.irp.f +++ b/plugins/local/fci_tc_bi/fci_tc_bi_ortho.irp.f @@ -45,10 +45,22 @@ program fci_tc_bi 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 + touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid pruning = -1.d0 touch pruning + call write_int(6, my_n_pt_r_grid, 'radial external grid over') + call write_int(6, my_n_pt_a_grid, 'angular external grid over') + 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 + + call write_int(6, my_n_pt_r_extra_grid, 'radial internal grid over') + call write_int(6, my_n_pt_a_extra_grid, 'angular internal grid over') + endif ! pt2_relative_error = 0.01d0 ! touch pt2_relative_error diff --git a/plugins/local/tc_bi_ortho/diagonalize_tc_h.irp.f b/plugins/local/tc_bi_ortho/diagonalize_tc_h.irp.f index 03388898..d8c8b0f0 100644 --- a/plugins/local/tc_bi_ortho/diagonalize_tc_h.irp.f +++ b/plugins/local/tc_bi_ortho/diagonalize_tc_h.irp.f @@ -17,6 +17,10 @@ program tc_bi_ortho my_n_pt_a_grid = tc_grid1_a touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid + pruning = -1.d0 + touch pruning + call write_int(6, my_n_pt_r_grid, 'radial external grid over') + call write_int(6, my_n_pt_a_grid, 'angular external grid over') if(tc_integ_type .eq. "numeric") then my_extra_grid_becke = .True. PROVIDE tc_grid2_a tc_grid2_r diff --git a/plugins/local/tc_scf/tc_scf.irp.f b/plugins/local/tc_scf/tc_scf.irp.f index 83da03ec..26fea4c6 100644 --- a/plugins/local/tc_scf/tc_scf.irp.f +++ b/plugins/local/tc_scf/tc_scf.irp.f @@ -8,12 +8,14 @@ program tc_scf implicit none - my_grid_becke = .True. + 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 + pruning = -1.d0 + touch pruning call write_int(6, my_n_pt_r_grid, 'radial external grid over') call write_int(6, my_n_pt_a_grid, 'angular external grid over') diff --git a/scripts/qp_cipsi_rsh_mu_of_r b/scripts/qp_cipsi_rsh_mu_of_r deleted file mode 120000 index feef7119..00000000 --- a/scripts/qp_cipsi_rsh_mu_of_r +++ /dev/null @@ -1 +0,0 @@ -/home/scemama/qp2/plugins/qp_plugins_lct/stable/rsdft_cipsi/qp_cipsi_rsh_mu_of_r \ No newline at end of file diff --git a/src/ao_two_e_ints/routines_save_integrals_erf.irp.f b/src/ao_two_e_ints/routines_save_integrals_erf.irp.f index d980bc05..d98d96ce 100644 --- a/src/ao_two_e_ints/routines_save_integrals_erf.irp.f +++ b/src/ao_two_e_ints/routines_save_integrals_erf.irp.f @@ -14,5 +14,6 @@ subroutine save_erf_two_e_ints_ao_into_ints_ao call ezfio_set_work_empty(.False.) call map_save_to_disk(trim(ezfio_filename)//'/work/ao_ints',ao_integrals_erf_map) call ezfio_set_ao_two_e_ints_io_ao_two_e_integrals('Read') + call ezfio_set_ao_two_e_ints_do_ao_cholesky('Read') end diff --git a/src/dft_one_e/effective_pot.irp.f b/src/dft_one_e/effective_pot.irp.f index e680cb72..c1d39ce9 100644 --- a/src/dft_one_e/effective_pot.irp.f +++ b/src/dft_one_e/effective_pot.irp.f @@ -30,6 +30,16 @@ enddo END_PROVIDER + BEGIN_PROVIDER [double precision, ref_vhxc] + implicit none + integer :: i + do i = 1, elec_beta_num + ref_vhxc += effective_one_e_potential(i,i,1)*2.d0 + enddo + do i = elec_beta_num+1, elec_beta_num + ref_vhxc += effective_one_e_potential(i,i,1)*1.d0 + enddo + END_PROVIDER BEGIN_PROVIDER [double precision, effective_one_e_potential_sa, (mo_num, mo_num)] &BEGIN_PROVIDER [double precision, effective_one_e_potential_without_kin_sa, (mo_num, mo_num)] diff --git a/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f b/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f index 17972a79..7b5ee1b5 100644 --- a/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f +++ b/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f @@ -18,86 +18,6 @@ ao_two_e_integral_alpha = 0.d0 ao_two_e_integral_beta = 0.d0 - if (do_direct_integrals) then - - !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,j,l,k1,k,integral,ii,jj,kk,ll,i8,keys,values,p,q,r,s,i0,j0,k0,l0, & - !$OMP ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp, c0, c1, c2, & - !$OMP local_threshold)& - !$OMP SHARED(ao_num,SCF_density_matrix_ao_alpha,SCF_density_matrix_ao_beta,& - !$OMP ao_integrals_map,ao_integrals_threshold, ao_two_e_integral_schwartz, & - !$OMP ao_two_e_integral_alpha, ao_two_e_integral_beta) - - allocate(keys(1), values(1)) - allocate(ao_two_e_integral_alpha_tmp(ao_num,ao_num), & - ao_two_e_integral_beta_tmp(ao_num,ao_num)) - ao_two_e_integral_alpha_tmp = 0.d0 - ao_two_e_integral_beta_tmp = 0.d0 - - q = ao_num*ao_num*ao_num*ao_num - !$OMP DO SCHEDULE(dynamic) - do p=1_8,q - call two_e_integrals_index_reverse(kk,ii,ll,jj,p) - if ( (kk(1)>ao_num).or. & - (ii(1)>ao_num).or. & - (jj(1)>ao_num).or. & - (ll(1)>ao_num) ) then - cycle - endif - k = kk(1) - i = ii(1) - l = ll(1) - j = jj(1) - - logical, external :: ao_two_e_integral_zero - if (ao_two_e_integral_zero(i,k,j,l)) then - cycle - endif - local_threshold = ao_two_e_integral_schwartz(k,l)*ao_two_e_integral_schwartz(i,j) - if (local_threshold < ao_integrals_threshold) then - cycle - endif - i0 = i - j0 = j - k0 = k - l0 = l - values(1) = 0.d0 - local_threshold = ao_integrals_threshold/local_threshold - do k2=1,8 - if (kk(k2)==0) then - cycle - endif - i = ii(k2) - j = jj(k2) - k = kk(k2) - l = ll(k2) - c0 = SCF_density_matrix_ao_alpha(k,l)+SCF_density_matrix_ao_beta(k,l) - c1 = SCF_density_matrix_ao_alpha(k,i) - c2 = SCF_density_matrix_ao_beta(k,i) - if ( dabs(c0)+dabs(c1)+dabs(c2) < local_threshold) then - cycle - endif - if (values(1) == 0.d0) then - values(1) = ao_two_e_integral(k0,l0,i0,j0) - endif - integral = c0 * values(1) - ao_two_e_integral_alpha_tmp(i,j) += integral - ao_two_e_integral_beta_tmp (i,j) += integral - integral = values(1) - ao_two_e_integral_alpha_tmp(l,j) -= c1 * integral - ao_two_e_integral_beta_tmp (l,j) -= c2 * integral - enddo - enddo - !$OMP END DO NOWAIT - !$OMP CRITICAL - ao_two_e_integral_alpha += ao_two_e_integral_alpha_tmp - !$OMP END CRITICAL - !$OMP CRITICAL - ao_two_e_integral_beta += ao_two_e_integral_beta_tmp - !$OMP END CRITICAL - deallocate(keys,values,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp) - !$OMP END PARALLEL - else PROVIDE ao_two_e_integrals_in_map PROVIDE ao_two_e_integrals_erf_in_map @@ -201,7 +121,6 @@ deallocate(keys_erf,values_erf) !$OMP END PARALLEL - endif END_PROVIDER From c9de28b90340c409ffe1f46738dca77ca06143bc Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 11 Apr 2025 11:18:42 +0200 Subject: [PATCH 130/175] fixed bug in Cholesky when too small basis are used --- src/ao_two_e_ints/cholesky.irp.f | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ao_two_e_ints/cholesky.irp.f b/src/ao_two_e_ints/cholesky.irp.f index 36061ef0..5c83cec6 100644 --- a/src/ao_two_e_ints/cholesky.irp.f +++ b/src/ao_two_e_ints/cholesky.irp.f @@ -305,7 +305,7 @@ double precision function get_ao_integ_chol(i,j,k,l) Qmax = max(Qmax, D(Dset(q))) enddo - if (Qmax <= Dmin) exit + if (Qmax < Dmin) exit ! g. @@ -313,7 +313,7 @@ double precision function get_ao_integ_chol(i,j,k,l) do j=1,nq - if ( (Qmax <= Dmin).or.(N+j*1_8 > ndim8) ) exit + if ( (Qmax < Dmin).or.(N+j*1_8 > ndim8) ) exit ! i. rank = N+j From 17e401eed968e429cc1efc2fbb2f39713195ea8c Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 11 Apr 2025 18:32:40 +0200 Subject: [PATCH 131/175] fixed 3-body jastrow for qmckl --- plugins/local/non_h_ints_mu/jast_deriv.irp.f | 47 ++++++++++--------- .../non_h_ints_mu/jast_deriv_utils_vect.irp.f | 2 +- plugins/local/non_h_ints_mu/qmckl.irp.f | 5 ++ plugins/local/non_h_ints_mu/tc_integ.irp.f | 16 +++---- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/plugins/local/non_h_ints_mu/jast_deriv.irp.f b/plugins/local/non_h_ints_mu/jast_deriv.irp.f index 1f97c18a..54b2cbd2 100644 --- a/plugins/local/non_h_ints_mu/jast_deriv.irp.f +++ b/plugins/local/non_h_ints_mu/jast_deriv.irp.f @@ -117,9 +117,12 @@ integer*8 :: n_points, n_points_max, k integer :: ipoint_block, ipoint_end - + integer :: block_size + ! TODO block_size in the EZFIO + block_size = 10 n_points_max = n_points_extra_final_grid * n_points_final_grid - n_points = 100_8*n_points_extra_final_grid + n_points = block_size*n_points_extra_final_grid +! n_points = n_points_max double precision, allocatable :: rij(:,:,:) allocate( rij(3, 2, n_points) ) @@ -131,9 +134,10 @@ allocate( gl(2,4,n_points) ) - do ipoint_block = 1, n_points_final_grid, 100 ! r1 - ipoint_end = min(n_points_final_grid, ipoint_block+99) + do ipoint_block = 1, n_points_final_grid, block_size ! r1 + ipoint_end = min(n_points_final_grid, ipoint_block+block_size-1) + integer*8 :: n_points_local k=0 do ipoint = ipoint_block, ipoint_end do jpoint = 1, n_points_extra_final_grid ! r2 @@ -142,8 +146,9 @@ rij(1:3, 2, k) = final_grid_points_extra(1:3, jpoint) end do enddo + n_points_local = k - rc = qmckl_set_electron_coord(qmckl_ctx_jastrow, 'N', n_points, rij, n_points*6_8) + rc = qmckl_set_electron_coord(qmckl_ctx_jastrow, 'N', n_points_local, rij, n_points*6_8) if (rc /= QMCKL_SUCCESS) then print *, irp_here, 'qmckl error in set_electron_coord' rc = qmckl_check(qmckl_ctx_jastrow, rc) @@ -173,22 +178,22 @@ ! --- ! e-e-n term -! rc = qmckl_get_jastrow_champ_factor_een_gl(qmckl_ctx_jastrow, gl, 8_8*n_points) -! if (rc /= QMCKL_SUCCESS) then -! print *, irp_here, 'qmckl error in fact_een_gl' -! rc = qmckl_check(qmckl_ctx_jastrow, rc) -! stop -1 -! endif -! -! k=0 -! do ipoint = 1, n_points_final_grid ! r1 -! do jpoint = 1, n_points_extra_final_grid ! r2 -! k=k+1 -! grad1_u12_num(jpoint,ipoint,1) = grad1_u12_num(jpoint,ipoint,1) + gl(1,1,k) -! grad1_u12_num(jpoint,ipoint,2) = grad1_u12_num(jpoint,ipoint,2) + gl(1,2,k) -! grad1_u12_num(jpoint,ipoint,3) = grad1_u12_num(jpoint,ipoint,3) + gl(1,3,k) -! enddo -! enddo + rc = qmckl_get_jastrow_champ_factor_een_gl(qmckl_ctx_jastrow, gl, 8_8*n_points) + if (rc /= QMCKL_SUCCESS) then + print *, irp_here, 'qmckl error in fact_een_gl' + rc = qmckl_check(qmckl_ctx_jastrow, rc) + stop -1 + endif + + k=0 + do ipoint = ipoint_block, ipoint_end + do jpoint = 1, n_points_extra_final_grid ! r2 + k=k+1 + grad1_u12_num(jpoint,ipoint,1) = grad1_u12_num(jpoint,ipoint,1) + gl(1,1,k) + grad1_u12_num(jpoint,ipoint,2) = grad1_u12_num(jpoint,ipoint,2) + gl(1,2,k) + grad1_u12_num(jpoint,ipoint,3) = grad1_u12_num(jpoint,ipoint,3) + gl(1,3,k) + enddo + enddo ! --- ! e-n term 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 d951db93..58ca60fb 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 @@ -814,7 +814,7 @@ subroutine get_grad1_u12_2e_r1_seq(ipoint, n_grid2, resx, resy, resz) else - print *, ' Error in get_grad1_u12_withsq_r1_seq: Unknown Jastrow' + print *, ' Error in get_grad1_u12_2e_r1_seq: Unknown Jastrow' stop endif ! j2e_type diff --git a/plugins/local/non_h_ints_mu/qmckl.irp.f b/plugins/local/non_h_ints_mu/qmckl.irp.f index de440f14..48eee7b9 100644 --- a/plugins/local/non_h_ints_mu/qmckl.irp.f +++ b/plugins/local/non_h_ints_mu/qmckl.irp.f @@ -73,6 +73,11 @@ rc = qmckl_check(qmckl_ctx_jastrow, rc) if (rc /= QMCKL_SUCCESS) stop -1 endif +! print*,'jast_qmckl_cord_num = ',jast_qmckl_cord_num +! integer :: i +! do i = 1, jast_qmckl_c_vector_size +! print*,jast_qmckl_c_vector(i) +! enddo END_PROVIDER 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 ab88dd41..02ed34f1 100644 --- a/plugins/local/non_h_ints_mu/tc_integ.irp.f +++ b/plugins/local/non_h_ints_mu/tc_integ.irp.f @@ -125,10 +125,10 @@ else ! TODO combine 1shot & int2_grad1_u12_ao_num - PROVIDE int2_grad1_u12_ao_num - int2_grad1_u12_ao = int2_grad1_u12_ao_num -! PROVIDE int2_grad1_u12_ao_num_1shot -! int2_grad1_u12_ao = int2_grad1_u12_ao_num_1shot +! PROVIDE int2_grad1_u12_ao_num +! int2_grad1_u12_ao = int2_grad1_u12_ao_num + PROVIDE int2_grad1_u12_ao_num_1shot + int2_grad1_u12_ao = int2_grad1_u12_ao_num_1shot endif elseif(tc_integ_type .eq. "semi-analytic") then @@ -332,10 +332,10 @@ else ! TODO combine 1shot & int2_grad1_u12_square_ao_num - PROVIDE int2_grad1_u12_square_ao_num - int2_grad1_u12_square_ao = int2_grad1_u12_square_ao_num - !PROVIDE int2_grad1_u12_square_ao_num_1shot - !int2_grad1_u12_square_ao = int2_grad1_u12_square_ao_num_1shot +! PROVIDE int2_grad1_u12_square_ao_num +! int2_grad1_u12_square_ao = int2_grad1_u12_square_ao_num + PROVIDE int2_grad1_u12_square_ao_num_1shot + int2_grad1_u12_square_ao = int2_grad1_u12_square_ao_num_1shot endif elseif(tc_integ_type .eq. "semi-analytic") then From ae3ca6d50e747c4f68acc8180644d2d225006fc3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 11 Apr 2025 19:00:08 +0200 Subject: [PATCH 132/175] Added save_energy to casscf --- external/irpf90 | 2 +- scripts/import_champ_jastrow.py | 0 src/casscf_cipsi/casscf.irp.f | 27 +++++++++------------ src/determinants/spindeterminants.irp.f | 4 +-- src/mo_optimization_utils/save_energy.irp.f | 9 ------- 5 files changed, 15 insertions(+), 27 deletions(-) mode change 100644 => 100755 scripts/import_champ_jastrow.py delete mode 100644 src/mo_optimization_utils/save_energy.irp.f diff --git a/external/irpf90 b/external/irpf90 index 4ab1b175..43160c60 160000 --- a/external/irpf90 +++ b/external/irpf90 @@ -1 +1 @@ -Subproject commit 4ab1b175fc7ed0d96c1912f13dc53579b24157a6 +Subproject commit 43160c60d88d9f61fb97cc0b35477c8eb0df862b diff --git a/scripts/import_champ_jastrow.py b/scripts/import_champ_jastrow.py old mode 100644 new mode 100755 diff --git a/src/casscf_cipsi/casscf.irp.f b/src/casscf_cipsi/casscf.irp.f index b64a9d8f..99a27b36 100644 --- a/src/casscf_cipsi/casscf.irp.f +++ b/src/casscf_cipsi/casscf.irp.f @@ -14,7 +14,7 @@ program casscf thresh_scf = max(1.d-4,thresh_scf) pt2_relative_error = 0.04 endif - touch pt2_relative_error + touch pt2_relative_error call run end @@ -56,7 +56,7 @@ subroutine run energy_old = energy energy = eone+etwo+ecore pt2_max_before = pt2_max - + call write_time(6) call write_int(6,iteration,'CAS-SCF iteration = ') call write_double(6,energy,'State-average CAS-SCF energy = ') @@ -66,7 +66,7 @@ subroutine run double precision :: delta_E_istate, e_av e_av = 0.d0 do istate=1,N_states - e_av += state_average_weight(istate) * Ev(istate) + e_av += state_average_weight(istate) * Ev(istate) if(istate.gt.1)then delta_E_istate = E_PT2(istate) - E_PT2(1) write(*,'(A6,I2,A18,F16.10)')'state ',istate,' Delta E+PT2 = ',delta_E_istate @@ -79,7 +79,7 @@ subroutine run call write_double(6,e_av,'State-average CAS-SCF energy bis = ') call write_double(6,pt2_max,' PT2_MAX = ') !! endif - + print*,'' call write_double(6,norm_grad_vec2,'Norm of gradients = ') call write_double(6,norm_grad_vec2_tab(1), ' Core-active gradients = ') @@ -87,7 +87,7 @@ subroutine run call write_double(6,norm_grad_vec2_tab(3), ' Active-virtual gradients = ') print*,'' call write_double(6,energy_improvement, 'Predicted energy improvement = ') - + if(criterion_casscf == "energy")then converged = dabs(energy_improvement) < thresh_scf else if (criterion_casscf == "gradients")then @@ -111,11 +111,12 @@ subroutine run endif print*,'' call write_double(6,pt2_max, 'PT2_MAX for next iteration = ') - + mo_coef = NewOrbs mo_occ = occnum if(.not.converged)then call save_mos + call save_energy(Ev,E_PT2) iteration += 1 if(norm_grad_vec2.gt.0.01d0)then N_det = N_states @@ -129,7 +130,7 @@ subroutine run SOFT_TOUCH mo_coef N_det psi_det psi_coef if(.not.small_active_space)then if(adaptive_pt2_max)then - SOFT_TOUCH pt2_max + SOFT_TOUCH pt2_max endif endif if(iteration .gt. 3)then @@ -138,15 +139,16 @@ subroutine run endif endif endif - + enddo + call save_energy(Ev,E_PT2) if(.True.)then integer :: i print*,'Converged CASSCF ' print*,'--------------------------' - write(6,*) ' occupation numbers of orbitals ' + write(6,*) ' Occupation numbers of orbitals Fock matrix diagonal' do i=1,mo_num - write(6,*) i,occnum(i) + write(6,*) i,occnum(i),mcscf_fock_diag_mo(i) end do print*,'--------------' ! @@ -154,11 +156,6 @@ subroutine run ! write(6,*) ' the diagonal of the inactive effective Fock matrix ' ! write(6,'(5(i3,F12.5))') (i,Fipq(i,i),i=1,mo_num) ! write(6,*) - print*,'Fock MCSCF' - do i = 1, mo_num - write(*,*)i,mcscf_fock_diag_mo(i) -! write(*,*)mcscf_fock_alpha_mo(i,i) - enddo endif diff --git a/src/determinants/spindeterminants.irp.f b/src/determinants/spindeterminants.irp.f index b087ec24..7d46468d 100644 --- a/src/determinants/spindeterminants.irp.f +++ b/src/determinants/spindeterminants.irp.f @@ -14,9 +14,9 @@ integer*8 function spin_det_search_key(det,Nint) END_DOC integer, intent(in) :: Nint integer(bit_kind), intent(in) :: det(Nint) - integer(bit_kind), parameter :: unsigned_shift = 1_bit_kind-huge(1_bit_kind) ! 100...00 + integer(bit_kind), parameter :: unsigned_shift = 0_bit_kind ! 1_bit_kind-huge(1_bit_kind) ! 100...00 integer :: i - spin_det_search_key = det(1)+unsigned_shift + spin_det_search_key = det(1) !+unsigned_shift do i=2,Nint spin_det_search_key = ieor(spin_det_search_key,det(i)) enddo diff --git a/src/mo_optimization_utils/save_energy.irp.f b/src/mo_optimization_utils/save_energy.irp.f deleted file mode 100644 index 5dac8da9..00000000 --- a/src/mo_optimization_utils/save_energy.irp.f +++ /dev/null @@ -1,9 +0,0 @@ -subroutine save_energy(E,pt2) - implicit none - BEGIN_DOC -! Saves the energy in |EZFIO|. - END_DOC - double precision, intent(in) :: E(N_states), pt2(N_states) - call ezfio_set_fci_energy(E(1:N_states)) - call ezfio_set_fci_energy_pt2(E(1:N_states)+pt2(1:N_states)) -end From 745adbcf3144d2bbeb371b3952bf0da777413c75 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 12 Apr 2025 11:34:35 +0200 Subject: [PATCH 133/175] no debug_ or test_ prefix in qp programs --- ocaml/qp_run.ml | 9 ++++++++- plugins/local/slater_tc_no_opt/test_tc_bi_ortho.irp.f | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ocaml/qp_run.ml b/ocaml/qp_run.ml index bb886143..8d5e74cf 100644 --- a/ocaml/qp_run.ml +++ b/ocaml/qp_run.ml @@ -9,6 +9,8 @@ open Qputils let print_list () = Lazy.force Qpackage.executables + |> List.filter (fun (x,_) -> not (String.starts_with ~prefix:"debug_" x)) + |> List.filter (fun (x,_) -> not (String.starts_with ~prefix:"test_" x)) |> List.iter (fun (x,_) -> Printf.printf " * %s\n" x) let () = @@ -62,7 +64,10 @@ let run slave ?prefix exe ezfio_file = if (not (List.exists (fun (x,_) -> x = exe) executables)) then begin Printf.printf "\nPossible choices:\n"; - List.iter (fun (x,_) -> Printf.printf "* %s\n%!" x) executables; + executables + |> List.filter (fun (x,_) -> not (String.starts_with ~prefix:"debug_" x)) + |> List.filter (fun (x,_) -> not (String.starts_with ~prefix:"test_" x)) + |> List.iter (fun (x,_) -> Printf.printf "* %s\n%!" x); failwith ("Executable "^exe^" not found") end; @@ -171,6 +176,8 @@ let () = set_header_doc (Sys.argv.(0) ^ " - Quantum Package command"); "Executes a Quantum Package binary file among these:\n\n" ^ (Lazy.force Qpackage.executables + |> List.filter (fun (x,_) -> not (String.starts_with ~prefix:"debug_" x)) + |> List.filter (fun (x,_) -> not (String.starts_with ~prefix:"test_" x)) |> List.map (fun (x,_) -> Printf.sprintf " * %s" x ) |> String.concat "\n") |> set_description_doc; diff --git a/plugins/local/slater_tc_no_opt/test_tc_bi_ortho.irp.f b/plugins/local/slater_tc_no_opt/test_tc_bi_ortho.irp.f index 559c0200..c902a5c7 100644 --- a/plugins/local/slater_tc_no_opt/test_tc_bi_ortho.irp.f +++ b/plugins/local/slater_tc_no_opt/test_tc_bi_ortho.irp.f @@ -1,7 +1,7 @@ ! --- -program tc_bi_ortho +subroutine test_tc_bi_ortho BEGIN_DOC ! TODO : Put the documentation of the program here From 6c1b5cb7702b6ce722c3871b5038eb2be9280bf4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 12 Apr 2025 11:35:49 +0200 Subject: [PATCH 134/175] Added save_energy in mo_optimization --- src/mo_optimization/save_energy.irp.f | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/mo_optimization/save_energy.irp.f diff --git a/src/mo_optimization/save_energy.irp.f b/src/mo_optimization/save_energy.irp.f new file mode 100644 index 00000000..5dac8da9 --- /dev/null +++ b/src/mo_optimization/save_energy.irp.f @@ -0,0 +1,9 @@ +subroutine save_energy(E,pt2) + implicit none + BEGIN_DOC +! Saves the energy in |EZFIO|. + END_DOC + double precision, intent(in) :: E(N_states), pt2(N_states) + call ezfio_set_fci_energy(E(1:N_states)) + call ezfio_set_fci_energy_pt2(E(1:N_states)+pt2(1:N_states)) +end From 0bcbdb44c5108c30a82cecb2d437f0273dcaa60c Mon Sep 17 00:00:00 2001 From: eginer Date: Tue, 15 Apr 2025 15:43:22 +0200 Subject: [PATCH 135/175] minor modif in ao_spherical and ao_ortho_canonical --- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 42 +------ src/ao_one_e_ints/ao_spherical.irp.f | 130 +++++++++++++++++++++ 2 files changed, 131 insertions(+), 41 deletions(-) create mode 100644 src/ao_one_e_ints/ao_spherical.irp.f 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..654633b3 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -1,5 +1,4 @@ - BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_num)] -&BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_normalization, (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 @@ -12,39 +11,23 @@ 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;; @@ -62,35 +45,12 @@ 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 - ! T^T . S . T - END_DOC - double precision, allocatable :: S(:,:) - allocate (S(ao_sphe_num,ao_num)) - - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & - ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), & - ao_overlap,size(ao_overlap,1), 0.d0, & - S, size(S,1)) - - call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & - S, size(S,1), & - ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), 0.d0, & - ao_cart_to_sphe_overlap,size(ao_cart_to_sphe_overlap,1)) - - deallocate(S) - -END_PROVIDER - BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_sphe_num,ao_num) ] implicit none BEGIN_DOC diff --git a/src/ao_one_e_ints/ao_spherical.irp.f b/src/ao_one_e_ints/ao_spherical.irp.f new file mode 100644 index 00000000..30110e14 --- /dev/null +++ b/src/ao_one_e_ints/ao_spherical.irp.f @@ -0,0 +1,130 @@ +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_sphe_num)] + implicit none + BEGIN_DOC + ! Coefficients to go from current cartesian AO basis set to spherical AO basis set + ! + ! ao_cart_to_sphe_coef(i,j) = coefficient of the i-th cartesian |AO| on the j-th spherical |AO| + ! + ! :math:`\chi^s_{\nu} = \sum_{\nu}^{N_{\text{cart}}} B^{sc}_{\mu\nu} \chi^c_{\mu}` + ! + ! where :math:`\chi^s_{\nu}` is an element of the spherical AO basis, + ! :math:`\chi^c_{\mu}` is an element of the cartesian AO basis, + ! and :math:`B^{sc}_{\mu\nu}` is an change of basis matrix + END_DOC + integer :: row,col,k,j + ! + ao_cart_to_sphe_coef(:,:) = 0.d0 + row = 1 + col = 1 + do while (row <= ao_num) + ! Select case based on azimuthal quantum number of i-th AO orbitals + select case ( ao_l(row) ) + case (0) + ! S orbital + ao_cart_to_sphe_coef(row,col) = 1.d0 + row += 1 + col += 1 + BEGIN_TEMPLATE + case ($SHELL) + ! P,D,F,... orbitals + do k=1,size(cart_to_sphe_$SHELL,2) + do j=1,size(cart_to_sphe_$SHELL,1) + ao_cart_to_sphe_coef(row+j-1,col+k-1) = cart_to_sphe_$SHELL(j,k) + enddo + enddo + row += size(cart_to_sphe_$SHELL,1) + col += size(cart_to_sphe_$SHELL,2) + 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 +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef_transp, (ao_sphe_num,ao_num)] + implicit none + BEGIN_DOC + ! Transpose of :c:data:`ao_cart_to_sphe_coef` + END_DOC + integer :: i,j + do i = 1, ao_num + do j = 1, ao_sphe_num + ao_cart_to_sphe_coef_transp(j,i) = ao_cart_to_sphe_coef(i,j) + enddo + enddo +END_PROVIDER + + +subroutine ao_cart_to_ao_sphe(A_ao_cart,LDA_ao_cart,A_ao_sphe,LDA_ao_sphe) + implicit none + BEGIN_DOC + ! Transform matrix A from the |AO| cartesian basis to the |AO| spherical basis + ! + ! :math:`(B^{sc})^T.A^c.B^{sc}` + ! + ! where :math:`B^{sc}` is :c:data:`ao_cart_to_sphe_coef`, + ! the matrix of coefficients from the cartesian AO basis to spherical one, + ! and :math:`B^{sc}` is :c:data:`ao_cart_to_sphe_coef_transp`, its transpose. + END_DOC + integer, intent(in) :: LDA_ao_cart,LDA_ao_sphe + double precision, intent(in) :: A_ao_cart(LDA_ao_cart,ao_num) + double precision, intent(out) :: A_ao_sphe(LDA_ao_sphe,ao_sphe_num) + double precision, allocatable :: T(:,:) + ! + allocate (T(ao_num,ao_sphe_num) ) + !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: T + + call dgemm('N','N', ao_num, ao_sphe_num, ao_num, & + 1.d0, A_ao_cart, LDA_ao_cart, & + ao_cart_to_sphe_coef, size(ao_cart_to_sphe_coef,1), & + 0.d0, T, size(T,1)) + ! Notice that for the following dgemm we could have used + ! ao_cart_to_sphe_coef_transp, but instead we transposed with the 'T' argument + call dgemm('T','N', ao_sphe_num, ao_sphe_num, ao_num, & + 1.d0, ao_cart_to_sphe_coef, size(ao_cart_to_sphe_coef,1), & + T, ao_num, & + 0.d0, A_ao_sphe, size(A_ao_sphe,1)) + ! + ! call restore_symmetry(mo_num,mo_num,A_ao_sphe,size(A_ao_sphe,1),1.d-15) + deallocate(T) +end + + +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! |AO| overlap matrix in the spherical basis set obtained as + ! + ! :math:`(B^{sc})^T.S^c.B^{sc}` + ! + ! where :math:`S^c` is the overlap matrix in the cartesian AO basis + END_DOC + ! + call ao_cart_to_ao_sphe(ao_overlap,ao_num,ao_cart_to_sphe_overlap,ao_sphe_num) + ! +END_PROVIDER + + +BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_overlap_inv, (ao_sphe_num,ao_sphe_num) ] + implicit none + BEGIN_DOC + ! Inverse of :c:data:`ao_cart_to_sphe_overlap` + END_DOC + ! + call get_pseudo_inverse( & + ao_cart_to_sphe_overlap, size(ao_cart_to_sphe_overlap,1), & + ao_sphe_num,ao_sphe_num, & + ao_cart_to_sphe_overlap_inv, size(ao_cart_to_sphe_overlap_inv,1), & + lin_dep_cutoff) +END_PROVIDER From 5f1ab387cbdcce371aea3deb011734382086c306 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 16 Apr 2025 11:21:10 +0200 Subject: [PATCH 136/175] added the identity matrix in ao_one_e_ints/ao_spherical.irp.f --- src/ao_one_e_ints/ao_spherical.irp.f | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ao_one_e_ints/ao_spherical.irp.f b/src/ao_one_e_ints/ao_spherical.irp.f index 30110e14..b82b8f33 100644 --- a/src/ao_one_e_ints/ao_spherical.irp.f +++ b/src/ao_one_e_ints/ao_spherical.irp.f @@ -13,6 +13,13 @@ END_DOC integer :: row,col,k,j ! + if (ao_cartesian) then + ! Identity matrix + integer :: i + do i=1,ao_sphe_num + ao_cart_to_sphe_coef(i,i) = 1.d0 + enddo + else ao_cart_to_sphe_coef(:,:) = 0.d0 row = 1 col = 1 @@ -49,6 +56,7 @@ stop 'Error in ao_cart_to_sphe : angular momentum too high' end select enddo + endif END_PROVIDER From 340c63adab5c526b9407c5427af1dc65789e8d62 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Apr 2025 11:01:41 +0200 Subject: [PATCH 137/175] 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 @@ 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 @@ def import_jastrow(jastrow_filename): 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 @@ + 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 From 9c60881004779e98019ee7f2f7d515dddbee7bcc Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 22 Apr 2025 16:53:54 +0200 Subject: [PATCH 138/175] Improve gfortran_mkl --- config/gfortran_mkl.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/gfortran_mkl.cfg b/config/gfortran_mkl.cfg index f2787d63..626fa834 100644 --- a/config/gfortran_mkl.cfg +++ b/config/gfortran_mkl.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -ffree-line-length-none -I . -mavx -g -fPIC -std=legacy +FC : gfortran -ffree-line-length-none -I . -march=native -g -fPIC -std=legacy -ftree-vectorize LAPACK_LIB : -I${MKLROOT}/include -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_core -lpthread -lm -ldl -lmkl_gnu_thread -lgomp -fopenmp IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED From fdd8759c91efd397725acab5eec18dba9bedf4db Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 22 Apr 2025 16:58:24 +0200 Subject: [PATCH 139/175] Fix spin-independent in qmckl --- plugins/local/non_h_ints_mu/qmckl.irp.f | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/local/non_h_ints_mu/qmckl.irp.f b/plugins/local/non_h_ints_mu/qmckl.irp.f index 6b5f80b4..c72665bf 100644 --- a/plugins/local/non_h_ints_mu/qmckl.irp.f +++ b/plugins/local/non_h_ints_mu/qmckl.irp.f @@ -6,13 +6,19 @@ ! Context for the QMCKL library END_DOC integer(qmckl_exit_code) :: rc + integer :: i qmckl_ctx_jastrow = qmckl_context_create() 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) + if (jast_qmckl_spin_independent) then + i = 1 + else + i = 0 + endif + rc = qmckl_set_jastrow_champ_spin_independent(qmckl_ctx_jastrow, i) rc = qmckl_check(qmckl_ctx_jastrow, rc) if (rc /= QMCKL_SUCCESS) stop -1 From 26e1b3a1c4e63e00f28e616766d307232de7ecf1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 Apr 2025 15:21:23 +0200 Subject: [PATCH 140/175] Added mu_of_r_projector_ao_prod --- .../basis_correction/weak_corr_func.irp.f | 31 +--- src/ao_basis/basis_prod.irp.f | 160 ++++++++++++++++++ src/ao_one_e_ints/ao_ortho_canonical.irp.f | 22 --- src/ao_one_e_ints/ao_spherical.irp.f | 62 ------- src/mu_of_r/mu_of_r_conditions.irp.f | 47 ++++- 5 files changed, 206 insertions(+), 116 deletions(-) create mode 100644 src/ao_basis/basis_prod.irp.f diff --git a/plugins/local/basis_correction/weak_corr_func.irp.f b/plugins/local/basis_correction/weak_corr_func.irp.f index 99ea504b..cd88cace 100644 --- a/plugins/local/basis_correction/weak_corr_func.irp.f +++ b/plugins/local/basis_correction/weak_corr_func.irp.f @@ -16,33 +16,7 @@ ecmd_lda_mu_of_r = 0.d0 call wall_time(wall0) - if (mu_of_r_potential.EQ."proj_DUMMY")then - do istate = 1, N_states - do ipoint = 1, n_points_final_grid - ! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018) - mu = mu_of_r_prov(ipoint,istate) - weight = final_weight_at_r_vector(ipoint) - rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) - rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate) - rho = rho_a + rho_b -! p2 = rho_a*rho_b -! We take the on-top pair density of the UEG which is (1-zeta^2) rhoc^2 g0 = 4 rhoa * rhob * g0 - p2 = 4.d0 * rho_a * rho_b * g0_UEG_mu_inf(rho_a,rho_b) - rho_a = 0.5d0*(rho + dsqrt(rho*rho - 4.d0*p2)) - rho_b = 0.5d0*(rho - dsqrt(rho*rho - 4.d0*p2)) -! rho_a = 0.5d0*rho -! rho_b = 0.5d0*rho - ! Ecmd within the LDA approximation of PRB 73, 155111 (2006) - call ESRC_MD_LDAERF (mu,rho_a,rho_b,dospin,ec) - if(isnan(ec))then - print*,'ec is nan' - stop - endif - ecmd_lda_mu_of_r(istate) += weight * ec - enddo - enddo - else - do istate = 1, N_states + do istate = 1, N_states do ipoint = 1, n_points_final_grid ! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018) mu = mu_of_r_prov(ipoint,istate) @@ -57,8 +31,7 @@ endif ecmd_lda_mu_of_r(istate) += weight * ec enddo - enddo - endif + enddo call wall_time(wall1) print*,'Time for ecmd_lda_mu_of_r :',wall1-wall0 END_PROVIDER diff --git a/src/ao_basis/basis_prod.irp.f b/src/ao_basis/basis_prod.irp.f new file mode 100644 index 00000000..7326c7b2 --- /dev/null +++ b/src/ao_basis/basis_prod.irp.f @@ -0,0 +1,160 @@ +BEGIN_PROVIDER [ integer, basis_prod_num ] + implicit none + BEGIN_DOC + ! Maximum number of basis functions for the projector + END_DOC + basis_prod_num = ao_num * (ao_num+1) / 2 +END_PROVIDER + +BEGIN_PROVIDER [ integer, basis_prod_idx, (2,basis_prod_num) ] + implicit none + BEGIN_DOC + ! Indices of main basis to create projector basis + END_DOC + integer :: i,j,a + a=0 + do j=1,ao_num + do i=1,j + a = a+1 + basis_prod_idx(1,a) = i + basis_prod_idx(2,a) = j + enddo + enddo +END_PROVIDER + +double precision function general_overlap_integral(dim, & + P_new,P_center,fact_p,p,p_inv,iorder_p, & + Q_new,Q_center,fact_q,q,q_inv,iorder_q) + implicit none + BEGIN_DOC + ! Computes the overlap integral where p,q are products of primitives + END_DOC + integer,intent(in) :: dim + include 'utils/constants.include.F' + double precision, intent(in) :: P_new(0:max_dim,3),P_center(3),fact_p,p,p_inv + double precision, intent(in) :: Q_new(0:max_dim,3),Q_center(3),fact_q,q,q_inv + integer, intent(in) :: iorder_p(3) + integer, intent(in) :: iorder_q(3) + + double precision :: overlap, tmp + double precision, external :: overlap_gaussian_x + integer :: i,j,k + + general_overlap_integral = 1.d0 + do k=1,3 + tmp = 0.d0 + do i=0,iorder_p(k) + do j=0,iorder_q(k) + tmp += P_new(i,k)* Q_new(j,k) * overlap_gaussian_x(P_center(k), Q_center(k), p, q, i, j, dim) + enddo + enddo + general_overlap_integral *= tmp + if (tmp == 0.d0) exit + enddo + general_overlap_integral *= fact_p * fact_q +end function general_overlap_integral + +double precision function basis_prod_overlap_func(a,b) + implicit none + BEGIN_DOC + ! Overlap matrix element of the basis of products + END_DOC + include 'constants.include.F' + + integer, intent(in) :: a,b + double precision, external :: general_overlap_integral + double precision, external :: ao_two_e_integral_general + + integer :: i,j,k,l + i = basis_prod_idx(1,a) + k = basis_prod_idx(2,a) + j = basis_prod_idx(1,b) + l = basis_prod_idx(2,b) + basis_prod_overlap_func = ao_two_e_integral_general(i,j,k,l,general_overlap_integral) + +end function basis_prod_overlap_func + + BEGIN_PROVIDER [ double precision, basis_prod_overlap, (basis_prod_num, basis_prod_num) ] +&BEGIN_PROVIDER [ double precision, basis_prod_overlap_inv, (basis_prod_num, basis_prod_num) ] + implicit none + BEGIN_DOC + ! Overlap matrix of the basis of products + END_DOC + integer :: a,b + double precision, external :: basis_prod_overlap_func + + !$OMP PARALLEL DO PRIVATE(a,b) SCHEDULE(guided) + do a=1,basis_prod_num + do b=1,a + basis_prod_overlap(a,b) = basis_prod_overlap_func(a,b) + basis_prod_overlap(b,a) = basis_prod_overlap(a,b) + enddo + print *, a, '/', basis_prod_num + enddo + !$OMP END PARALLEL DO + + ! Eliminate linear dependencies + + double precision, allocatable :: U(:,:), D(:), Vt(:,:) + allocate(U(basis_prod_num,basis_prod_num),Vt(basis_prod_num,basis_prod_num), D(basis_prod_num)) + +print *, 'svd' + call svd( & + basis_prod_overlap, size(basis_prod_overlap,1), & + U, size(U,1), D, & + Vt, size(Vt,1), & + basis_prod_num,basis_prod_num) + + double precision :: local_cutoff + integer :: i, j, k, mm + + local_cutoff = 1.d-10 + mm=basis_prod_num + do i=1,basis_prod_num + if ( D(i) < local_cutoff) then + mm = mm-1 + D(i) = 0.d0 + endif + do j=1,basis_prod_num + basis_prod_overlap(j,i) = 0.d0 + basis_prod_overlap_inv(j,i) = 0.d0 + enddo + enddo + + if (mm < basis_prod_num) then + print *, 'Removed Linear dependencies below ', local_cutoff + endif + +print *, 'gemm1' + double precision :: dk, dk_inv + double precision, allocatable :: U2(:,:) + allocate(U2(basis_prod_num,basis_prod_num)) + do k=1,basis_prod_num + dk = D(k) + do i=1,basis_prod_num + U2(i,k) = U(i,k)*dk + enddo + enddo + + call dgemm('N','N', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & + U2, basis_prod_num, Vt, basis_prod_num, 0.d0, basis_prod_overlap, basis_prod_num) + +print *, 'gemm2' + do k=1,basis_prod_num + if (D(k) == 0.d0) then + dk = 0.d0 + else + dk = 1.d0/D(k) + endif + do i=1,basis_prod_num + U2(i,k) = U(i,k)*dk + enddo + enddo + + call dgemm('N','N', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & + U2, basis_prod_num, Vt, basis_prod_num, 0.d0, basis_prod_overlap_inv, basis_prod_num) + + + deallocate(U,U2,D,Vt) +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 c61a848d..53a9cb44 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -1,25 +1,3 @@ -BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_overlap, (ao_sphe_num,ao_sphe_num) ] - implicit none - BEGIN_DOC - ! T^T . S . T - END_DOC - double precision, allocatable :: S(:,:) - allocate (S(ao_sphe_num,ao_num)) - - call dgemm('T','N',ao_sphe_num,ao_num,ao_num, 1.d0, & - ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), & - ao_overlap,size(ao_overlap,1), 0.d0, & - S, size(S,1)) - - call dgemm('N','N',ao_sphe_num,ao_sphe_num,ao_num, 1.d0, & - S, size(S,1), & - ao_cart_to_sphe_coef,size(ao_cart_to_sphe_coef,1), 0.d0, & - ao_cart_to_sphe_overlap,size(ao_cart_to_sphe_overlap,1)) - - deallocate(S) - -END_PROVIDER - BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_inv, (ao_sphe_num,ao_num) ] implicit none BEGIN_DOC diff --git a/src/ao_one_e_ints/ao_spherical.irp.f b/src/ao_one_e_ints/ao_spherical.irp.f index b82b8f33..20abce14 100644 --- a/src/ao_one_e_ints/ao_spherical.irp.f +++ b/src/ao_one_e_ints/ao_spherical.irp.f @@ -1,65 +1,3 @@ -BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef, (ao_num,ao_sphe_num)] - implicit none - BEGIN_DOC - ! Coefficients to go from current cartesian AO basis set to spherical AO basis set - ! - ! ao_cart_to_sphe_coef(i,j) = coefficient of the i-th cartesian |AO| on the j-th spherical |AO| - ! - ! :math:`\chi^s_{\nu} = \sum_{\nu}^{N_{\text{cart}}} B^{sc}_{\mu\nu} \chi^c_{\mu}` - ! - ! where :math:`\chi^s_{\nu}` is an element of the spherical AO basis, - ! :math:`\chi^c_{\mu}` is an element of the cartesian AO basis, - ! and :math:`B^{sc}_{\mu\nu}` is an change of basis matrix - END_DOC - integer :: row,col,k,j - ! - if (ao_cartesian) then - ! Identity matrix - integer :: i - do i=1,ao_sphe_num - ao_cart_to_sphe_coef(i,i) = 1.d0 - enddo - else - ao_cart_to_sphe_coef(:,:) = 0.d0 - row = 1 - col = 1 - do while (row <= ao_num) - ! Select case based on azimuthal quantum number of i-th AO orbitals - select case ( ao_l(row) ) - case (0) - ! S orbital - ao_cart_to_sphe_coef(row,col) = 1.d0 - row += 1 - col += 1 - BEGIN_TEMPLATE - case ($SHELL) - ! P,D,F,... orbitals - do k=1,size(cart_to_sphe_$SHELL,2) - do j=1,size(cart_to_sphe_$SHELL,1) - ao_cart_to_sphe_coef(row+j-1,col+k-1) = cart_to_sphe_$SHELL(j,k) - enddo - enddo - row += size(cart_to_sphe_$SHELL,1) - col += size(cart_to_sphe_$SHELL,2) - 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 -END_PROVIDER - - BEGIN_PROVIDER [ double precision, ao_cart_to_sphe_coef_transp, (ao_sphe_num,ao_num)] implicit none BEGIN_DOC diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index f0b81eb8..52c96442 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -40,7 +40,8 @@ enddo else if((mu_of_r_potential.EQ."proj").or.(mu_of_r_potential.EQ."proj_cas"))then do ipoint = 1, n_points_final_grid - mu_of_r_prov(ipoint,istate) = mu_of_r_projector_mo(ipoint) +! mu_of_r_prov(ipoint,istate) = mu_of_r_projector_mo(ipoint) + mu_of_r_prov(ipoint,istate) = mu_of_r_projector_ao_prod(ipoint) enddo else print*,'you requested the following mu_of_r_potential' @@ -293,9 +294,10 @@ do ipoint=1,n_points_final_grid ! epsilon - mu_of_r_projector_mo(ipoint) = 1.d0/(2.d0*dacos(-1.d0) * mu_of_r_projector_mo(ipoint)**(2.d0/3.d0)) +! mu_of_r_projector_mo(ipoint) = 1.d0/(2.d0*dacos(-1.d0) * mu_of_r_projector_mo(ipoint)**(2.d0/3.d0)) ! mu - mu_of_r_projector_mo(ipoint) = 1.d0/dsqrt( 2.d0*mu_of_r_projector_mo(ipoint) ) +! mu_of_r_projector_mo(ipoint) = 1.d0/dsqrt( 2.d0*mu_of_r_projector_mo(ipoint) ) + mu_of_r_projector_mo(ipoint) = mu_of_r_projector_mo(ipoint)**(1.d0/3.d0) * 2.199085233011538d0 enddo END_PROVIDER @@ -324,3 +326,42 @@ enddo END_PROVIDER + +BEGIN_PROVIDER [double precision, mu_of_r_projector_ao_prod, (n_points_final_grid) ] + implicit none + BEGIN_DOC + ! mu(r) computed with the projector onto the atomic basis + ! P_B(\mathbf{r},\mathbf{r}') = \sum_{ij} | + ! \chi_{i} \rangle \left[S^{-1}\right]_{ij} \langle \chi_{j} | + ! \] where $i$ and $j$ denote all atomic orbitals. + END_DOC + + integer :: ipoint + + !$OMP PARALLEL PRIVATE(ipoint,a,b,i,j,k,l,f1,f2) DEFAULT(SHARED) + !$OMP DO + do ipoint=1,n_points_final_grid + mu_of_r_projector_ao_prod(ipoint) = 0.d0 + integer :: i,j,k,l,a,b + double precision :: f1, f2 + do a=1,basis_prod_num + i = basis_prod_idx(1,a) + j = basis_prod_idx(2,a) + f1 = aos_in_r_array(i,ipoint) * aos_in_r_array(j,ipoint) + do b=1,basis_prod_num + k = basis_prod_idx(1,b) + l = basis_prod_idx(2,b) + f2 = aos_in_r_array(k,ipoint) * aos_in_r_array(l,ipoint) + mu_of_r_projector_ao_prod(ipoint) = mu_of_r_projector_ao_prod(ipoint) + & + f1*f2 * basis_prod_overlap_inv(a,b) + enddo + enddo + mu_of_r_projector_ao_prod(ipoint) = mu_of_r_projector_ao_prod(ipoint)**(1.d0/3.d0) * 2.199085233011538d0 + enddo + !$OMP END DO + !$OMP END PARALLEL + +END_PROVIDER + + + From 6494b25c342164fdf0a41ec7cbbcced2b854000e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 29 Apr 2025 11:37:29 +0200 Subject: [PATCH 141/175] Working on basis_correction --- src/ao_basis/basis_prod.irp.f | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/ao_basis/basis_prod.irp.f b/src/ao_basis/basis_prod.irp.f index 7326c7b2..f375e360 100644 --- a/src/ao_basis/basis_prod.irp.f +++ b/src/ao_basis/basis_prod.irp.f @@ -3,7 +3,8 @@ BEGIN_DOC ! Maximum number of basis functions for the projector END_DOC - basis_prod_num = ao_num * (ao_num+1) / 2 +! basis_prod_num = ao_num * (ao_num+1) / 2 + basis_prod_num = ao_num END_PROVIDER BEGIN_PROVIDER [ integer, basis_prod_idx, (2,basis_prod_num) ] @@ -12,13 +13,19 @@ ! Indices of main basis to create projector basis END_DOC integer :: i,j,a +! a=0 +! do j=1,ao_num +! do i=1,j +! a = a+1 +! basis_prod_idx(1,a) = i +! basis_prod_idx(2,a) = j +! enddo +! enddo a=0 do j=1,ao_num - do i=1,j a = a+1 basis_prod_idx(1,a) = i - basis_prod_idx(2,a) = j - enddo + basis_prod_idx(2,a) = i enddo END_PROVIDER @@ -86,18 +93,25 @@ end function basis_prod_overlap_func !$OMP PARALLEL DO PRIVATE(a,b) SCHEDULE(guided) do a=1,basis_prod_num do b=1,a - basis_prod_overlap(a,b) = basis_prod_overlap_func(a,b) - basis_prod_overlap(b,a) = basis_prod_overlap(a,b) + basis_prod_overlap(b,a) = basis_prod_overlap_func(a,b) enddo - print *, a, '/', basis_prod_num +!DEBUG +print *, a, '/', basis_prod_num enddo !$OMP END PARALLEL DO + do a=1,basis_prod_num + do b=1,a + basis_prod_overlap(a,b) = basis_prod_overlap(b,a) + enddo + enddo + ! Eliminate linear dependencies double precision, allocatable :: U(:,:), D(:), Vt(:,:) allocate(U(basis_prod_num,basis_prod_num),Vt(basis_prod_num,basis_prod_num), D(basis_prod_num)) +!DEBUG print *, 'svd' call svd( & basis_prod_overlap, size(basis_prod_overlap,1), & @@ -125,6 +139,7 @@ end function basis_prod_overlap_func print *, 'Removed Linear dependencies below ', local_cutoff endif +!DEBUG print *, 'gemm1' double precision :: dk, dk_inv double precision, allocatable :: U2(:,:) @@ -139,6 +154,7 @@ end function basis_prod_overlap_func call dgemm('N','N', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & U2, basis_prod_num, Vt, basis_prod_num, 0.d0, basis_prod_overlap, basis_prod_num) +!DEBUG print *, 'gemm2' do k=1,basis_prod_num if (D(k) == 0.d0) then @@ -154,6 +170,8 @@ end function basis_prod_overlap_func call dgemm('N','N', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & U2, basis_prod_num, Vt, basis_prod_num, 0.d0, basis_prod_overlap_inv, basis_prod_num) +!DEBUG +print *, 'Done' deallocate(U,U2,D,Vt) END_PROVIDER From 8fe023545cad4a5ddb191cc8f88bc04635cf8b83 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 6 May 2025 16:25:42 +0200 Subject: [PATCH 142/175] Basis correction with basis_prod --- config/gfortran_mkl.cfg | 2 +- .../basis_correction/weak_corr_func.irp.f | 2 +- src/ao_basis/basis_prod.irp.f | 80 ++++++++++++------- src/cas_based_on_top/on_top_cas_prov.irp.f | 34 ++++---- src/mu_of_r/mu_of_r_conditions.irp.f | 38 ++++++--- 5 files changed, 93 insertions(+), 63 deletions(-) diff --git a/config/gfortran_mkl.cfg b/config/gfortran_mkl.cfg index 626fa834..b556099a 100644 --- a/config/gfortran_mkl.cfg +++ b/config/gfortran_mkl.cfg @@ -35,7 +35,7 @@ OPENMP : 1 ; Append OpenMP flags # -ffast-math and the Fortran-specific # -fno-protect-parens and -fstack-arrays. [OPT] -FCFLAGS : -Ofast -mavx +FCFLAGS : -Ofast # Profiling flags ################# diff --git a/plugins/local/basis_correction/weak_corr_func.irp.f b/plugins/local/basis_correction/weak_corr_func.irp.f index cd88cace..a8f07ab5 100644 --- a/plugins/local/basis_correction/weak_corr_func.irp.f +++ b/plugins/local/basis_correction/weak_corr_func.irp.f @@ -22,7 +22,7 @@ mu = mu_of_r_prov(ipoint,istate) weight = final_weight_at_r_vector(ipoint) rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) - rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + rho_b = one_e_dm_and_grad_beta_in_r (4,ipoint,istate) ! Ecmd within the LDA approximation of PRB 73, 155111 (2006) call ESRC_MD_LDAERF (mu,rho_a,rho_b,dospin,ec) if(isnan(ec))then diff --git a/src/ao_basis/basis_prod.irp.f b/src/ao_basis/basis_prod.irp.f index f375e360..5bfc1316 100644 --- a/src/ao_basis/basis_prod.irp.f +++ b/src/ao_basis/basis_prod.irp.f @@ -3,8 +3,7 @@ BEGIN_DOC ! Maximum number of basis functions for the projector END_DOC -! basis_prod_num = ao_num * (ao_num+1) / 2 - basis_prod_num = ao_num + basis_prod_num = ao_num * (ao_num+1) / 2 END_PROVIDER BEGIN_PROVIDER [ integer, basis_prod_idx, (2,basis_prod_num) ] @@ -13,20 +12,26 @@ ! Indices of main basis to create projector basis END_DOC integer :: i,j,a -! a=0 -! do j=1,ao_num -! do i=1,j -! a = a+1 -! basis_prod_idx(1,a) = i -! basis_prod_idx(2,a) = j -! enddo -! enddo a=0 do j=1,ao_num - a = a+1 - basis_prod_idx(1,a) = i - basis_prod_idx(2,a) = i + do i=1,j + if (ao_overlap_abs(i,j) > ao_integrals_threshold) then + a = a+1 + basis_prod_idx(1,a) = i + basis_prod_idx(2,a) = j + endif + enddo enddo + +! a=0 +! do i=1,ao_num +! a = a+1 +! basis_prod_idx(1,a) = i +! basis_prod_idx(2,a) = i +! enddo + + basis_prod_num = a + SOFT_TOUCH basis_prod_num END_PROVIDER double precision function general_overlap_integral(dim, & @@ -77,7 +82,11 @@ double precision function basis_prod_overlap_func(a,b) k = basis_prod_idx(2,a) j = basis_prod_idx(1,b) l = basis_prod_idx(2,b) - basis_prod_overlap_func = ao_two_e_integral_general(i,j,k,l,general_overlap_integral) + if (ao_overlap_abs(i,j)*ao_overlap_abs(k,l) > ao_integrals_threshold) then + basis_prod_overlap_func = ao_two_e_integral_general(i,j,k,l,general_overlap_integral) + else + basis_prod_overlap_func = 0.d0 + endif end function basis_prod_overlap_func @@ -92,32 +101,40 @@ end function basis_prod_overlap_func !$OMP PARALLEL DO PRIVATE(a,b) SCHEDULE(guided) do a=1,basis_prod_num - do b=1,a - basis_prod_overlap(b,a) = basis_prod_overlap_func(a,b) - enddo -!DEBUG -print *, a, '/', basis_prod_num + basis_prod_overlap(a,a) = basis_prod_overlap_func(a,a) enddo !$OMP END PARALLEL DO + !$OMP PARALLEL DO PRIVATE(a,b) SCHEDULE(guided) do a=1,basis_prod_num - do b=1,a + do b=1,a-1 + if (basis_prod_overlap(a,a)*basis_prod_overlap(b,b) > ao_integrals_threshold*ao_integrals_threshold) then + basis_prod_overlap(b,a) = basis_prod_overlap_func(b,a) + else + basis_prod_overlap(b,a) = 0.d0 + endif basis_prod_overlap(a,b) = basis_prod_overlap(b,a) enddo +!DEBUG +print *, a, '/', basis_prod_num enddo + !$OMP END PARALLEL DO + ! Eliminate linear dependencies double precision, allocatable :: U(:,:), D(:), Vt(:,:) - allocate(U(basis_prod_num,basis_prod_num),Vt(basis_prod_num,basis_prod_num), D(basis_prod_num)) + allocate(U(basis_prod_num,basis_prod_num), D(basis_prod_num)) +! allocate(Vt(basis_prod_num,basis_prod_num)) !DEBUG print *, 'svd' - call svd( & - basis_prod_overlap, size(basis_prod_overlap,1), & - U, size(U,1), D, & - Vt, size(Vt,1), & - basis_prod_num,basis_prod_num) +! call svd( & +! basis_prod_overlap, size(basis_prod_overlap,1), & +! U, size(U,1), D, & +! Vt, size(Vt,1), & +! basis_prod_num,basis_prod_num) + call lapack_diagd(D,U,basis_prod_overlap,basis_prod_num,basis_prod_num) double precision :: local_cutoff integer :: i, j, k, mm @@ -151,8 +168,8 @@ end function basis_prod_overlap_func enddo enddo - call dgemm('N','N', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & - U2, basis_prod_num, Vt, basis_prod_num, 0.d0, basis_prod_overlap, basis_prod_num) + call dgemm('N','T', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & + U2, basis_prod_num, U, basis_prod_num, 0.d0, basis_prod_overlap, basis_prod_num) !DEBUG print *, 'gemm2' @@ -167,12 +184,13 @@ end function basis_prod_overlap_func enddo enddo - call dgemm('N','N', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & - U2, basis_prod_num, Vt, basis_prod_num, 0.d0, basis_prod_overlap_inv, basis_prod_num) + call dgemm('N','T', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & + U2, basis_prod_num, U, basis_prod_num, 0.d0, basis_prod_overlap_inv, basis_prod_num) !DEBUG print *, 'Done' - deallocate(U,U2,D,Vt) + deallocate(U,U2,D) +! deallocate(Vt) END_PROVIDER diff --git a/src/cas_based_on_top/on_top_cas_prov.irp.f b/src/cas_based_on_top/on_top_cas_prov.irp.f index 9f9a1f06..29578820 100644 --- a/src/cas_based_on_top/on_top_cas_prov.irp.f +++ b/src/cas_based_on_top/on_top_cas_prov.irp.f @@ -1,5 +1,5 @@ - subroutine act_on_top_on_grid_pt(ipoint,istate,pure_act_on_top_of_r) +subroutine act_on_top_on_grid_pt(ipoint,istate,pure_act_on_top_of_r) implicit none BEGIN_DOC ! act_on_top_on_grid_pt returns the purely ACTIVE part of the on top pair density @@ -10,27 +10,27 @@ subroutine act_on_top_on_grid_pt(ipoint,istate,pure_act_on_top_of_r) double precision, intent(out) :: pure_act_on_top_of_r double precision :: phi_i,phi_j,phi_k,phi_l integer :: i,j,k,l - ASSERT (istate <= N_states) + double precision, allocatable :: x(:,:) + double precision, external :: ddot + allocate(x(n_act_orb,n_act_orb)) - pure_act_on_top_of_r = 0.d0 - do l = 1, n_act_orb + do l = 1, n_act_orb phi_l = act_mos_in_r_array(l,ipoint) - if (dabs(phi_l) < 1.d-12) cycle do k = 1, n_act_orb - phi_k = act_mos_in_r_array(k,ipoint) * phi_l - if (dabs(phi_k) < 1.d-12) cycle - do j = 1, n_act_orb - phi_j = act_mos_in_r_array(j,ipoint) * phi_k - if (dabs(phi_j) < 1.d-12) cycle - do i = 1, n_act_orb - phi_i = act_mos_in_r_array(i,ipoint) * phi_j - ! 1 2 1 2 - pure_act_on_top_of_r = pure_act_on_top_of_r + act_2_rdm_ab_mo(i,j,k,l,istate) * phi_i !* phi_j * phi_k * phi_l - enddo - enddo + phi_k = act_mos_in_r_array(k,ipoint) + x(k,l) = phi_k*phi_l enddo + enddo + ASSERT (istate <= N_states) + + pure_act_on_top_of_r = 0.d0 + do l = 1, n_act_orb + do k = 1, n_act_orb + if (dabs(x(k,l)) < 1.d-10) cycle + pure_act_on_top_of_r = pure_act_on_top_of_r + ddot(n_act_orb*n_act_orb,act_2_rdm_ab_mo(1,1,k,l,istate), 1, x, 1) * x(k,l) enddo - end + enddo +end BEGIN_PROVIDER [double precision, total_cas_on_top_density,(n_points_final_grid,N_states) ] diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index 52c96442..7ce09366 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -337,28 +337,40 @@ END_DOC integer :: ipoint + double precision :: f - !$OMP PARALLEL PRIVATE(ipoint,a,b,i,j,k,l,f1,f2) DEFAULT(SHARED) + integer :: i,j,a,b + double precision, allocatable :: tmp(:), tmp2(:) + double precision :: epsilon, pb + double precision, external :: ddot + f = 2.d0/dsqrt(dacos(-1.d0)) * (0.75d0*dacos(-1.d0)**2)**(1.d0/3.d0) + + !$OMP PARALLEL PRIVATE(ipoint,a,b,i,j,tmp,epsilon,pb,tmp2) DEFAULT(SHARED) + allocate(tmp(basis_prod_num), tmp2(basis_prod_num)) !$OMP DO do ipoint=1,n_points_final_grid - mu_of_r_projector_ao_prod(ipoint) = 0.d0 - integer :: i,j,k,l,a,b - double precision :: f1, f2 do a=1,basis_prod_num i = basis_prod_idx(1,a) j = basis_prod_idx(2,a) - f1 = aos_in_r_array(i,ipoint) * aos_in_r_array(j,ipoint) - do b=1,basis_prod_num - k = basis_prod_idx(1,b) - l = basis_prod_idx(2,b) - f2 = aos_in_r_array(k,ipoint) * aos_in_r_array(l,ipoint) - mu_of_r_projector_ao_prod(ipoint) = mu_of_r_projector_ao_prod(ipoint) + & - f1*f2 * basis_prod_overlap_inv(a,b) - enddo + tmp(a) = aos_in_r_array(i,ipoint) * aos_in_r_array(j,ipoint) enddo - mu_of_r_projector_ao_prod(ipoint) = mu_of_r_projector_ao_prod(ipoint)**(1.d0/3.d0) * 2.199085233011538d0 + +! pb = 0.d0 +! do a=1,basis_prod_num +! do b=1,basis_prod_num +! pb = pb + tmp(a) * basis_prod_overlap_inv(b,a) * tmp(b) +! enddo +! enddo + + call dgemv('N', basis_prod_num, basis_prod_num, 1.d0, basis_prod_overlap_inv, & + basis_prod_num, tmp, 1, 0.d0, tmp2, 1) + pb = ddot(basis_prod_num, tmp, 1, tmp2, 1) + + epsilon = 1.d0/(2.d0*dacos(-1.d0) * pb**(2.d0/3.d0) ) + mu_of_r_projector_ao_prod(ipoint) = 1.d0/(2.d0*dsqrt(epsilon)) enddo !$OMP END DO + deallocate(tmp,tmp2) !$OMP END PARALLEL END_PROVIDER From 95f00029647bc2f66ab199f22e8713da1b8846f5 Mon Sep 17 00:00:00 2001 From: eginer Date: Wed, 7 May 2025 18:06:49 +0200 Subject: [PATCH 143/175] added some more integrals --- plugins/local/extra_basis_int/two_e_int.irp.f | 146 ++++++++++++++++++ src/utils/linear_algebra.irp.f | 2 +- 2 files changed, 147 insertions(+), 1 deletion(-) diff --git a/plugins/local/extra_basis_int/two_e_int.irp.f b/plugins/local/extra_basis_int/two_e_int.irp.f index 2cde4153..4a7e69a7 100644 --- a/plugins/local/extra_basis_int/two_e_int.irp.f +++ b/plugins/local/extra_basis_int/two_e_int.irp.f @@ -143,3 +143,149 @@ double precision function ao_two_e_integral_mixed_exchange(i, j, k, l) enddo ! p end + +double precision function ao_two_e_integral_mixed_3_a_1_b(i, j, k, l) + + BEGIN_DOC + ! integral of the AO basis or (ij|kl) + ! i(r1) j(r1) 1/r12 k(r2) l(r2) + ! A A A B + ! + ! where i,j belong to the REGULAR AO basis (system A) and k,l to the EXTRA basis (system B) + END_DOC + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: i, j, k, l + + integer :: p, q, r, s + integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3) + integer :: iorder_p(3), iorder_q(3) + double precision :: I_center(3), J_center(3), K_center(3), L_center(3) + double precision :: integral + double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp + double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq + double precision :: general_primitive_integral + + dim1 = n_pt_max_integrals + + num_i = ao_nucl(i) + num_j = ao_nucl(j) + num_k = ao_nucl(k) + num_l = ao_extra_nucl(l) + ao_two_e_integral_mixed_3_a_1_b = 0.d0 + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_power(j,p) + K_power(p) = ao_power(k,p) + L_power(p) = ao_extra_power(l,p) + I_center(p) = nucl_coord(num_i,p) + J_center(p) = nucl_coord(num_j,p) + K_center(p) = nucl_coord(num_k,p) + L_center(p) = extra_nucl_coord(num_l,p) + enddo + + double precision :: coef1, coef2, coef3, coef4 + double precision :: p_inv,q_inv + + do p = 1, ao_prim_num(i) + coef1 = ao_coef_normalized_ordered_transp(p,i) + do q = 1, ao_prim_num(j) + coef2 = coef1*ao_coef_normalized_ordered_transp(q,j) + call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,& + ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), & + I_power,J_power,I_center,J_center,dim1) + p_inv = 1.d0/pp + do r = 1, ao_prim_num(k) + coef3 = coef2*ao_coef_normalized_ordered_transp(r,k) + do s = 1, ao_extra_prim_num(l) + coef4 = coef3*ao_extra_coef_normalized_ordered_transp(s,l) + call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,& + ao_expo_ordered_transp(r,k),ao_extra_expo_ordered_transp(s,l), & + K_power,L_power,K_center,L_center,dim1) + q_inv = 1.d0/qq + integral = general_primitive_integral(dim1, & + P_new,P_center,fact_p,pp,p_inv,iorder_p, & + Q_new,Q_center,fact_q,qq,q_inv,iorder_q) + ao_two_e_integral_mixed_3_a_1_b = ao_two_e_integral_mixed_3_a_1_b + coef4 * integral + enddo ! s + enddo ! r + enddo ! q + enddo ! p + +end + +double precision function ao_two_e_integral_mixed_3_b_1_a(i, j, k, l) + + BEGIN_DOC + ! integral of the AO basis or (ij|kl) + ! i(r1) j(r1) 1/r12 k(r2) l(r2) + ! A B B B + ! + ! where i,j belong to the REGULAR AO basis (system A) and k,l to the EXTRA basis (system B) + END_DOC + + implicit none + include 'utils/constants.include.F' + + integer, intent(in) :: i, j, k, l + + integer :: p, q, r, s + integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3) + integer :: iorder_p(3), iorder_q(3) + double precision :: I_center(3), J_center(3), K_center(3), L_center(3) + double precision :: integral + double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp + double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq + double precision :: general_primitive_integral + + dim1 = n_pt_max_integrals + + num_i = ao_nucl(i) + num_j = ao_extra_nucl(j) + num_k = ao_extra_nucl(k) + num_l = ao_extra_nucl(l) + ao_two_e_integral_mixed_3_b_1_a = 0.d0 + + do p = 1, 3 + I_power(p) = ao_power(i,p) + J_power(p) = ao_extra_power(j,p) + K_power(p) = ao_extra_power(k,p) + L_power(p) = ao_extra_power(l,p) + I_center(p) = nucl_coord(num_i,p) + J_center(p) = extra_nucl_coord(num_j,p) + K_center(p) = extra_nucl_coord(num_k,p) + L_center(p) = extra_nucl_coord(num_l,p) + enddo + + double precision :: coef1, coef2, coef3, coef4 + double precision :: p_inv,q_inv + + do p = 1, ao_prim_num(i) + coef1 = ao_coef_normalized_ordered_transp(p,i) + do q = 1, ao_extra_prim_num(j) + coef2 = coef1*ao_extra_coef_normalized_ordered_transp(q,j) + call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,& + ao_expo_ordered_transp(p,i),ao_extra_expo_ordered_transp(q,j), & + I_power,J_power,I_center,J_center,dim1) + p_inv = 1.d0/pp + do r = 1, ao_extra_prim_num(k) + coef3 = coef2*ao_extra_coef_normalized_ordered_transp(r,k) + do s = 1, ao_extra_prim_num(l) + coef4 = coef3*ao_extra_coef_normalized_ordered_transp(s,l) + call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,& + ao_extra_expo_ordered_transp(r,k),ao_extra_expo_ordered_transp(s,l), & + K_power,L_power,K_center,L_center,dim1) + q_inv = 1.d0/qq + integral = general_primitive_integral(dim1, & + P_new,P_center,fact_p,pp,p_inv,iorder_p, & + Q_new,Q_center,fact_q,qq,q_inv,iorder_q) + ao_two_e_integral_mixed_3_b_1_a = ao_two_e_integral_mixed_3_b_1_a + coef4 * integral + enddo ! s + enddo ! r + enddo ! q + enddo ! p + +end diff --git a/src/utils/linear_algebra.irp.f b/src/utils/linear_algebra.irp.f index 629a998b..5c30ca20 100644 --- a/src/utils/linear_algebra.irp.f +++ b/src/utils/linear_algebra.irp.f @@ -1326,7 +1326,7 @@ subroutine get_inverse(A,LDA,m,C,LDC) subroutine get_pseudo_inverse(A, LDA, m, n, C, LDC, cutoff) BEGIN_DOC - ! Find C = A^-1 + ! Find C = A^-1: A(m,n), C(n,m) END_DOC implicit none From e3b7cda020354a67ecbc0513b73cdcae23570624 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 15 May 2025 15:06:23 +0200 Subject: [PATCH 144/175] Added mu_average_prov_ot --- .../basis_correction/print_routine.irp.f | 10 +++++++ src/ao_basis/basis_prod.irp.f | 11 -------- src/davidson/u0_hs2_u0.irp.f | 1 + src/mu_of_r/mu_of_r_conditions.irp.f | 26 +++++++++++++++++++ 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/plugins/local/basis_correction/print_routine.irp.f b/plugins/local/basis_correction/print_routine.irp.f index e4f42510..b2fdef84 100644 --- a/plugins/local/basis_correction/print_routine.irp.f +++ b/plugins/local/basis_correction/print_routine.irp.f @@ -65,6 +65,7 @@ subroutine print_basis_correction print*,'+) PBE-on-top Ecmd functional : JCP, 152, 174104 (2020) ' print*,'PBE at mu=0, extrapolated ontop pair density at large mu, usual spin-polarization' do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA-OT , state ',istate,' = ',ecmd_lda_on_top_mu_of_r(istate) write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_mu_of_r(istate) enddo print*,'' @@ -72,6 +73,7 @@ subroutine print_basis_correction print*,'+) PBE-on-top no spin polarization Ecmd functional : JCP, 152, 174104 (2020)' print*,'PBE at mu=0, extrapolated ontop pair density at large mu, and ZERO SPIN POLARIZATION' do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-LDA-OT , state ',istate,' = ',ecmd_lda_on_top_su_mu_of_r(istate) write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate) enddo print*,'' @@ -84,6 +86,14 @@ subroutine print_basis_correction write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) [rho^2], state ',istate,' = ',mu_average_prov2(istate) enddo + if(mu_of_r_potential.EQ."cas_full".or. & + mu_of_r_potential.EQ."cas_truncated".or. & + mu_of_r_potential.EQ."pure_act".or. & + mu_of_r_potential.EQ."proj_cas") then + do istate = 1, N_states + write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) [OT ], state ',istate,' = ',mu_average_prov_ot(istate) + enddo + endif end diff --git a/src/ao_basis/basis_prod.irp.f b/src/ao_basis/basis_prod.irp.f index 5bfc1316..f52788e5 100644 --- a/src/ao_basis/basis_prod.irp.f +++ b/src/ao_basis/basis_prod.irp.f @@ -115,8 +115,6 @@ end function basis_prod_overlap_func endif basis_prod_overlap(a,b) = basis_prod_overlap(b,a) enddo -!DEBUG -print *, a, '/', basis_prod_num enddo !$OMP END PARALLEL DO @@ -127,8 +125,6 @@ end function basis_prod_overlap_func allocate(U(basis_prod_num,basis_prod_num), D(basis_prod_num)) ! allocate(Vt(basis_prod_num,basis_prod_num)) -!DEBUG -print *, 'svd' ! call svd( & ! basis_prod_overlap, size(basis_prod_overlap,1), & ! U, size(U,1), D, & @@ -156,8 +152,6 @@ end function basis_prod_overlap_func print *, 'Removed Linear dependencies below ', local_cutoff endif -!DEBUG -print *, 'gemm1' double precision :: dk, dk_inv double precision, allocatable :: U2(:,:) allocate(U2(basis_prod_num,basis_prod_num)) @@ -171,8 +165,6 @@ end function basis_prod_overlap_func call dgemm('N','T', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & U2, basis_prod_num, U, basis_prod_num, 0.d0, basis_prod_overlap, basis_prod_num) -!DEBUG -print *, 'gemm2' do k=1,basis_prod_num if (D(k) == 0.d0) then dk = 0.d0 @@ -187,9 +179,6 @@ end function basis_prod_overlap_func call dgemm('N','T', basis_prod_num, basis_prod_num, basis_prod_num, 1.d0, & U2, basis_prod_num, U, basis_prod_num, 0.d0, basis_prod_overlap_inv, basis_prod_num) -!DEBUG -print *, 'Done' - deallocate(U,U2,D) ! deallocate(Vt) END_PROVIDER diff --git a/src/davidson/u0_hs2_u0.irp.f b/src/davidson/u0_hs2_u0.irp.f index dd5e01eb..9e8145fe 100644 --- a/src/davidson/u0_hs2_u0.irp.f +++ b/src/davidson/u0_hs2_u0.irp.f @@ -14,6 +14,7 @@ enddo END_PROVIDER + BEGIN_PROVIDER [ double precision, psi_energy_with_nucl_rep, (N_states) ] implicit none BEGIN_DOC diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index 7ce09366..83fa4aac 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -262,6 +262,32 @@ enddo END_PROVIDER +BEGIN_PROVIDER [double precision, mu_average_prov_ot, (N_states)] + implicit none + BEGIN_DOC + ! average value of mu(r) weighted with on-top pair density + ! + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! + ! in the one- and two-body density matrix are excluded + END_DOC + integer :: ipoint,istate + double precision :: weight,density,norm + mu_average_prov_ot = 0.d0 + do istate = 1, N_states + norm = 0.d0 + do ipoint = 1, n_points_final_grid + weight =final_weight_at_r_vector(ipoint) + density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle + mu_average_prov_ot(istate) += mu_of_r_prov(ipoint,istate) * weight*on_top_cas_mu_r(ipoint,istate) + norm = norm + weight*on_top_cas_mu_r(ipoint,istate) + enddo + mu_average_prov_ot(istate) = mu_average_prov_ot(istate) / norm + enddo +END_PROVIDER + BEGIN_PROVIDER [double precision, mu_of_r_projector_mo, (n_points_final_grid) ] implicit none From 286a60fd7ab92a4127e8deb9a600d691d768b944 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 15 May 2025 16:54:18 +0200 Subject: [PATCH 145/175] Added energy by projection --- src/perturbation/energy.irp.f | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/perturbation/energy.irp.f diff --git a/src/perturbation/energy.irp.f b/src/perturbation/energy.irp.f new file mode 100644 index 00000000..96230367 --- /dev/null +++ b/src/perturbation/energy.irp.f @@ -0,0 +1,33 @@ +BEGIN_PROVIDER [ double precision, energy_by_projection, (N_states)] + implicit none + BEGIN_DOC + ! E = / + END_DOC + + integer :: i, k, iref + integer, allocatable :: degree(:), idx(:) + double precision :: hij, tmp + allocate(degree(N_det),idx(0:N_det)) + call i_h_j(psi_det(1,1,1),psi_det(1,1,1),N_int,hij) + + do i=1,N_states + energy_by_projection(i) = 0.d0 + iref = maxloc(abs(psi_coef(:,i)),1) + call get_excitation_degree_vector(psi_det,psi_det(1,1,iref),degree,N_int, N_det, idx) + + !$OMP PARALLEL PRIVATE(k,hij,tmp) + tmp = 0.d0 + !$OMP DO + do k=1,idx(0) + call i_h_j(psi_det(1,1,iref),psi_det(1,1,idx(k)),N_int,hij) + tmp = tmp + psi_coef(idx(k),i)*hij + enddo + !$OMP END DO + !$OMP ATOMIC + energy_by_projection(i) = energy_by_projection(i) + tmp + !$OMP END PARALLEL + + energy_by_projection(i) = energy_by_projection(i) / psi_coef(iref,i) + nuclear_repulsion + enddo +END_PROVIDER + From 8656a433e5b5b69dc2ad9ca7d2ed62275013b9b8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 24 Jun 2025 14:23:36 +0200 Subject: [PATCH 146/175] Fixed ao_cart_to_sphe_inv --- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 2 +- src/trexio/export_trexio.irp.f | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) 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 53a9cb44..d4709ce5 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -22,7 +22,7 @@ integer :: i do i=1,ao_num - ao_cart_to_sphe_inv(:,i) = Rinv(:,i) + ao_cart_to_sphe_inv(1:ao_sphe_num,i) = Rinv(1:ao_sphe_num,i) enddo END_PROVIDER diff --git a/src/trexio/export_trexio.irp.f b/src/trexio/export_trexio.irp.f index ff12aebb..9cfe4f57 100644 --- a/src/trexio/export_trexio.irp.f +++ b/src/trexio/export_trexio.irp.f @@ -1,7 +1,10 @@ -program export_trexio_prog +program export_trexio_ implicit none + logical :: update, full_path read_wf = .True. SOFT_TOUCH read_wf - call export_trexio(.False.,.False.) + update = .False. + full_path = .False. + call export_trexio(update, full_path) end From 7ac99e777592a5eb37319f3dbccf72cd5c2901e3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 24 Jun 2025 14:37:52 +0200 Subject: [PATCH 147/175] Fixed CI --- src/ao_basis/basis_prod.irp.f | 15 ++++++++++++--- src/ao_one_e_ints/ao_one_e_ints.irp.f | 2 +- src/ao_one_e_ints/ao_ortho_canonical.irp.f | 4 ++-- src/trexio/export_trexio_routines.irp.f | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ao_basis/basis_prod.irp.f b/src/ao_basis/basis_prod.irp.f index f52788e5..8e6347d8 100644 --- a/src/ao_basis/basis_prod.irp.f +++ b/src/ao_basis/basis_prod.irp.f @@ -1,3 +1,12 @@ +BEGIN_PROVIDER [ double precision, ao_basis_prod_threshold ] + implicit none + BEGIN_DOC + ! Threshold to select a product of basis functions + END_DOC + ao_basis_prod_threshold = 1.d-8 + +END_PROVIDER + BEGIN_PROVIDER [ integer, basis_prod_num ] implicit none BEGIN_DOC @@ -15,7 +24,7 @@ a=0 do j=1,ao_num do i=1,j - if (ao_overlap_abs(i,j) > ao_integrals_threshold) then + if (ao_overlap_abs(i,j) > ao_basis_prod_threshold) then a = a+1 basis_prod_idx(1,a) = i basis_prod_idx(2,a) = j @@ -82,7 +91,7 @@ double precision function basis_prod_overlap_func(a,b) k = basis_prod_idx(2,a) j = basis_prod_idx(1,b) l = basis_prod_idx(2,b) - if (ao_overlap_abs(i,j)*ao_overlap_abs(k,l) > ao_integrals_threshold) then + if (ao_overlap_abs(i,j)*ao_overlap_abs(k,l) > ao_basis_prod_threshold) then basis_prod_overlap_func = ao_two_e_integral_general(i,j,k,l,general_overlap_integral) else basis_prod_overlap_func = 0.d0 @@ -108,7 +117,7 @@ end function basis_prod_overlap_func !$OMP PARALLEL DO PRIVATE(a,b) SCHEDULE(guided) do a=1,basis_prod_num do b=1,a-1 - if (basis_prod_overlap(a,a)*basis_prod_overlap(b,b) > ao_integrals_threshold*ao_integrals_threshold) then + if (basis_prod_overlap(a,a)*basis_prod_overlap(b,b) > ao_basis_prod_threshold*ao_basis_prod_threshold) then basis_prod_overlap(b,a) = basis_prod_overlap_func(b,a) else basis_prod_overlap(b,a) = 0.d0 diff --git a/src/ao_one_e_ints/ao_one_e_ints.irp.f b/src/ao_one_e_ints/ao_one_e_ints.irp.f index 8b0edfbc..859e3b0e 100644 --- a/src/ao_one_e_ints/ao_one_e_ints.irp.f +++ b/src/ao_one_e_ints/ao_one_e_ints.irp.f @@ -55,7 +55,7 @@ ao_sphe_one_e_integrals = ao_sphe_integrals_n_e + ao_sphe_kinetic_integrals - do j = 1, ao_num + do j = 1, ao_sphe_num ao_sphe_one_e_integrals_diag(j) = ao_sphe_one_e_integrals(j,j) enddo 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 d4709ce5..adfdb863 100644 --- a/src/ao_one_e_ints/ao_ortho_canonical.irp.f +++ b/src/ao_one_e_ints/ao_ortho_canonical.irp.f @@ -13,7 +13,7 @@ allocate(S(k,k), R(k,m), Rinv(m,k), Sinv(k,k)) - R(:,:) = ao_cart_to_sphe_coef(:,:) + R(1:k,1:m) = ao_cart_to_sphe_coef(1:k,1:m) call dgemm('N','T', m, m, k, 1.d0, R, k, R, k, 0.d0, S, m) call get_pseudo_inverse(S, k, k, m, Sinv, k, 1.d-12) @@ -52,7 +52,7 @@ ao_ortho_canonical_coef(i,i) = 1.d0 enddo - call write_double(6, lin_dep_cutoff, "Linear dependencies cut-off") + call write_double(6, lin_dep_cutoff, "Linear dependencies cut-off") if (ao_cartesian) then ao_ortho_canonical_num = ao_num diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index 0c70b5e6..cfc23ff5 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -6,17 +6,20 @@ subroutine export_trexio(update,full_path) END_DOC logical, intent(in) :: update, full_path - integer(trexio_t) :: f(N_states) ! TREXIO file handle + integer(trexio_t), allocatable :: f(:) ! TREXIO file handle integer(trexio_exit_code) :: rc integer :: k, iunit double precision, allocatable :: factor(:) - character*(256) :: filenames(N_states), fp + character*(256) :: fp + character*(256), allocatable :: filenames(:) character :: rw integer, external :: getunitandopen integer :: i,j,l + allocate(f(N_states), filenames(N_states)) + if (full_path) then fp = trexio_filename call system('realpath '//trim(fp)//' > '//trim(fp)//'.tmp') From b4bf47694e5d302da09c5cf0367be620a562aa70 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 24 Jun 2025 14:43:23 +0200 Subject: [PATCH 148/175] Created basis_prod module --- plugins/local/ao_basis_product/NEED | 1 + plugins/local/ao_basis_product/README.rst | 6 ++++++ .../local/ao_basis_product}/basis_prod.irp.f | 2 +- plugins/local/basis_correction/NEED | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 plugins/local/ao_basis_product/NEED create mode 100644 plugins/local/ao_basis_product/README.rst rename {src/ao_basis => plugins/local/ao_basis_product}/basis_prod.irp.f (98%) diff --git a/plugins/local/ao_basis_product/NEED b/plugins/local/ao_basis_product/NEED new file mode 100644 index 00000000..8fe4c62c --- /dev/null +++ b/plugins/local/ao_basis_product/NEED @@ -0,0 +1 @@ +ao_one_e_ints diff --git a/plugins/local/ao_basis_product/README.rst b/plugins/local/ao_basis_product/README.rst new file mode 100644 index 00000000..a9862d11 --- /dev/null +++ b/plugins/local/ao_basis_product/README.rst @@ -0,0 +1,6 @@ +================ +ao_basis_product +================ + +Basis of products of AOs + diff --git a/src/ao_basis/basis_prod.irp.f b/plugins/local/ao_basis_product/basis_prod.irp.f similarity index 98% rename from src/ao_basis/basis_prod.irp.f rename to plugins/local/ao_basis_product/basis_prod.irp.f index 8e6347d8..787bc1f3 100644 --- a/src/ao_basis/basis_prod.irp.f +++ b/plugins/local/ao_basis_product/basis_prod.irp.f @@ -3,7 +3,7 @@ BEGIN_DOC ! Threshold to select a product of basis functions END_DOC - ao_basis_prod_threshold = 1.d-8 + ao_basis_prod_threshold = ao_one_e_integrals_threshold END_PROVIDER diff --git a/plugins/local/basis_correction/NEED b/plugins/local/basis_correction/NEED index 990356c3..c52e0459 100644 --- a/plugins/local/basis_correction/NEED +++ b/plugins/local/basis_correction/NEED @@ -1,3 +1,4 @@ +ao_basis_product mu_of_r dft_utils_func dft_one_e From c44b23fe97106244341f7caa8b09b5bbf5e6a49c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 24 Jun 2025 18:25:53 +0200 Subject: [PATCH 149/175] Made ao_basis_product not a plugin --- {plugins/local => src}/ao_basis_product/NEED | 0 {plugins/local => src}/ao_basis_product/README.rst | 0 {plugins/local => src}/ao_basis_product/basis_prod.irp.f | 0 src/mu_of_r/NEED | 1 + 4 files changed, 1 insertion(+) rename {plugins/local => src}/ao_basis_product/NEED (100%) rename {plugins/local => src}/ao_basis_product/README.rst (100%) rename {plugins/local => src}/ao_basis_product/basis_prod.irp.f (100%) diff --git a/plugins/local/ao_basis_product/NEED b/src/ao_basis_product/NEED similarity index 100% rename from plugins/local/ao_basis_product/NEED rename to src/ao_basis_product/NEED diff --git a/plugins/local/ao_basis_product/README.rst b/src/ao_basis_product/README.rst similarity index 100% rename from plugins/local/ao_basis_product/README.rst rename to src/ao_basis_product/README.rst diff --git a/plugins/local/ao_basis_product/basis_prod.irp.f b/src/ao_basis_product/basis_prod.irp.f similarity index 100% rename from plugins/local/ao_basis_product/basis_prod.irp.f rename to src/ao_basis_product/basis_prod.irp.f diff --git a/src/mu_of_r/NEED b/src/mu_of_r/NEED index 22bb3ebe..a0014ea7 100644 --- a/src/mu_of_r/NEED +++ b/src/mu_of_r/NEED @@ -1 +1,2 @@ +ao_basis_product cas_based_on_top From 093e5ef1a7946cabc0b2176009f8d9a91a17a467 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 3 Jul 2025 16:53:00 +0200 Subject: [PATCH 150/175] Fixed TREXIO export of MO ERIs --- src/trexio/export_trexio_routines.irp.f | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index cfc23ff5..f1204d77 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -549,7 +549,10 @@ subroutine export_trexio(update,full_path) if (export_mo_two_e_ints) then print *, 'MO two-e integrals' - PROVIDE all_mo_integrals + do_mo_cholesky = .False. + if (.true.) then + PROVIDE all_mo_integrals + endif double precision, external :: mo_two_e_integral @@ -591,6 +594,10 @@ subroutine export_trexio(update,full_path) ! ----------------------------- if (export_mo_two_e_ints_cholesky) then + do_mo_cholesky = .True. + if (.true.) then + PROVIDE all_mo_integrals + endif print *, 'MO two-e integrals Cholesky' rc = trexio_write_mo_2e_int_eri_cholesky_num(f(1), cholesky_ao_num) From 52d30d4ce9b7c2b9af8bc202a1e03d22af32b9c2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 10 Jul 2025 18:26:45 +0200 Subject: [PATCH 151/175] Add check_orthonormality --- src/tools/check_orthonormality.irp.f | 31 +++++++++++++++++++++++++ src/trexio/export_trexio_routines.irp.f | 2 -- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/tools/check_orthonormality.irp.f diff --git a/src/tools/check_orthonormality.irp.f b/src/tools/check_orthonormality.irp.f new file mode 100644 index 00000000..402b1f27 --- /dev/null +++ b/src/tools/check_orthonormality.irp.f @@ -0,0 +1,31 @@ +program check_ortho + implicit none + integer :: i,j + + call do_print + print *, '--' +! call orthonormalize_mos +! call do_print +end + +subroutine do_print + implicit none + integer :: i,j + double precision :: off_diag, diag + + off_diag = 0.d0 + diag = 0.d0 + do j=1,mo_num + do i=1,mo_num + off_diag += abs(mo_overlap(i,j)) + enddo + diag += abs(mo_overlap(j,j)) + off_diag -= abs(mo_overlap(j,j)) + enddo + print *, 'Diag = ', abs(1.d0-diag/dble(mo_num)) + print *, 'Off-Diag = ', off_diag/(dble(mo_num)**2-dble(mo_num)) + print *, '--' + +end + + diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index cfc23ff5..cec7ccc8 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -702,8 +702,6 @@ subroutine export_trexio(update,full_path) rc = trexio_write_state_num(f(k), n_states) call trexio_assert(rc, TREXIO_SUCCESS) -! Will need to be updated with TREXIO 2.4 -! rc = trexio_write_state_id(f(k), k-1) rc = trexio_write_state_id(f(k), k) call trexio_assert(rc, TREXIO_SUCCESS) From 9dd6a1e981d0bf5a216501fc30b0a09d0bad6a1e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 10 Jul 2025 22:31:53 +0200 Subject: [PATCH 152/175] Added saving of CSFs in trexio. Requires trexio 2.5.2 --- src/trexio/EZFIO.cfg | 5 + src/trexio/export_trexio_routines.irp.f | 168 +++++++++++++++++++----- 2 files changed, 137 insertions(+), 36 deletions(-) diff --git a/src/trexio/EZFIO.cfg b/src/trexio/EZFIO.cfg index 22dbea00..6f247f09 100644 --- a/src/trexio/EZFIO.cfg +++ b/src/trexio/EZFIO.cfg @@ -71,3 +71,8 @@ doc: If True, export two-body reduced density matrix interface: ezfio, ocaml, provider default: False +[export_csf] +type: logical +doc: If True, export wave function in CSF instead of determinants +interface: ezfio, ocaml, provider +default: False diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index cec7ccc8..a5f62ec7 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -681,49 +681,50 @@ subroutine export_trexio(update,full_path) ! ------------------------------------------------------------------------------ - ! Determinants - ! ------------ + integer :: nint + integer*8, allocatable :: det_buffer(:,:,:) + double precision, allocatable :: coef_buffer(:,:) - integer*8, allocatable :: det_buffer(:,:,:) - double precision, allocatable :: coef_buffer(:,:) - integer :: nint + do k=1, N_states + rc = trexio_write_state_num(f(k), n_states) + call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_get_int64_num(f(1), nint) + rc = trexio_write_state_id(f(k), k) call trexio_assert(rc, TREXIO_SUCCESS) -! nint = N_int - if (nint /= N_int) then - stop 'Problem with N_int' - endif - allocate ( det_buffer(nint, 2, BUFSIZE), coef_buffer(BUFSIZE, n_states) ) - do k=1, N_states - icount = 0_8 - offset = 0_8 - rc = trexio_write_state_num(f(k), n_states) - call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_write_state_file_name(f(k), filenames, len(filenames(1))) + call trexio_assert(rc, TREXIO_SUCCESS) + enddo - rc = trexio_write_state_id(f(k), k) - call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_get_int64_num(f(1), nint) + call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_write_state_file_name(f(k), filenames, len(filenames(1))) - call trexio_assert(rc, TREXIO_SUCCESS) - enddo + if (nint /= N_int) then + stop 'Problem with N_int' + endif - do k=1,n_det - icount += 1_8 - det_buffer(1:nint, 1:2, icount) = psi_det(1:N_int, 1:2, k) - coef_buffer(icount,1:N_states) = psi_coef(k,1:N_states) - if (icount == BUFSIZE) then - do i=1,N_states - rc = trexio_write_determinant_list(f(i), offset, icount, det_buffer) - call trexio_assert(rc, TREXIO_SUCCESS) - rc = trexio_write_determinant_coefficient(f(i), offset, icount, coef_buffer(1,i)) - call trexio_assert(rc, TREXIO_SUCCESS) - end do - offset += icount - icount = 0_8 - end if - end do + allocate ( det_buffer(nint, 2, BUFSIZE), coef_buffer(BUFSIZE, n_states) ) + + ! Determinants + ! ------------ + + icount = 0_8 + offset = 0_8 + do k=1,n_det + icount += 1_8 + det_buffer(1:nint, 1:2, icount) = psi_det(1:N_int, 1:2, k) + coef_buffer(icount,1:N_states) = psi_coef(k,1:N_states) + if (icount == BUFSIZE) then + do i=1,N_states + rc = trexio_write_determinant_list(f(i), offset, icount, det_buffer) + call trexio_assert(rc, TREXIO_SUCCESS) + rc = trexio_write_determinant_coefficient(f(i), offset, icount, coef_buffer(1,i)) + call trexio_assert(rc, TREXIO_SUCCESS) + end do + offset += icount + icount = 0_8 + end if + end do if (icount >= 0_8) then do i=1,N_states @@ -734,8 +735,103 @@ subroutine export_trexio(update,full_path) end do end if + if (export_csf) then + ! CSFs + ! ---- + + integer :: startdet, enddet, s, bfIcfg, icsf, ii, idx + integer, allocatable :: dc_index(:,:) + double precision, allocatable :: dc_value(:) + double precision :: phasedet + + + ! Write CSF coefficients + icount = 0_8 + offset = 0_8 + do ii=1,N_csf + icount += 1 + coef_buffer(icount,1:N_states) = psi_csf_coef(ii,1:N_states) + if (icount == BUFSIZE) then + do i=1,N_states + rc = trexio_write_csf_coefficient(f(i), offset, icount, coef_buffer(1,i)) + call trexio_assert(rc, TREXIO_SUCCESS) + end do + offset += icount + icount = 0_8 + endif + enddo + + if (icount >= 0_8) then + do i=1,N_states + rc = trexio_write_csf_coefficient(f(i), offset, icount, coef_buffer(1,i)) + call trexio_assert(rc, TREXIO_SUCCESS) + end do + end if + + do i=1,N_states + rc = trexio_write_csf_num(f(i), N_csf) + enddo + + icount = 0_8 + rc = trexio_read_csf_num_64(f(1), icount) + print *, icount + + ! Write CSF to determinant mapping + allocate (dc_index(2,BUFSIZE)) + allocate (dc_value(BUFSIZE)) + + icount = 0_8 + offset = 0_8 + icsf = 0 + do ii=1,N_configuration + startdet = psi_configuration_to_psi_det(1,ii) + enddet = psi_configuration_to_psi_det(2,ii) + + s = 0 + do k=1,N_int + if (psi_configuration(k,1,ii) == 0_bit_kind) cycle + s = s + popcnt(psi_configuration(k,1,ii)) + enddo + bfIcfg = max(1,int(binom(s,(s+1)/2)-binom(s,((s+1)/2)+1)+0.5d0)) + + do k=1,bfIcfg + icsf += 1 + do j = startdet, enddet + if (DetToCSFTransformationMatrix(s,k,j-startdet+1) == 0.d0) cycle + icount += 1_8 + idx = psi_configuration_to_psi_det_data(j) + call get_phase_qp_to_cfg(psi_det(1,1,idx), psi_det(1,2,idx), phasedet) + dc_index(1,icount) = icsf + dc_index(2,icount) = idx + dc_value(icount) = DetToCSFTransformationMatrix(s,k,j-startdet+1)*phasedet + if (icount == BUFSIZE) then + do i=1,N_states + rc = trexio_write_csf_det_coefficient(f(i), offset, icount, dc_index, dc_value) + call trexio_assert(rc, TREXIO_SUCCESS) + offset += icount + icount = 0_8 + end do + end if + end do + end do + end do + + if (icount > 0_8) then + do i=1,N_states + rc = trexio_write_csf_det_coefficient(f(i), offset, icount, dc_index, dc_value) + call trexio_assert(rc, TREXIO_SUCCESS) + end do + end if + + deallocate (dc_index) + deallocate (dc_value) + + endif + deallocate ( det_buffer, coef_buffer ) + ! --------------------------------------- + do k=1,N_states rc = trexio_close(f(k)) call trexio_assert(rc, TREXIO_SUCCESS) From 6c4c352265d071a7af5101f74e9956366795646e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 17 Jul 2025 08:47:42 +0200 Subject: [PATCH 153/175] Rewrote CSF code --- config/bull.cfg | 1 + config/cray_gfortran.cfg | 1 + config/cray_intel.cfg | 1 + config/flang_avx.cfg | 1 + config/gfortran.cfg | 1 + config/gfortran10.cfg | 1 + config/gfortran_armpl.cfg | 1 + config/gfortran_avx.cfg | 1 + config/gfortran_debug.cfg | 1 + config/gfortran_debug_mkl.cfg | 3 +- config/gfortran_macos.cfg | 1 + config/gfortran_mkl.cfg | 1 + config/gfortran_mpi.cfg | 1 + config/gfortran_mpi_mkl.cfg | 1 + config/gfortran_openblas.cfg | 1 + config/ifort_2019_avx.cfg | 1 + config/ifort_2019_avx_mpi.cfg | 1 + config/ifort_2019_avx_notz.cfg | 1 + config/ifort_2019_debug.cfg | 1 + config/ifort_2019_mpi_rome.cfg | 1 + config/ifort_2019_rome.cfg | 1 + config/ifort_2019_sse4.cfg | 1 + config/ifort_2019_sse4_mpi.cfg | 1 + config/ifort_2019_xHost.cfg | 1 + config/ifort_2021_avx.cfg | 1 + config/ifort_2021_avx_mpi.cfg | 1 + config/ifort_2021_avx_notz.cfg | 1 + config/ifort_2021_debug.cfg | 1 + config/ifort_2021_mpi_rome.cfg | 1 + config/ifort_2021_rome.cfg | 1 + config/ifort_2021_sse4.cfg | 1 + config/ifort_2021_sse4_mpi.cfg | 1 + config/ifort_2021_xHost.cfg | 1 + config/travis.cfg | 1 + scripts/compilation/qp_create_ninja | 9 +- src/csf/cfgCI_interface.f90 | 63 - src/csf/cfgCI_utils.c | 1763 ----------------- src/csf/configuration_CI_sigma_helpers.irp.f | 105 - src/csf/configuration_CI_sigma_helpers.org | 562 ------ src/csf/configurations.irp.f | 152 +- src/csf/conversion.irp.f | 167 -- src/csf/create_excitations.irp.f | 279 --- src/csf/csf.irp.f | 243 +++ src/csf/sigma_vector.irp.f | 706 ------- src/csf/tree_utils.c | 309 --- src/csf/tree_utils.h | 91 - src/davidson/diagonalization_h_dressed.irp.f | 556 ------ .../diagonalization_hcsf_dressed.irp.f | 283 ++- .../diagonalization_hs2_dressed.irp.f | 80 +- .../diagonalization_nonsym_h_dressed.irp.f | 8 +- src/davidson/u0_h_u0.irp.f | 28 +- src/davidson/u0_hs2_u0.irp.f | 2 +- src/determinants/determinants.irp.f | 11 +- src/determinants/h_apply.irp.f | 5 +- src/mo_two_e_ints/cholesky.irp.f | 2 +- src/trexio/export_trexio_routines.irp.f | 64 +- 56 files changed, 576 insertions(+), 4948 deletions(-) delete mode 100644 src/csf/cfgCI_interface.f90 delete mode 100644 src/csf/cfgCI_utils.c delete mode 100644 src/csf/configuration_CI_sigma_helpers.irp.f delete mode 100644 src/csf/configuration_CI_sigma_helpers.org delete mode 100644 src/csf/conversion.irp.f delete mode 100644 src/csf/create_excitations.irp.f create mode 100644 src/csf/csf.irp.f delete mode 100644 src/csf/sigma_vector.irp.f delete mode 100644 src/csf/tree_utils.c delete mode 100644 src/csf/tree_utils.h delete mode 100644 src/davidson/diagonalization_h_dressed.irp.f diff --git a/config/bull.cfg b/config/bull.cfg index 91471473..b67d2d91 100644 --- a/config/bull.cfg +++ b/config/bull.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic -xCORE-AVX2 +CC : icc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI diff --git a/config/cray_gfortran.cfg b/config/cray_gfortran.cfg index 1d1013b7..b69e8ec2 100644 --- a/config/cray_gfortran.cfg +++ b/config/cray_gfortran.cfg @@ -17,6 +17,7 @@ # [COMMON] FC : gfortran -ffree-line-length-none -I . -mavx -g -fPIC +CC : gcc -g -fPIC LAPACK_LIB : -L/appl/lumi/spack/22.08/0.18.1/opt/spack/openblas-0.3.17-xinceno/lib -lopenblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED diff --git a/config/cray_intel.cfg b/config/cray_intel.cfg index 9a4c19cf..60e6ae81 100644 --- a/config/cray_intel.cfg +++ b/config/cray_intel.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ftn -dynamic -fpic +CC : cc -fpic LAPACK_LIB : IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI diff --git a/config/flang_avx.cfg b/config/flang_avx.cfg index 625c3843..290e04f3 100644 --- a/config/flang_avx.cfg +++ b/config/flang_avx.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : flang -ffree-line-length-none -I . -mavx -g -fPIC +CC : clang -fpic LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 41181c32..5c49a039 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -g -ffree-line-length-none -I . -fPIC -march=native -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -lblas -llapack IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED diff --git a/config/gfortran10.cfg b/config/gfortran10.cfg index 03eaccd1..f3a5e90f 100644 --- a/config/gfortran10.cfg +++ b/config/gfortran10.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran-10 -g -ffree-line-length-none -I . -fPIC +CC : gcc -g -fPIC LAPACK_LIB : -lblas -llapack IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED diff --git a/config/gfortran_armpl.cfg b/config/gfortran_armpl.cfg index 245cc8ea..b1f163cb 100644 --- a/config/gfortran_armpl.cfg +++ b/config/gfortran_armpl.cfg @@ -14,6 +14,7 @@ # [COMMON] FC : gfortran -g -ffree-line-length-none -I . -fPIC -march=native -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -larmpl_lp64_mp IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED diff --git a/config/gfortran_avx.cfg b/config/gfortran_avx.cfg index 5b51c640..08bfc181 100644 --- a/config/gfortran_avx.cfg +++ b/config/gfortran_avx.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -ffree-line-length-none -I . -mavx -g -fPIC -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED diff --git a/config/gfortran_debug.cfg b/config/gfortran_debug.cfg index f903142a..f8a1a6b7 100644 --- a/config/gfortran_debug.cfg +++ b/config/gfortran_debug.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -g -ffree-line-length-none -I . -fPIC -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -lblas -llapack IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED diff --git a/config/gfortran_debug_mkl.cfg b/config/gfortran_debug_mkl.cfg index 1dc3f2b2..6be4e801 100644 --- a/config/gfortran_debug_mkl.cfg +++ b/config/gfortran_debug_mkl.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -g -ffree-line-length-none -I . -fPIC -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -I${MKLROOT}/include -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_core -lpthread -lm -ldl -lmkl_gnu_thread -lgomp -fopenmp IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED @@ -52,7 +53,7 @@ FCFLAGS : -Ofast # [DEBUG] #FCFLAGS : -g -msse4.2 -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan -FCFLAGS : -g -mavx -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow -finit-real=nan +FCFLAGS : -g -mavx -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow -finit-real=nan -fno-omit-frame-pointer # OpenMP flags ################# diff --git a/config/gfortran_macos.cfg b/config/gfortran_macos.cfg index 4fffca29..09e97a2d 100644 --- a/config/gfortran_macos.cfg +++ b/config/gfortran_macos.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -ffree-line-length-none -I . -g -fPIC -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED -DMACOS diff --git a/config/gfortran_mkl.cfg b/config/gfortran_mkl.cfg index b556099a..b39a6d62 100644 --- a/config/gfortran_mkl.cfg +++ b/config/gfortran_mkl.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -ffree-line-length-none -I . -march=native -g -fPIC -std=legacy -ftree-vectorize +CC : gcc -g -fPIC LAPACK_LIB : -I${MKLROOT}/include -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_core -lpthread -lm -ldl -lmkl_gnu_thread -lgomp -fopenmp IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DSET_NESTED diff --git a/config/gfortran_mpi.cfg b/config/gfortran_mpi.cfg index 7cc88f1f..7b881e2e 100644 --- a/config/gfortran_mpi.cfg +++ b/config/gfortran_mpi.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : mpif90 -ffree-line-length-none -I . -g -fPIC -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -lblas -llapack IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DSET_NESTED diff --git a/config/gfortran_mpi_mkl.cfg b/config/gfortran_mpi_mkl.cfg index 7cc88f1f..7b881e2e 100644 --- a/config/gfortran_mpi_mkl.cfg +++ b/config/gfortran_mpi_mkl.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : mpif90 -ffree-line-length-none -I . -g -fPIC -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -lblas -llapack IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DSET_NESTED diff --git a/config/gfortran_openblas.cfg b/config/gfortran_openblas.cfg index 5db46fce..9d0ffd8c 100644 --- a/config/gfortran_openblas.cfg +++ b/config/gfortran_openblas.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -g -ffree-line-length-none -I . -fPIC -march=native -std=legacy +CC : gcc -g -fPIC LAPACK_LIB : -lopenblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DSET_NESTED diff --git a/config/ifort_2019_avx.cfg b/config/ifort_2019_avx.cfg index c5bed0d8..1f8ee6ba 100644 --- a/config/ifort_2019_avx.cfg +++ b/config/ifort_2019_avx.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_avx_mpi.cfg b/config/ifort_2019_avx_mpi.cfg index 5b4d2922..c5c7dca3 100644 --- a/config/ifort_2019_avx_mpi.cfg +++ b/config/ifort_2019_avx_mpi.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_avx_notz.cfg b/config/ifort_2019_avx_notz.cfg index f68b256d..59390deb 100644 --- a/config/ifort_2019_avx_notz.cfg +++ b/config/ifort_2019_avx_notz.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --define=WITHOUT_TRAILZ --define=WITHOUT_SHIFTRL -DSET_NESTED diff --git a/config/ifort_2019_debug.cfg b/config/ifort_2019_debug.cfg index 8c16c4ac..e393a250 100644 --- a/config/ifort_2019_debug.cfg +++ b/config/ifort_2019_debug.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_mpi_rome.cfg b/config/ifort_2019_mpi_rome.cfg index 054d4d7d..0270a2d8 100644 --- a/config/ifort_2019_mpi_rome.cfg +++ b/config/ifort_2019_mpi_rome.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_rome.cfg b/config/ifort_2019_rome.cfg index a18a0acb..4d44eb02 100644 --- a/config/ifort_2019_rome.cfg +++ b/config/ifort_2019_rome.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_sse4.cfg b/config/ifort_2019_sse4.cfg index 2cdbc2c5..9fe245c1 100644 --- a/config/ifort_2019_sse4.cfg +++ b/config/ifort_2019_sse4.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_sse4_mpi.cfg b/config/ifort_2019_sse4_mpi.cfg index d20cd2a2..0382fe44 100644 --- a/config/ifort_2019_sse4_mpi.cfg +++ b/config/ifort_2019_sse4_mpi.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL -DSET_NESTED diff --git a/config/ifort_2019_xHost.cfg b/config/ifort_2019_xHost.cfg index 59c6146b..5143ecc6 100644 --- a/config/ifort_2019_xHost.cfg +++ b/config/ifort_2019_xHost.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=64 -DINTEL -DSET_NESTED diff --git a/config/ifort_2021_avx.cfg b/config/ifort_2021_avx.cfg index 55fe0ee7..c7c7ee0a 100644 --- a/config/ifort_2021_avx.cfg +++ b/config/ifort_2021_avx.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_avx_mpi.cfg b/config/ifort_2021_avx_mpi.cfg index 362f482a..faba8618 100644 --- a/config/ifort_2021_avx_mpi.cfg +++ b/config/ifort_2021_avx_mpi.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL diff --git a/config/ifort_2021_avx_notz.cfg b/config/ifort_2021_avx_notz.cfg index 3cd80236..75174245 100644 --- a/config/ifort_2021_avx_notz.cfg +++ b/config/ifort_2021_avx_notz.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --define=WITHOUT_TRAILZ --define=WITHOUT_SHIFTRL diff --git a/config/ifort_2021_debug.cfg b/config/ifort_2021_debug.cfg index 2e30642c..76f43322 100644 --- a/config/ifort_2021_debug.cfg +++ b/config/ifort_2021_debug.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert -DINTEL diff --git a/config/ifort_2021_mpi_rome.cfg b/config/ifort_2021_mpi_rome.cfg index b7341388..06571ac6 100644 --- a/config/ifort_2021_mpi_rome.cfg +++ b/config/ifort_2021_mpi_rome.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_rome.cfg b/config/ifort_2021_rome.cfg index 1d2d8c77..8c39f560 100644 --- a/config/ifort_2021_rome.cfg +++ b/config/ifort_2021_rome.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_sse4.cfg b/config/ifort_2021_sse4.cfg index e43147ba..1db4a109 100644 --- a/config/ifort_2021_sse4.cfg +++ b/config/ifort_2021_sse4.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_sse4_mpi.cfg b/config/ifort_2021_sse4_mpi.cfg index 1914988b..8af57114 100644 --- a/config/ifort_2021_sse4_mpi.cfg +++ b/config/ifort_2021_sse4_mpi.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : mpiifort -fpic -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL diff --git a/config/ifort_2021_xHost.cfg b/config/ifort_2021_xHost.cfg index 0dfce550..1593cf5d 100644 --- a/config/ifort_2021_xHost.cfg +++ b/config/ifort_2021_xHost.cfg @@ -7,6 +7,7 @@ # [COMMON] FC : ifort -fpic -diag-disable=5462 -diag-disable=10448 +CC : gcc -g -fPIC LAPACK_LIB : -mkl=parallel IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=64 -DINTEL diff --git a/config/travis.cfg b/config/travis.cfg index a609002e..edcd158d 100644 --- a/config/travis.cfg +++ b/config/travis.cfg @@ -11,6 +11,7 @@ # [COMMON] FC : gfortran -ffree-line-length-none -I . -g -fPIC +CC : gcc -g -fPIC LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 --assert diff --git a/scripts/compilation/qp_create_ninja b/scripts/compilation/qp_create_ninja index 75b50c82..fd2cddce 100755 --- a/scripts/compilation/qp_create_ninja +++ b/scripts/compilation/qp_create_ninja @@ -92,14 +92,14 @@ def real_join(*args): def ninja_create_env_variable(pwd_config_file): """ Return some ninja variable with the env variable expanded - FC, FCFLAGS, IRPF90, IRPF90_FLAGS + FC, CC, FCFLAGS, CFLAGS, IRPF90, IRPF90_FLAGS The env variable is useful for the generation of EZFIO, and IRPF90 """ l_string = ["builddir = {0}".format(os.path.dirname(ROOT_BUILD_NINJA)), ""] - for flag in ["FC", "FCFLAGS", "IRPF90", "IRPF90_FLAGS"]: + for flag in ["FC", "CC", "CFLAGS", "FCFLAGS", "IRPF90", "IRPF90_FLAGS"]: str_ = "{0} = {1}".format(flag, get_compilation_option(pwd_config_file, flag)) for directory in [real_join(QP_SRC, m) for m in sorted(os.listdir(QP_SRC))]: @@ -296,7 +296,7 @@ def ninja_ezfio_rule(): and run ninja """ l_flag = ["export {0}='${0}'".format(flag) - for flag in ["FC", "FCFLAGS", "IRPF90"]] + for flag in ["FC", "CC", "FCFLAGS", "CFLAGS", "IRPF90"]] install_lib_ezfio = comp_path(join(QP_EZFIO, "lib", "libezfio_irp.a")) l_cmd = ["cd {0}".format(comp_path(QP_EZFIO))] + l_flag @@ -473,14 +473,13 @@ def ninja_irpf90_make_rule(): """ The rule for creating the irpf90.make Export the flag and compile - Only secontial make a possible """ # ~#~#~#~#~ # # F l a g s # # ~#~#~#~#~ # l_flag = [] - for flag in ["FC", "FCFLAGS", "LIB", "SRC", "OBJ"]: + for flag in ["FC", "FCFLAGS", "CC", "CFLAGS", "LIB", "SRC", "OBJ"]: str_ = "export {0}='${0}'".format(flag) l_flag.append(str_) diff --git a/src/csf/cfgCI_interface.f90 b/src/csf/cfgCI_interface.f90 deleted file mode 100644 index b701f0ec..00000000 --- a/src/csf/cfgCI_interface.f90 +++ /dev/null @@ -1,63 +0,0 @@ -module cfunctions - use, intrinsic :: ISO_C_BINDING - interface - subroutine printcfglist(nint, ncfgs, cfglist) bind(C, name='printCFGList') - import C_INT32_T, C_INT64_T - integer(kind=C_INT32_T) :: nint - integer(kind=C_INT32_T) :: ncfgs - integer(kind=C_INT64_T) :: cfglist(nint,2,ncfgs) - end subroutine printcfglist - end interface - interface - subroutine getApqIJMatrixDims(Isomo, Jsomo, MS, rowsout, colsout) & - bind(C, name='getApqIJMatrixDims') - import C_INT32_T, C_INT64_T - integer(kind=C_INT64_T),value,intent(in) :: Isomo ! CSFI - integer(kind=C_INT64_T),value,intent(in) :: Jsomo ! CSFJ - integer(kind=C_INT64_T),value,intent(in) :: MS ! Ms = 2*Spin - integer(kind=C_INT32_T),intent(out):: rowsout - integer(kind=C_INT32_T),intent(out):: colsout - end subroutine getApqIJMatrixDims - end interface - interface - subroutine getApqIJMatrixDriver(Isomo, Jsomo, orbp, orbq, & - MS, NMO, CSFICSFJApqIJ, rowsmax, colsmax) bind(C, name='getApqIJMatrixDriverArrayInp') - import C_INT32_T, C_INT64_T, C_DOUBLE - integer(kind=C_INT64_T),value,intent(in) :: Isomo - integer(kind=C_INT64_T),value,intent(in) :: Jsomo - integer(kind=C_INT32_T),value,intent(in) :: orbp - integer(kind=C_INT32_T),value,intent(in) :: orbq - integer(kind=C_INT64_T),value,intent(in) :: MS - integer(kind=C_INT64_T),value,intent(in) :: NMO - integer(kind=C_INT32_T),intent(in) :: rowsmax - integer(kind=C_INT32_T),intent(in) :: colsmax - real (kind=C_DOUBLE ),intent(out) :: CSFICSFJApqIJ(rowsmax,colsmax) - !integer(kind=C_INT32_T),dimension(rowApqIJ,colApqIJ) :: ApqIJ - end subroutine getApqIJMatrixDriver - end interface - interface - subroutine getCSFtoDETTransformationMatrix(Isomo,& - MS, rowsmax, colsmax, csftodetmatrix) bind(C, name='convertCSFtoDetBasis') - import C_INT32_T, C_INT64_T, C_DOUBLE - integer(kind=C_INT64_T),value,intent(in) :: Isomo - integer(kind=C_INT64_T),value,intent(in) :: MS - integer(kind=C_INT32_T),intent(in) :: rowsmax - integer(kind=C_INT32_T),intent(in) :: colsmax - real (kind=C_DOUBLE ),intent(out) :: csftodetmatrix(rowsmax,colsmax) - end subroutine getCSFtoDETTransformationMatrix - end interface -end module cfunctions - -subroutine f_dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC) & - bind(C, name='f_dgemm') - use iso_c_binding - implicit none - character, intent(in), value :: TRANSA, TRANSB - integer, intent(in), value :: M,N,K,LDA,LDB,LDC - double precision, intent(in), value :: ALPHA, BETA - double precision, intent(in) :: A(LDA,*), B(LDB,*) - double precision, intent(out) :: C(LDC,*) - call dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC) -end subroutine - - diff --git a/src/csf/cfgCI_utils.c b/src/csf/cfgCI_utils.c deleted file mode 100644 index 23b984a0..00000000 --- a/src/csf/cfgCI_utils.c +++ /dev/null @@ -1,1763 +0,0 @@ -#include -#include -#include "tree_utils.h" - -void int_to_bin_digit(int64_t in, int count, int* out) -{ - /* assert: count <= sizeof(int)*CHAR_BIT */ - unsigned int mask = 1U << (count-1); - int i; - for (i = 0; i < count; i++) { - out[i] = (in & mask) ? 1 : 0; - in <<= 1; - } -} - -#include -#include -#include - -double logbinom(double n, double k) { - return lgamma(n+1)-lgamma(n-k+1)-lgamma(k+1); -} -double binom(double n, double k) { - return exp(logbinom(n,k)); -} - -void getncsfs1(int *inpnsomo, int *inpms, int *outncsfs){ - int nsomo = *inpnsomo; - int ms = *inpms; - int nparcoupl = (nsomo + ms)/2; - *outncsfs = binom(nsomo, nparcoupl); -} - -void getncsfs(int NSOMO, int MS, int *outncsfs){ - int nparcoupl = (NSOMO + MS)/2; - int nparcouplp1 = ((NSOMO + MS)/2)+1; - double tmpndets=0.0; - if(NSOMO == 0){ - (*outncsfs) = 1; - return; - } - tmpndets = binom(NSOMO, nparcoupl); - (*outncsfs) = round(tmpndets - binom(NSOMO, nparcouplp1)); -} - -#include - -void getBFIndexList(int NSOMO, int *BF1, int *IdxListBF1){ - int Iidx; - int Jidx; - int BFcopy[NSOMO]; - - int dictidx[2]; - dictidx[0] = -1; - dictidx[1] = 1; - - for(int i = 0; i < NSOMO; i++) - BFcopy[i] = BF1[i]; - - for(int i = 0; i < NSOMO; i++){ - Iidx = i; - if(BFcopy[i] == 0){ - int countN1=0; - for(int j = i+1; j < NSOMO; j++){ - Jidx = j; - countN1 = countN1 + dictidx[BFcopy[j]]; - if(countN1 > 0){ - break; - } - } - BFcopy[Iidx] = -1; - BFcopy[Jidx] = -1; - IdxListBF1[Jidx] = Iidx; - IdxListBF1[Iidx] = Jidx; - } - } - -} - -void getIslands(int NSOMO, int *BF1, int *BF2, int *nislands, int *phasefactor){ - - // Get BF ids - int *IdxListBF1 = malloc(NSOMO * sizeof(int)); - int *IdxListBF2 = malloc(NSOMO * sizeof(int)); - - getBFIndexList(NSOMO, BF1, IdxListBF1); - getBFIndexList(NSOMO, BF2, IdxListBF2); - - int sumids = 0; - int maxcount=0; - *nislands = 0; - *phasefactor = 1; - - int BF1copy[NSOMO]; - for(int i = 0; i < NSOMO; i++) - BF1copy[i] = IdxListBF1[i]; - int BF2copy[NSOMO]; - for(int i = 0; i < NSOMO; i++) - BF2copy[i] = IdxListBF2[i]; - - for(int i = 0; i < NSOMO; i++){ - int thisId = i; - int nextId = BF1copy[i]; - maxcount = 0; - while(BF1copy[thisId] != -1 && maxcount < 20){ - if(maxcount==0) *nislands += 1; - if(maxcount==19) *nislands -= 1; - - maxcount++; - - // First the bra - nextId = BF1copy[thisId]; - BF1copy[thisId] = -1; - BF1copy[nextId] = -1; - - // Get the phase factor bra - if(nextId < thisId) *phasefactor *= -1; - - // Then the ket - thisId = BF2copy[nextId]; - BF2copy[thisId] = -1; - BF2copy[nextId] = -1; - - // Get the phase factor bra - if(nextId < thisId) *phasefactor *= -1; - - } - - for(int j=0;j>= 1; - } - *nsetbits = count; -} - -void generateAllBFs(int64_t Isomo, int64_t MS, Tree *bftree, int *NBF, int *NSOMO){ - getSetBits(Isomo, NSOMO); - buildTreeDriver(bftree, *NSOMO, MS, NBF); -} - -void gramSchmidt(double *overlapMatrix, int rows, int cols, double *orthoMatrix){ - - // vector - double norm = 0.0; - double scalarprod = 0.0; - orthoMatrix[(rows-1)*cols + cols-1] = 1.0; - for(int i = cols-2; i > -1; i--){ orthoMatrix[(rows-1)*cols + i] = 0.0; } - - // Gram-Schmidt loop - for(int i = rows-2; i > -1; i--){ - for(int k = cols-1; k > -1; k--){ orthoMatrix[(i)*cols + k] = 0.0; } - orthoMatrix[i*cols + i] = 1.0; - - // orthogonalization - for(int j = rows-1; j > i; j--){ - // calculate scalar product - scalarprod = 0.0; - for(int k = cols-1;k>=j;k--){ - scalarprod += orthoMatrix[j*cols + k] * overlapMatrix[i*cols + k]; - } - for(int k = cols-1; k >= j; k--){ - orthoMatrix[i*cols + k] -= scalarprod * orthoMatrix[j*cols + k]; - } - } - - // Normalization - norm = 0.0; - for(int j = rows-1; j >= i; j--){ - for(int k=cols-1; k >= i; k--) - norm += orthoMatrix[i*cols + j]*orthoMatrix[i*cols + k]*overlapMatrix[j*cols+k]; - } - norm = sqrt(norm); - for(int j = rows-1; j >= i; j--){ - orthoMatrix[i*cols + j] /= norm; - } - - } - -} - -void get_phase_cfg_to_qp_inpList(int *inpdet, int NSOMO, int *phaseout){ - int nbetas=0; - (*phaseout) = 1; - for(int i=0;i 0){ - mask = (1< 0.0) phaseAll = 1.0; - //} - for(int j=0;j 0) free(overlapMatrixI); - if(rowsI + colsI > 0) free(orthoMatrixI); - if(rowsbftodetI + colsbftodetI > 0) free(bftodetmatrixI); - if(rowsI + colsbftodetI > 0) free(tmpcsftodet); -} - -#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" -#define BYTE_TO_BINARY(byte) \ - (byte & 0x80 ? '1' : '0'), \ - (byte & 0x40 ? '1' : '0'), \ - (byte & 0x20 ? '1' : '0'), \ - (byte & 0x10 ? '1' : '0'), \ - (byte & 0x08 ? '1' : '0'), \ - (byte & 0x04 ? '1' : '0'), \ - (byte & 0x02 ? '1' : '0'), \ - (byte & 0x01 ? '1' : '0') - -int applyRemoveShftAddSOMOVMO(int idet, int p, int q, int *phase){ - // CSF: 1 1 1 1 0 1 - // DET: 1 0 1 0 1 - // | | - // p q - // p = 4 - // q = 1 - // - // result - // - // CSF: 1 0 1 1 1 1 - // DET: 1 1 0 0 1 - // maskp: - // 0 1 1 1 1 - // maskq: - // 0 0 0 0 1 - // maskpxq: - // 0 1 1 1 0 - // maskqxqi: - // 1 0 0 0 1 - int maskp = (1UL << p)-1; - int maskq = (1UL << q)-1; - int maskpxq = (maskp ^ maskq); - int maskpxqi = ~(maskp ^ maskq); - - // Step 1: remove - // clear bits from p - int outdet = idet; - int occatp = __builtin_popcount(idet & (1UL << (p-1))); - // remove the bit at p - outdet &= ~(1UL << (p-1)); - - // Step 2: shift - if(q > p){ - // start with q - - // calculate the phase - int na, nb; - int tmpdet = outdet & (maskpxq); - na = __builtin_popcount(tmpdet); - nb = __builtin_popcount(maskpxq) - na; - //int nfermions = occatp == 0 ? nb : na; - int nfermions = na+nb; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - - int tmpdetq1 = outdet & maskpxq; - int tmpdetq2 = outdet & maskpxqi; - tmpdetq1 = tmpdetq1 >> 1; - outdet = tmpdetq1 | tmpdetq2; - // put electron at q - outdet = occatp == 0 ? outdet : outdet | (1UL<<(q-1)); - } - else{ - // shift bit to right - maskpxq = maskpxq >> 1; - maskpxqi = ~(maskpxq); - - // calculate the phase - int na, nb; - int tmpdet = outdet & (maskpxq); - na = __builtin_popcount(tmpdet); - nb = __builtin_popcount(maskpxq) - na; - //int nfermions = occatp == 0 ? nb : na; - int nfermions = na+nb; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - - // start with p - // shift middle electrons to right - int tmpdetp1 = outdet & maskpxq; - int tmpdetp2 = outdet & maskpxqi; - tmpdetp1 = tmpdetp1 << 1; - outdet = tmpdetp1 | tmpdetp2; - // put electron at q - outdet = occatp == 0 ? outdet : outdet | (1UL<<(q-1)); - } - - // Done - return(outdet); -} - -int applyRemoveShftAddDOMOSOMO(int idet, int p, int q, int *phase){ - // CSF: 1 2 1 1 1 1 1 1 1 1 - // DET: 1 0 0 1 1 0 0 1 0 - // | | - // p q - // - // result - // - // CSF: 1 1 1 1 1 1 2 1 1 1 - // DET: 1 0 0 0 1 1 0 1 0 - // maskp: - // 0 1 1 1 1 1 1 1 1 - // maskq: - // 0 0 0 0 0 0 1 1 1 1 - int maskp = (1UL << p)-1; - int maskq = (1UL << q)-1; - int maskpxq = (maskp ^ maskq); - int maskpxqi = ~(maskp ^ maskq); - - // Step 1: remove - // clear bits from q - int outdet = idet; - int occatq = __builtin_popcount(idet & (1UL << (q-1))); - outdet &= ~(1UL << (q-1)); - - // Step 2: shift - if(q > p){ - // start with q - - // shift mask between p and q - maskpxq = maskpxq >> 1; - maskpxqi = ~(maskpxq); - // calculate the phase - int na, nb; - int tmpdet = outdet & (maskpxq); - na = __builtin_popcount(tmpdet); - nb = __builtin_popcount(maskpxq) - na; - // spin obb to that at q is moving - //int nfermions = occatq == 0 ? na : nb; - int nfermions = na + nb + 1; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - - int tmpdetq1 = outdet & maskpxq; - int tmpdetq2 = outdet & maskpxqi; - tmpdetq1 = tmpdetq1 << 1; - outdet = tmpdetq1 | tmpdetq2; - - // Step 3: Add bit at p + 1 - outdet = occatq == 1 ? outdet | (1UL<<(p-1)) : outdet; - } - else{ - - // calculate the phase - int na, nb; - int tmpdet = outdet & (maskpxq); - na = __builtin_popcount(tmpdet); - nb = __builtin_popcount(maskpxq) - na; - // spin obb to that at q is moving - //int nfermions = occatq == 0 ? na : nb; - int nfermions = na + nb + 1; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - - // start with p - // shift middle electrons to right - int tmpdetp1 = outdet & maskpxq; - int tmpdetp2 = outdet & maskpxqi; - tmpdetp1 = tmpdetp1 >> 1; - outdet = tmpdetp1 | tmpdetp2; - - // Step 3: Add bit at p - outdet = occatq == 1 ? outdet | (1UL<<(p-1)) : outdet; - } - - // Done - return(outdet); -} - -int applyRemoveShftSOMOSOMO(int idet, int p, int q, int *phase){ - // CSF: 1 1 1 1 1 1 1 1 1 1 - // DET: 1 1 0 0 1 1 0 0 1 0 - // | | - // p q - // - // result - // - // CSF: 1 1 1 1 1 1 1 1 - // DET: 1 0 0 1 1 0 1 0 - // maskp: - // 0 1 1 1 1 1 1 1 1 1 - // maskq: - // 0 0 0 0 0 0 0 1 1 1 - int maskp = (1UL << p)-1; - int maskq = (1UL << q)-1; - int maskpi =~maskp; - int maskqi =~maskq; - - // Step 1: remove - // clear bits from p and q - int outdet = idet; - outdet &= ~(1UL << (p-1)); - outdet &= ~(1UL << (q-1)); - - // calculate the phase - int occatp = idet & (1UL << (p-1)); - int na, nb; - int tmpdet = outdet & (maskp ^ maskq); - na = __builtin_popcount(tmpdet); - nb = abs(p-q)-1 - na; - //int nfermions = occatp == 0 ? nb : na; - - // Step 2: shift - if(q > p){ - int nfermions = occatp == 0 ? na+nb : na+nb+1; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - // start with q - // shift everything left of q - int tmpdetq1 = outdet & maskq; - int tmpdetq2 = outdet & maskqi; - tmpdetq2 = tmpdetq2 >> 1; - outdet = tmpdetq1 | tmpdetq2; - - // shift everything left of p - int tmpdetp1 = outdet & maskp; - int tmpdetp2 = outdet & maskpi; - tmpdetp2 = tmpdetp2 >> 1; - outdet = tmpdetp1 | tmpdetp2; - } - else{ - int nfermions = occatp == 0 ? na+nb+1 : na+nb; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - // start with p - // shift everything left of p - int tmpdetp1 = outdet & maskp; - int tmpdetp2 = outdet & maskpi; - tmpdetp2 = tmpdetp2 >> 1; - outdet = tmpdetp1 | tmpdetp2; - - // shift everything left of q - int tmpdetq1 = outdet & maskq; - int tmpdetq2 = outdet & maskqi; - tmpdetq2 = tmpdetq2 >> 1; - outdet = tmpdetq1 | tmpdetq2; - } - - // Done - return(outdet); -} - -unsigned int shftbit(int num, int p){ - unsigned int maskleft = ~(0 | ((1<> 1; - return(numleft | numright); -}; - -int getphase(int num, int p, int q, int nmo){ - // CSF: 1 1 1 1 1 1 1 1 1 1 - // DET: 1 1 0 0 1 1 0 0 1 0 - // | | - // p q - // | | - // CSF: 1 1 1 1 1 1 1 1 1 1 - // DET: 1 0 0 0 1 1 1 0 1 0 - // - // maskleft: - // 1 1 1 1 1 1 1 0 0 0 - // maskright: - // 0 1 1 1 1 1 1 1 1 1 - int omax = p > q ? p : q; - int omin = p > q ? q : p; - unsigned int maskleft = ~(0 | ((1<<(omin-1))-1)); - unsigned int maskright = ((1<<(omax))-1); - unsigned int maskmo = ((1<SOMO example - - 1 2 1 1 1 - p q - 1 1 1 1 2 - - p = 3 - q = 1 - - in determinant representation: (0->beta,1->alpha) - |I> = 0 0 1 1 - |____| - p q - - |ret> = 0 1 0 1 - A shift of bit at q to pos after p. - - */ - - int maskq = ~((1UL<> 1; - // Now combine with original det - int detout = (idet & maskpq); - // Zero out bits at q - detout &= ~(1UL << (q-1)); - // Set the bit at p - detout |= (1UL << (p-1)); - // Add the shifted bits - detout |= shifted_bits; - - // Now calcaulate the phase - // Find the type of bit at q - int occatq = idet & (1UL << (q-1)); - // calculate number of alpha and beta spins - int na = __builtin_popcount(shifted_bits); - int nb = p - q - na; - // Find the number of fermions to pass - int nfermions = occatq == 0 ? na : nb; - (*phase) = nfermions % 2 == 0 ? 1 : -1; - return(detout); -} - -void calcMEdetpair(int *detlistI, int *detlistJ, int orbI, int orbJ, int Isomo, int Jsomo, int ndetI, int ndetJ, int NMO, double *matelemdetbasis){ - - // Calculation of phase - // The following convention is used - // - // - // The phase is calculated - // assuming all alpha electrons - // are on the left and all beta - // electrons are on the RHS - // of the alphas. - - - int maskI; - int nelecatI; - unsigned int maskleft; - unsigned int maskright; - unsigned int psomo; - unsigned int qsomo; - - - // E(q,p) |I> = cqp |J> - - - int p,q; // The two orbitals p is always > q. - p = orbI >= orbJ ? orbI : orbJ; - q = orbI >= orbJ ? orbJ : orbI; - - // Find the corresponding case - // 1. NdetI > NdetJ (SOMO -> SOMO) - // 2. NdetI < NdetJ (DOMO -> VMO) - // 3. NdetI == NdetJ (SOMO -> VMO and DOMO -> SOMO) - - // Converting the above four cases into int: - int case_type = abs(ndetI - ndetJ) == 0 ? 3 : (ndetI > ndetJ ? 1 : 2); - - switch (case_type){ - case 1: - // SOMO -> SOMO - // Find the orbital ids in model space - maskleft = (0 | ((1<<(p))-1)); - maskright = (0 | ((1<<(q))-1)); - psomo = __builtin_popcount(Isomo & maskleft); - qsomo = q == 1 ? 1 : __builtin_popcount(Isomo & maskright); - p = psomo >= qsomo ? psomo : qsomo; - q = psomo >= qsomo ? qsomo : psomo; - - for(int i=0;i VMO - // Find the orbital ids in model space - maskleft = (0 | ((1<<(p))-1)); - maskright =(0 | ((1<<(q))-1)); - psomo = __builtin_popcount(Jsomo & maskleft); - qsomo = q == 1 ? 1 : __builtin_popcount(Jsomo & maskright); - p = psomo >= qsomo ? psomo : qsomo; - q = psomo >= qsomo ? qsomo : psomo; - - for(int i=0;i VMO or DOMO -> SOMO) - // if Isomo[p] == 1 => SOMO -> VMO - // if Isomo[p] == 0 => DOMO -> SOMO - // Find the orbital ids in model space - maskleft = ((1<<(p))-1); - maskright =((1<<(q))-1); - psomo = __builtin_popcount(Isomo & maskleft); - //qsomo = q == 1 ? 1 : __builtin_popcount(Isomo & maskright); - qsomo = __builtin_popcount(Isomo & maskright); - p = psomo >= qsomo ? psomo : qsomo; - q = psomo >= qsomo ? qsomo : psomo; - - - int noccorbI = (Isomo & (1<<(orbI-1))); - switch (noccorbI){ - case 0: - // Case: DOMO -> SOMO - break; - case 1: - // Case: SOMO -> VMO - break; - default: - printf("Something is wrong in calcMEdetpair\n"); - break; - } - - int tmpidet; - - for(int i=0;i SOMO - // - // I = - // 2 1 1 1 1 - // (10) 0 0 1 1 - // - // | - // \ / - // . - // 0 0 0 1 1 - // - // J = - // 1 1 1 1 2 - // 0 0 1 1 (10) - // - if(nelecalphaatp == 0){ - // Case: DOMO -> SOMO - tmpidet = idet; - int nelecalphaatq = (idet & (1<<(orbJ-1))); - if(nelecalphaatq==0) tmpidet = tmpidet ^ (1<<(orbI-1)); - else tmpidet = tmpidet ^ (0); - idet = shftbit(idet,q); - } - else{ - tmpidet = idet; - idet = shftbit(idet,p); - } - - // Calculate phase - int phase = 1*getphase(tmpidet,orbI,orbJ,NMO); - for(int j=0;j - // - // The phase is calculated - // assuming all alpha electrons - // are on the left and all beta - // electrons are on the RHS - // of the alphas. - - // There are three possibilities - // which need to be separated - // CASE 1. p > q - // CASE 2. p < q - // CASE 3. p == q - - int maskI; - int nelecatI; - int noccorbI; - double phaseI=1.0; - double phaseJ=1.0; - unsigned int maskleft; - unsigned int maskright; - unsigned int psomo; - unsigned int qsomo; - - int p,q; // The two orbitals p is always > q. - - if(orbI > orbJ){ - // CASE 1 : orbI > orbJ - p = orbI; - q = orbJ; - - // Find the corresponding sub case - // 1. NdetI > NdetJ (SOMO -> SOMO) - // 2. NdetI < NdetJ (DOMO -> VMO) - // 3. NdetI == NdetJ (SOMO -> VMO and DOMO -> SOMO) - - // Converting the above four cases into int: - int case_type = abs(ndetI - ndetJ) == 0 ? 3 : (ndetI > ndetJ ? 1 : 2); - p = orbI; - q = orbJ; - - switch (case_type){ - case 1: - // SOMO -> SOMO - // Find the orbital ids in model space - maskleft = (0 | ((1<<(p))-1)); - maskright = (0 | ((1<<(q))-1)); - psomo = __builtin_popcount(Isomo & maskleft); - qsomo = __builtin_popcount(Isomo & maskright); // q has to be atleast 1 - p = psomo; - q = qsomo; - - for(int i=0;i VMO - // Find the orbital ids in model space - // As seen in Jsomo - // Here we apply a^{\dagger}_p a_q |J> - maskleft = (0 | ((1<<(p))-1)); - maskright =(0 | ((1<<(q))-1)); - psomo = __builtin_popcount(Jsomo & maskleft); - qsomo = __builtin_popcount(Jsomo & maskright); // q has to be atleast 1 - p = psomo; - q = qsomo; - - for(int i=0;i VMO or DOMO -> SOMO) - noccorbI = __builtin_popcount(Isomo & (1<<(orbI-1))); - - switch (noccorbI){ - case 0: - // Case: DOMO -> SOMO - // Find the orbital ids in model space - // Ex: - // 2 1 1 1 1 - // p q - // 1 1 1 2 1 - // p = 4 - // q = 2 - // p is from Jsomo - // q is from Isomo - maskleft = ((1<<(p))-1); - maskright =((1<<(q))-1); - psomo = __builtin_popcount(Jsomo & maskleft); - qsomo = __builtin_popcount(Isomo & maskright); - p = psomo; - q = qsomo; - - for(int i=0;i VMO - // Find the orbital ids in model space - // Ex: - // 1 1 1 0 1 - // p q - // 0 1 1 1 1 - // p = 4 - // q = 1 - // p is from Isomo - // q is from Jsomo - maskleft = ((1<<(p))-1); - maskright =((1<<(q))-1); - psomo = __builtin_popcount(Isomo & maskleft); - qsomo = __builtin_popcount(Jsomo & maskright); - p = psomo; - q = qsomo; - - for(int i=0;i orbJ - else if(orbI < orbJ){ - // CASE 2 orbI < orbJ - p = orbI; - q = orbJ; - // Find the corresponding sub case - // 1. NdetI > NdetJ (SOMO -> SOMO) - // 2. NdetI < NdetJ (DOMO -> VMO) - // 3. NdetI == NdetJ (SOMO -> VMO and DOMO -> SOMO) - - // Converting the above four cases into int: - int case_type = abs(ndetI - ndetJ) == 0 ? 3 : (ndetI > ndetJ ? 1 : 2); - - switch (case_type){ - case 1: - // SOMO -> SOMO - // Find the orbital ids in model space - maskleft = (0 | ((1<<(p))-1)); - maskright = (0 | ((1<<(q))-1)); - psomo = __builtin_popcount(Isomo & maskleft); - qsomo = __builtin_popcount(Isomo & maskright); // q has to be atleast 1 - p = psomo; - q = qsomo; - - for(int i=0;i VMO - // Find the orbital ids in model space - // As seen in Jsomo - // Here we apply a^{\dagger}_p a_q |J> - maskleft = (0 | ((1<<(p))-1)); - maskright =(0 | ((1<<(q))-1)); - psomo = __builtin_popcount(Jsomo & maskleft); - qsomo = __builtin_popcount(Jsomo & maskright); // q has to be atleast 1 - p = psomo; - q = qsomo; - - for(int i=0;i VMO or DOMO -> SOMO) - // if Isomo[p] == 1 => SOMO -> VMO - // if Isomo[p] == 0 => DOMO -> SOMO - noccorbI = __builtin_popcount(Isomo & (1<<(orbI-1))); - - switch (noccorbI){ - case 0: - // Case: DOMO -> SOMO - // Find the orbital ids in model space - // Ex: - // 1 1 1 2 1 - // q p - // 2 1 1 1 1 - // p = 1 - // q = 4 - // p is from Jsomo - // q is from Isomo - maskleft = ((1<<(p))-1); - maskright =((1<<(q))-1); - psomo = __builtin_popcount(Jsomo & maskleft); - qsomo = __builtin_popcount(Isomo & maskright); - p = psomo; - q = qsomo; - - for(int i=0;i VMO - // Find the orbital ids in model space - // Ex: - // 0 1 1 1 1 - // q p - // 1 1 1 0 1 - // p = 2 - // q = 4 - // p is from Isomo - // q is from Jsomo - maskleft = ((1<<(p))-1); - maskright =((1<<(q))-1); - psomo = __builtin_popcount(Isomo & maskleft); - qsomo = __builtin_popcount(Jsomo & maskright); - p = psomo; - q = qsomo; - - for(int i=0;i 0.0 || donepq[idxq] > 0.0) continue; - fac *= 2.0; - donepq[idxp] = 1.0; - donepq[idxq] = 1.0; - for(int j = 0; j < npairs; j = j + shft){ - for(int k = 0; k < shft/2; k++){ - detslist[(k+j)*NSOMO + idxp] = 1; - detslist[(k+j)*NSOMO + idxq] = 0; - } - for(int k = shft/2; k < shft; k++){ - detslist[(k+j)*NSOMO + idxp] = 0; - detslist[(k+j)*NSOMO + idxq] = 1; - phaselist[k+j] *=-1; - } - } - shft /= 2; - } - - // Now get the addresses - int inpdet[NSOMO]; - int phase_cfg_to_qp=1; - int addr = -1; - for(int i = 0; i < npairs; i++){ - for(int j = 0; j < NSOMO; j++) - inpdet[j] = detslist[i*NSOMO + j]; - findAddofDetDriver(dettree, NSOMO, inpdet, &addr); - // Calculate the phase for cfg to QP2 conversion - //get_phase_cfg_to_qp_inpList(inpdet, NSOMO, &phase_cfg_to_qp); - //rowvec[addr] = 1.0 * phaselist[i]*phase_cfg_to_qp/sqrt(fac); - rowvec[addr] = 1.0 * phaselist[i]/sqrt(fac); - // Upon transformation from - // SOMO to DET basis, - // all dets have the same phase - // Is this true ? - //rowvec[addr] = 1.0/sqrt(fac); - } - - free(detslist); - free(phaselist); -} - -void convertBFtoDetBasis(int64_t Isomo, int MS, double **bftodetmatrixptr, int *rows, int *cols){ - - int NSOMO=0; - getSetBits(Isomo, &NSOMO); - int ndets = 0; - int NBF = 0; - double dNSOMO = NSOMO*1.0; - double nalpha = (NSOMO + MS)/2.0; - ndets = (int)binom(dNSOMO, nalpha); - - Tree dettree = (Tree){ .rootNode = NULL, .NBF = -1 }; - dettree.rootNode = malloc(sizeof(Node)); - (*dettree.rootNode) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = NULL, .addr = 0, .cpl = -1, .iSOMO = -1}; - - genDetBasis(&dettree, Isomo, MS, &ndets); - - if(ndets == 1){ - // Initialize transformation matrix - NBF = 1; - (*bftodetmatrixptr) = malloc(NBF*ndets*sizeof(double)); - (*rows) = 1; - (*cols) = 1; - - double *bftodetmatrix = (*bftodetmatrixptr); - bftodetmatrix[0] = 1.0; - - } - else{ - - //int addr = -1; - //int inpdet[NSOMO]; - //inpdet[0] = 1; - //inpdet[1] = 1; - //inpdet[2] = 1; - //inpdet[3] = 0; - //inpdet[4] = 0; - //inpdet[5] = 0; - - //findAddofDetDriver(&dettree, NSOMO, inpdet, &addr); - - int detlist[ndets]; - getDetlistDriver(&dettree, NSOMO, detlist); - - // Prepare BFs - Tree bftree = (Tree){ .rootNode = NULL, .NBF = -1 }; - bftree.rootNode = malloc(sizeof(Node)); - (*bftree.rootNode) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = NULL, .addr = 0, .cpl = -1, .iSOMO = -1}; - - generateAllBFs(Isomo, MS, &bftree, &NBF, &NSOMO); - - // Initialize transformation matrix - (*bftodetmatrixptr) = malloc(NBF*ndets*sizeof(double)); - (*rows) = NBF; - (*cols) = ndets; - - double *bftodetmatrix = (*bftodetmatrixptr); - - // Build BF to det matrix - int addI = 0; - int addJ = 0; - double rowvec[ndets]; - for(int i=0;i 1 - -} - - -void convertBFtoDetBasisWithArrayDims(int64_t Isomo, int MS, int rowsmax, int colsmax, int *rows, int *cols, double *bftodetmatrix){ - - int NSOMO=0; - getSetBits(Isomo, &NSOMO); - int ndets = 0; - int NBF = 0; - double dNSOMO = NSOMO*1.0; - double nalpha = (NSOMO + MS)/2.0; - ndets = (int)binom(dNSOMO, nalpha); - - Tree dettree = (Tree){ .rootNode = NULL, .NBF = -1 }; - dettree.rootNode = malloc(sizeof(Node)); - (*dettree.rootNode) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = NULL, .addr = 0, .cpl = -1, .iSOMO = -1}; - - genDetBasis(&dettree, Isomo, MS, &ndets); - - //int addr = -1; - //int inpdet[NSOMO]; - //inpdet[0] = 1; - //inpdet[1] = 1; - //inpdet[2] = 1; - //inpdet[3] = 0; - //inpdet[4] = 0; - //inpdet[5] = 0; - - //findAddofDetDriver(&dettree, NSOMO, inpdet, &addr); - - int detlist[ndets]; - getDetlistDriver(&dettree, NSOMO, detlist); - - // Prepare BFs - Tree bftree = (Tree){ .rootNode = NULL, .NBF = -1 }; - bftree.rootNode = malloc(sizeof(Node)); - (*bftree.rootNode) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = NULL, .addr = 0, .cpl = -1, .iSOMO = -1}; - - generateAllBFs(Isomo, MS, &bftree, &NBF, &NSOMO); - - // Initialize transformation matrix - //(*bftodetmatrixptr) = malloc(NBF*ndets*sizeof(double)); - (*rows) = NBF; - (*cols) = ndets; - - //double *bftodetmatrix = (*bftodetmatrixptr); - - // Build BF to det matrix - int addI = 0; - int addJ = 0; - double rowvec[ndets]; - for(int i=0;i SOMO - ! Type 2 - DOMO -> VMO - ! Type 3 - SOMO -> VMO - ! Type 4 - DOMO -> SOMO - END_DOC - integer(bit_kind),intent(in) :: Ialpha(N_int,2) - integer(bit_kind),intent(in) :: Jcfg(N_int,2) - integer,intent(in) :: p,q - integer,intent(in) :: extype - integer,intent(out) :: pmodel,qmodel - integer*8 :: Isomo - integer*8 :: Idomo - integer*8 :: Jsomo - integer*8 :: Jdomo - integer*8 :: mask - integer*8 :: Isomotmp - integer*8 :: Jsomotmp - integer :: pos0,pos0prev - - ! TODO Flag (print) when model space indices is > 64 - Isomo = Ialpha(1,1) - Idomo = Ialpha(1,2) - Jsomo = Jcfg(1,1) - Jdomo = Jcfg(1,2) - pos0prev = 0 - pmodel = p - qmodel = q - - if(p .EQ. q) then - pmodel = 1 - qmodel = 1 - else - !print *,"input pq=",p,q,"extype=",extype - !call debug_spindet(Isomo,1) - !call debug_spindet(Idomo,1) - !call debug_spindet(Jsomo,1) - !call debug_spindet(Jdomo,1) - select case(extype) - case (1) - ! SOMO -> SOMO - ! remove all domos - !print *,"type -> SOMO -> SOMO" - mask = ISHFT(1_8,p) - 1 - Isomotmp = IAND(Isomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Isomotmp,mask)) - mask = ISHFT(1_8,q) - 1 - Isomotmp = IAND(Isomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Isomotmp,mask)) - case (2) - ! DOMO -> VMO - ! remove all domos except one at p - !print *,"type -> DOMO -> VMO" - mask = ISHFT(1_8,p) - 1 - Jsomotmp = IAND(Jsomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Jsomotmp,mask)) - mask = ISHFT(1_8,q) - 1 - Jsomotmp = IAND(Jsomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Jsomotmp,mask)) - case (3) - ! SOMO -> VMO - !print *,"type -> SOMO -> VMO" - !Isomo = IEOR(Isomo,Jsomo) - mask = ISHFT(1_8,p) - 1 - Isomo = IAND(Isomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Isomo,mask)) - mask = ISHFT(1_8,q) - 1 - Jsomo = IAND(Jsomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Jsomo,mask)) - case (4) - ! DOMO -> SOMO - ! remove all domos except one at p - !print *,"type -> DOMO -> SOMO" - !Isomo = IEOR(Isomo,Jsomo) - mask = ISHFT(1_8,p) - 1 - Jsomo = IAND(Jsomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Jsomo,mask)) - mask = ISHFT(1_8,q) - 1 - Isomo = IAND(Isomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Isomo,mask)) - case default - print *,"something is wrong in convertOrbIdsToModelSpaceIds" - end select - endif - !print *,p,q,"model ids=",pmodel,qmodel -end subroutine convertOrbIdsToModelSpaceIds diff --git a/src/csf/configuration_CI_sigma_helpers.org b/src/csf/configuration_CI_sigma_helpers.org deleted file mode 100644 index ede42b97..00000000 --- a/src/csf/configuration_CI_sigma_helpers.org +++ /dev/null @@ -1,562 +0,0 @@ -#+title: Configuration Sigma Vector Helpers -#+author: Vijay Gopal Chilkuri -#+email: vijay.gopal.c@gmail.com - -* Generate the singly excited configurations on-the-fly - -The algorithm is based on the work by Garniron et. al. (see thesis Chap 5). -The basic idea is to generate \(|\alpha\rangle\)'s on-the-fly. - -The algorithm is based on the idea of splitting the list of \(|\alpha\rangle\)'s -into blocks associated with a selected determinant \(|D_I\rangle\). - -** Create a function to return a list of alphas - -Here we create a list of \(|\alpha\rangle\)'s associated with -the input determinant \(|D_I\rangle\). - -#+begin_src f90 :main no :tangle configuration_CI_sigma_helpers.irp.f - subroutine obtain_associated_alphaI(idxI, Icfg, alphasIcfg, NalphaIcfg, factor_alphaI) - implicit none - use bitmasks - BEGIN_DOC - ! Documentation for alphasI - ! Returns the associated alpha's for - ! the input configuration Icfg. - END_DOC - - integer,intent(in) :: idxI ! The id of the Ith CFG - integer(bit_kind),intent(in) :: Icfg(N_int,2) - integer,intent(out) :: NalphaIcfg - real*8 ,intent(out) :: factor_alphaI(*) - integer(bit_kind),intent(out) :: alphasIcfg(N_int,2,*) - logical,dimension(:,:),allocatable :: tableUniqueAlphas - integer :: listholes(mo_num) - integer :: holetype(mo_num) ! 1-> SOMO 2->DOMO - integer :: nholes - integer :: nvmos - integer :: listvmos(mo_num) - integer :: vmotype(mo_num) ! 1 -> VMO 2 -> SOMO - integer*8 :: Idomo - integer*8 :: Isomo - integer*8 :: Jdomo - integer*8 :: Jsomo - integer*8 :: diffSOMO - integer*8 :: diffDOMO - integer :: ndiffSOMO - integer :: ndiffDOMO - integer :: ndiffAll - integer :: i - integer :: j - integer :: k - integer :: hole - integer :: p - integer :: q - integer :: countalphas - logical :: pqAlreadyGenQ - logical :: pqExistsQ - Isomo = iand(reunion_of_act_virt_bitmask(1,1),Icfg(1,1)) - Idomo = iand(reunion_of_act_virt_bitmask(1,1),Icfg(1,2)) - !print*,"Input cfg" - !call debug_spindet(Isomo,1) - !call debug_spindet(Idomo,1) - - !print*,n_act_orb, "monum=",mo_num," n_core=",n_core_orb - - ! find out all pq holes possible - nholes = 0 - ! holes in SOMO - do i = n_core_orb+1,n_core_orb + n_act_orb - if(POPCNT(IAND(Isomo,IBSET(0_8,i-1))) .EQ. 1) then - nholes += 1 - listholes(nholes) = i - holetype(nholes) = 1 - endif - end do - ! holes in DOMO - do i = n_core_orb+1,n_core_orb + n_act_orb - if(POPCNT(IAND(Idomo,IBSET(0_8,i-1))) .EQ. 1) then - nholes += 1 - listholes(nholes) = i - holetype(nholes) = 2 - endif - end do - - ! find vmos - listvmos = -1 - vmotype = -1 - nvmos = 0 - do i = n_core_orb+1,n_core_orb + n_act_orb - !print *,i,IBSET(0,i-1),POPCNT(IAND(Isomo,(IBSET(0_8,i-1)))), POPCNT(IAND(Idomo,(IBSET(0_8,i-1)))) - if(POPCNT(IAND(Isomo,(IBSET(0_8,i-1)))) .EQ. 0 .AND. POPCNT(IAND(Idomo,(IBSET(0_8,i-1)))) .EQ. 0) then - nvmos += 1 - listvmos(nvmos) = i - vmotype(nvmos) = 1 - else if(POPCNT(IAND(Isomo,(IBSET(0_8,i-1)))) .EQ. 1 .AND. POPCNT(IAND(Idomo,(IBSET(0_8,i-1)))) .EQ. 0 ) then - nvmos += 1 - listvmos(nvmos) = i - vmotype(nvmos) = 2 - end if - end do - - !print *,"Nvmo=",nvmos - !print *,listvmos - !print *,vmotype - - allocate(tableUniqueAlphas(mo_num,mo_num)) - tableUniqueAlphas = .FALSE. - - ! Now find the allowed (p,q) excitations - Isomo = iand(reunion_of_act_virt_bitmask(1,1),Icfg(1,1)) - Idomo = iand(reunion_of_act_virt_bitmask(1,1),Icfg(1,2)) - !print *,"Isomo" - !call debug_spindet(Isomo,1) - !call debug_spindet(Idomo,1) - - !print *,"Nholes=",nholes," Nvmos=",nvmos, " idxi=",idxI - !do i = 1,nholes - ! print *,i,"->",listholes(i) - !enddo - !do i = 1,nvmos - ! print *,i,"->",listvmos(i) - !enddo - - ! TODO cfg_seniority_index - do i = 1,nholes - p = listholes(i) - do j = 1,nvmos - q = listvmos(j) - if(p == q) cycle - if(holetype(i) .EQ. 1 .AND. vmotype(j) .EQ. 1) then - ! SOMO -> VMO - Jsomo = IBCLR(Isomo,p-1) - Jsomo = IBSET(Jsomo,q-1) - Jdomo = Idomo - else if(holetype(i) .EQ. 1 .AND. vmotype(j) .EQ. 2) then - ! SOMO -> SOMO - Jsomo = IBCLR(Isomo,p-1) - Jsomo = IBCLR(Jsomo,q-1) - Jdomo = IBSET(Idomo,q-1) - else if(holetype(i) .EQ. 2 .AND. vmotype(j) .EQ. 1) then - ! DOMO -> VMO - Jsomo = IBSET(Isomo,p-1) - Jsomo = IBSET(Jsomo,q-1) - Jdomo = IBCLR(Idomo,p-1) - else if(holetype(i) .EQ. 2 .AND. vmotype(j) .EQ. 2) then - ! DOMO -> SOMO - Jsomo = IBSET(Isomo,p-1) - Jsomo = IBCLR(Jsomo,q-1) - Jdomo = IBCLR(Idomo,p-1) - Jdomo = IBSET(Jdomo,q-1) - else - print*,"Something went wrong in obtain_associated_alphaI" - endif - - - pqAlreadyGenQ = .FALSE. - ! First check if it can be generated before - do k = 1, idxI-1 - diffSOMO = IEOR(Jsomo,iand(reunion_of_act_virt_bitmask(1,1),psi_configuration(1,1,k))) - diffDOMO = IEOR(Jdomo,iand(reunion_of_act_virt_bitmask(1,1),psi_configuration(1,2,k))) - ndiffSOMO = POPCNT(diffSOMO) - ndiffDOMO = POPCNT(diffDOMO) - if(POPCNT(IEOR(diffSOMO,diffDOMO)) .LE. 1 .AND. ndiffDOMO .LT. 3) then - pqAlreadyGenQ = .TRUE. - !print *,i,k,ndiffSOMO,ndiffDOMO - !call debug_spindet(Jsomo,1) - !call debug_spindet(Jdomo,1) - !call debug_spindet(iand(reunion_of_act_virt_bitmask(1,1),psi_configuration(1,1,k)),1) - !call debug_spindet(iand(reunion_of_act_virt_bitmask(1,1),psi_configuration(1,2,k)),1) - EXIT - endif - end do - - if(pqAlreadyGenQ) cycle - - pqExistsQ = .FALSE. - ! now check if this exists in the selected list - do k = idxI, N_configuration - diffSOMO = IEOR(OR(reunion_of_act_virt_bitmask(1,1),Jsomo),psi_configuration(1,1,k)) - diffDOMO = IEOR(OR(reunion_of_act_virt_bitmask(1,1),Jdomo),psi_configuration(1,2,k)) - ndiffSOMO = POPCNT(diffSOMO) - ndiffDOMO = POPCNT(diffDOMO) - if((ndiffSOMO + ndiffDOMO) .EQ. 0) then - pqExistsQ = .TRUE. - EXIT - endif - end do - - if(.NOT. pqExistsQ) then - tableUniqueAlphas(p,q) = .TRUE. - !print *,p,q - !call debug_spindet(Jsomo,1) - !call debug_spindet(Jdomo,1) - endif - end do - end do - - !print *,tableUniqueAlphas(:,:) - - ! prune list of alphas - Isomo = Icfg(1,1) - Idomo = Icfg(1,2) - Jsomo = Icfg(1,1) - Jdomo = Icfg(1,2) - NalphaIcfg = 0 - do i = 1, nholes - p = listholes(i) - do j = 1, nvmos - q = listvmos(j) - if(p .EQ. q) cycle - if(tableUniqueAlphas(p,q)) then - if(holetype(i) .EQ. 1 .AND. vmotype(j) .EQ. 1) then - ! SOMO -> VMO - Jsomo = IBCLR(Isomo,p-1) - Jsomo = IBSET(Jsomo,q-1) - Jdomo = Idomo - else if(holetype(i) .EQ. 1 .AND. vmotype(j) .EQ. 2) then - ! SOMO -> SOMO - Jsomo = IBCLR(Isomo,p-1) - Jsomo = IBCLR(Jsomo,q-1) - Jdomo = IBSET(Idomo,q-1) - else if(holetype(i) .EQ. 2 .AND. vmotype(j) .EQ. 1) then - ! DOMO -> VMO - Jsomo = IBSET(Isomo,p-1) - Jsomo = IBSET(Jsomo,q-1) - Jdomo = IBCLR(Idomo,p-1) - else if(holetype(i) .EQ. 2 .AND. vmotype(j) .EQ. 2) then - ! DOMO -> SOMO - Jsomo = IBSET(Isomo,p-1) - Jsomo = IBCLR(Jsomo,q-1) - Jdomo = IBCLR(Idomo,p-1) - Jdomo = IBSET(Jdomo,q-1) - else - print*,"Something went wrong in obtain_associated_alphaI" - endif - - NalphaIcfg += 1 - !print *,p,q,"|",holetype(i),vmotype(j),NalphaIcfg - !call debug_spindet(Idomo,1) - !call debug_spindet(Jdomo,1) - alphasIcfg(1,1,NalphaIcfg) = Jsomo - alphasIcfg(1,2,NalphaIcfg) = IOR(Jdomo,ISHFT(1_8,n_core_orb)-1) - endif - end do - end do - - end subroutine -#+end_src - -** Given an \(\alpha\) CFG, return all the \(|I\rangle\) CFGs - -Next step is to obtain the connected CFGs \(|I\rangle\) that belong to the selected space -given a RI configuration \(|\alpha\rangle\). - -#+begin_src f90 :main no :tangle ../cfgCI/obtain_I_foralpha.irp.f -subroutine obtain_connected_I_foralpha(idxI, Ialpha, connectedI, idxs_connectedI, nconnectedI, excitationIds, excitationTypes) - implicit none - use bitmasks - BEGIN_DOC - ! Documentation for obtain_connected_I_foralpha - ! This function returns all those selected configurations - ! which are connected to the input configuration - ! Ialpha by a single excitation. - ! - ! The type of excitations are ordered as follows: - ! Type 1 - SOMO -> SOMO - ! Type 2 - DOMO -> VMO - ! Type 3 - SOMO -> VMO - ! Type 4 - DOMO -> SOMO - ! - ! Order of operators - ! \alpha> = a^\dag_p a_q |I> = E_pq |I> - END_DOC - integer ,intent(in) :: idxI - integer(bit_kind),intent(in) :: Ialpha(N_int,2) - integer(bit_kind),intent(out) :: connectedI(N_int,2,*) - integer ,intent(out) :: idxs_connectedI(*) - integer,intent(out) :: nconnectedI - integer,intent(out) :: excitationIds(2,*) - integer,intent(out) :: excitationTypes(*) - integer*8 :: Idomo - integer*8 :: Isomo - integer*8 :: Jdomo - integer*8 :: Jsomo - integer*8 :: IJsomo - integer*8 :: diffSOMO - integer*8 :: diffDOMO - integer :: ndiffSOMO - integer :: ndiffDOMO - integer :: i,j,k,l,p,q,nsomoJ,nsomoalpha,starti,endi,extyp,nholes - integer :: listholes(mo_num) - integer :: holetype(mo_num) - - ! find out all pq holes possible - nholes = 0 - ! holes in SOMO - Isomo = psi_configuration(1,1,idxI) - Idomo = psi_configuration(1,2,idxI) - do i = n_core_orb+1,n_core_orb + n_act_orb - if(POPCNT(IAND(Isomo,IBSET(0_8,i-1))) .EQ. 1) then - nholes += 1 - listholes(nholes) = i - holetype(nholes) = 1 - endif - end do - ! holes in DOMO - do i = n_core_orb+1,n_core_orb + n_act_orb - if(POPCNT(IAND(Idomo,IBSET(0_8,i-1))) .EQ. 1) then - nholes += 1 - listholes(nholes) = i - holetype(nholes) = 2 - endif - end do - - nconnectedI = 0 - - p = 0 - q = 0 - do i=idxI+1,N_configuration - Isomo = Ialpha(1,1) - Idomo = Ialpha(1,2) - Jsomo = psi_configuration(1,1,i) - Jdomo = psi_configuration(1,2,i) - !call debug_spindet(Isomo,1) - !call debug_spindet(Idomo,1) - !print *,"-J--i=",i,Idomo,Jdomo,">",N_configuration - !call debug_spindet(Jsomo,1) - !call debug_spindet(Jdomo,1) - diffSOMO = IEOR(Isomo,Jsomo) - diffDOMO = IEOR(Idomo,Jdomo) - ndiffSOMO = POPCNT(diffSOMO) - ndiffDOMO = POPCNT(diffDOMO) - if((ndiffSOMO + ndiffDOMO) .EQ. 0) cycle - !print *,"-I--i=",i,diffSOMO,diffDOMO!Isomo,Jsomo,ndiffSOMO,ndiffDOMO - !print *,POPCNT(IEOR(diffSOMO,diffDOMO)), ndiffDOMO - if(POPCNT(IEOR(diffSOMO,diffDOMO)) .LE. 1 .AND. ndiffDOMO .LT. 3) then - !call debug_spindet(Isomo,1) - !call debug_spindet(Idomo,1) - !print *,"-J--i=",i,Idomo,Jdomo,">",N_configuration - !call debug_spindet(Jsomo,1) - !call debug_spindet(Jdomo,1) - select case(ndiffDOMO) - case (0) - ! SOMO -> VMO - !print *,"obt SOMO -> VMO" - extyp = 3 - IJsomo = IEOR(Isomo, Jsomo) - p = TRAILZ(IAND(Isomo,IJsomo)) + 1 - IJsomo = IBCLR(IJsomo,p-1) - q = TRAILZ(IJsomo) + 1 - case (1) - ! DOMO -> VMO - ! or - ! SOMO -> SOMO - nsomoJ = POPCNT(Jsomo) - nsomoalpha = POPCNT(Isomo) - if(nsomoJ .GT. nsomoalpha) then - ! DOMO -> VMO - !print *,"obt DOMO -> VMO" - extyp = 2 - p = TRAILZ(IEOR(Idomo,Jdomo)) + 1 - Isomo = IEOR(Isomo, Jsomo) - Isomo = IBCLR(Isomo,p-1) - q = TRAILZ(Isomo) + 1 - else - ! SOMO -> SOMO - !print *,"obt SOMO -> SOMO" - extyp = 1 - q = TRAILZ(IEOR(Idomo,Jdomo)) + 1 - Isomo = IEOR(Isomo, Jsomo) - Isomo = IBCLR(Isomo,q-1) - p = TRAILZ(Isomo) + 1 - end if - case (2) - ! DOMO -> SOMO - !print *,"obt DOMO -> SOMO" - extyp = 4 - IJsomo = IEOR(Isomo, Jsomo) - p = TRAILZ(IAND(Jsomo,IJsomo)) + 1 - IJsomo = IBCLR(IJsomo,p-1) - q = TRAILZ(IJsomo) + 1 - case default - print *,"something went wront in get connectedI" - end select - starti = psi_config_data(i,1) - endi = psi_config_data(i,2) - nconnectedI += 1 - connectedI(:,:,nconnectedI) = psi_configuration(:,:,i) - idxs_connectedI(nconnectedI)=starti - excitationIds(1,nconnectedI)=p - excitationIds(2,nconnectedI)=q - excitationTypes(nconnectedI) = extyp - print *,"------ > output p,q in obt=",p,q - endif - end do - -end subroutine obtain_connected_I_foralpha -#+end_src - -#+begin_src fortran - print *,TRAILZ(8) - print *,IBCLR(8,TRAILZ(9)) - print *,TRAILZ(IBCLR(8,TRAILZ(9))) - -#+end_src - -#+RESULTS: -| 3 | -| 8 | -| 3 | - -** Function to get the NSOMOs (seniority) - -#+begin_src f90 :main no :tangle configuration_CI_sigma_helpers.irp.f - function getNSOMO(Icfg) result(NSOMO) - implicit none - integer(bit_kind),intent(in) :: Icfg(N_int,2) - integer :: NSOMO - integer :: i - NSOMO = 0 - do i = 1,N_int - NSOMO += POPCNT(Icfg(i,1)) - enddo - end function getNSOMO -#+end_src - -** Function to convert p,q to model space ids - -This function converts the real orbital ids \(i,j\) to model -space ids \(p,q\) which depend only on the number of somos. - -#+begin_src f90 :main no :tangle configuration_CI_sigma_helpers.irp.f -subroutine convertOrbIdsToModelSpaceIds(Ialpha, Jcfg, p, q, extype, pmodel, qmodel) - implicit none - BEGIN_DOC - ! This function converts the orbital ids - ! in real space to those used in model space - ! in order to identify the matrices required - ! for the calculation of MEs. - ! - ! The type of excitations are ordered as follows: - ! Type 1 - SOMO -> SOMO - ! Type 2 - DOMO -> VMO - ! Type 3 - SOMO -> VMO - ! Type 4 - DOMO -> SOMO - END_DOC - integer(bit_kind),intent(in) :: Ialpha(N_int,2) - integer(bit_kind),intent(in) :: Jcfg(N_int,2) - integer,intent(in) :: p,q - integer,intent(in) :: extype - integer,intent(out) :: pmodel,qmodel - integer*8 :: Isomo - integer*8 :: Idomo - integer*8 :: Jsomo - integer*8 :: Jdomo - integer*8 :: mask - integer*8 :: Isomotmp - integer*8 :: Jsomotmp - integer :: pos0,pos0prev - - ! TODO Flag (print) when model space indices is > 64 - Isomo = Ialpha(1,1) - Idomo = Ialpha(1,2) - Jsomo = Jcfg(1,1) - Jdomo = Jcfg(1,2) - pos0prev = 0 - pmodel = p - qmodel = q - - if(p .EQ. q) then - pmodel = 1 - qmodel = 1 - else - !print *,"input pq=",p,q,"extype=",extype - !call debug_spindet(Isomo,1) - !call debug_spindet(Idomo,1) - !call debug_spindet(Jsomo,1) - !call debug_spindet(Jdomo,1) - select case(extype) - case (1) - ! SOMO -> SOMO - ! remove all domos - !print *,"type -> SOMO -> SOMO" - mask = ISHFT(1_8,p) - 1 - Isomotmp = IAND(Isomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Isomotmp,mask)) - mask = ISHFT(1_8,q) - 1 - Isomotmp = IAND(Isomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Isomotmp,mask)) - case (2) - ! DOMO -> VMO - ! remove all domos except one at p - !print *,"type -> DOMO -> VMO" - mask = ISHFT(1_8,p) - 1 - Jsomotmp = IAND(Jsomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Jsomotmp,mask)) - mask = ISHFT(1_8,q) - 1 - Jsomotmp = IAND(Jsomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Jsomotmp,mask)) - case (3) - ! SOMO -> VMO - !print *,"type -> SOMO -> VMO" - !Isomo = IEOR(Isomo,Jsomo) - mask = ISHFT(1_8,p) - 1 - Isomo = IAND(Isomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Isomo,mask)) - mask = ISHFT(1_8,q) - 1 - Jsomo = IAND(Jsomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Jsomo,mask)) - case (4) - ! DOMO -> SOMO - ! remove all domos except one at p - !print *,"type -> DOMO -> SOMO" - !Isomo = IEOR(Isomo,Jsomo) - mask = ISHFT(1_8,p) - 1 - Jsomo = IAND(Jsomo,mask) - pmodel = POPCNT(mask) - POPCNT(XOR(Jsomo,mask)) - mask = ISHFT(1_8,q) - 1 - Isomo = IAND(Isomo,mask) - qmodel = POPCNT(mask) - POPCNT(XOR(Isomo,mask)) - case default - print *,"something is wrong in convertOrbIdsToModelSpaceIds" - end select - endif - !print *,p,q,"model ids=",pmodel,qmodel -end subroutine convertOrbIdsToModelSpaceIds -#+end_src - -#+begin_src fortran - integer :: i - integer :: count - integer :: mask - integer :: isomo - count = 0 - mask = ISHFT(1_8,5)-1 - print *,mask - print *,POPCNT(mask) - isomo = 144 - isomo = IAND(isomo,mask) - print *,isomo - print *,XOR(isomo,mask) - print *,POPCNT(mask) - POPCNT(XOR(isomo,mask)) - -#+end_src - -#+RESULTS: -| 31 | -| 5 | -| 16 | -| 15 | -| 1 | - -#+begin_src fortran - print *,IBSET(0_8,4)-1 - print *,POPCNT(IBSET(0_8,4)-1) - POPCNT(IAND(716,IBSET(0_8,4)-1)) - print *,POPCNT(IBSET(0_8,8)-1) - POPCNT(IAND(716,IBSET(0_8,8)-1)) -#+end_src - -#+RESULTS: -| 15 | -| 2 | -| 4 | diff --git a/src/csf/configurations.irp.f b/src/csf/configurations.irp.f index ce5d48ab..44b7097a 100644 --- a/src/csf/configurations.irp.f +++ b/src/csf/configurations.irp.f @@ -191,144 +191,6 @@ subroutine configuration_to_dets(o,d,sze,n_alpha,Nint) endif -end - -subroutine configuration_to_dets_tree_addressing(o,d,sze,n_alpha,Nint) - use bitmasks - implicit none - BEGIN_DOC - ! Generate all possible determinants for a given configuration - ! - ! This function preserves the tree addressing i.e. - ! the time-reversal determinants are at the opposite ends - ! and not one after the other as in the parent function. - ! - ! Input : - ! o : configuration : (doubly occupied, singly occupied) - ! sze : Number of produced determinants, computed by `configuration_to_dets_size` - ! n_alpha : Number of $\alpha$ electrons - ! Nint : N_int - ! - ! Output: - ! d : determinants - ! - END_DOC - integer ,intent(in) :: Nint - integer ,intent(in) :: n_alpha ! Number of alpha electrons - integer ,intent(inout) :: sze ! Dimension of the output dets - integer(bit_kind),intent(in) :: o(Nint,2) ! Configurations - integer(bit_kind),intent(out) :: d(Nint,2,sze) ! Output determinants - - integer :: i, k, n, ispin, ispin2 - - ! Extract list of singly occupied MOs as (int,pos) pairs - ! ------------------------------------------------------ - - integer :: iint(2*n_alpha), ipos(2*n_alpha) - integer(bit_kind) :: v, t, tt, diff, v_prev - integer :: n_alpha_in_single - - n=0 - n_alpha_in_single = n_alpha - do i=1,Nint - v = o(i,1) - do while(v /= 0_bit_kind) - n = n+1 - iint(n) = i - ipos(n) = trailz(v) - v = iand(v,v-1) - enddo - n_alpha_in_single = n_alpha_in_single - popcnt( o(i,2) ) - enddo - - v = shiftl(1,n_alpha_in_single) - 1 - - ! Initialize first determinant - d(:,1,1) = o(:,2) - d(:,2,1) = o(:,2) - - do k=1,n_alpha_in_single - d(iint(k),1,1) = ibset( d(iint(k),1,1), ipos(k) ) - enddo - - do k=n_alpha_in_single+1,n - d(iint(k),2,1) = ibset( d(iint(k),2,1), ipos(k) ) - enddo - - sze = int(binom_int(n,n_alpha_in_single),4) - - if ( (shiftl(n_alpha_in_single,1) == n).and.n>0 ) then - - ! Time reversal symmetry - d(:,1,sze) = d(:,2,1) - d(:,2,sze) = d(:,1,1) - - do i=2,sze/2,1 - ! Generate next permutation with Anderson's algorithm - v_prev = v - t = ior(v,v-1) - tt = t+1 - v = ior(tt, shiftr( and(not(t),tt) - 1, trailz(v)+1) ) - - ! Find what has changed between v_prev and v - diff = ieor(v,v_prev) - - ! Initialize with previous determinant - d(:,1,i) = d(:,1,i-1) - d(:,2,i) = d(:,2,i-1) - - ! Swap bits only where they have changed from v_prev to v - do while (diff /= 0_bit_kind) - k = trailz(diff)+1 - if (btest(v,k-1)) then - d(iint(k),1,i) = ibset( d(iint(k),1,i), ipos(k) ) - d(iint(k),2,i) = ibclr( d(iint(k),2,i), ipos(k) ) - else - d(iint(k),1,i) = ibclr( d(iint(k),1,i), ipos(k) ) - d(iint(k),2,i) = ibset( d(iint(k),2,i), ipos(k) ) - endif - diff = iand(diff,diff-1_bit_kind) - enddo - - ! Time reversal symmetry - d(:,1,sze-i+1) = d(:,2,i) - d(:,2,sze-i+1) = d(:,1,i) - - enddo - - else - - do i=2,sze - ! Generate next permutation with Anderson's algorithm - v_prev = v - t = ior(v,v-1) - tt = t+1 - v = ior(tt, shiftr( and(not(t),tt) - 1, trailz(v)+1) ) - - ! Find what has changed between v_prev and v - diff = ieor(v,v_prev) - - ! Initialize with previous determinant - d(:,1,i) = d(:,1,i-1) - d(:,2,i) = d(:,2,i-1) - - ! Swap bits only where they have changed from v_prev to v - do while (diff /= 0_bit_kind) - k = trailz(diff)+1 - if (btest(v,k-1)) then - d(iint(k),1,i) = ibset( d(iint(k),1,i), ipos(k) ) - d(iint(k),2,i) = ibclr( d(iint(k),2,i), ipos(k) ) - else - d(iint(k),1,i) = ibclr( d(iint(k),1,i), ipos(k) ) - d(iint(k),2,i) = ibset( d(iint(k),2,i), ipos(k) ) - endif - diff = iand(diff,diff-1_bit_kind) - enddo - - enddo - - endif - end @@ -781,6 +643,7 @@ subroutine binary_search_cfg(cfgInp,addcfg) BEGIN_PROVIDER [ integer, psi_configuration_to_psi_det, (2,N_configuration) ] &BEGIN_PROVIDER [ integer, psi_configuration_n_det, (N_configuration) ] &BEGIN_PROVIDER [ integer, psi_configuration_to_psi_det_data, (N_det) ] +&BEGIN_PROVIDER [ integer, n_det_per_config_max ] implicit none BEGIN_DOC @@ -789,6 +652,8 @@ subroutine binary_search_cfg(cfgInp,addcfg) ! ! psi_configuration_to_psi_det(1:2,k) gives the first and last index of the ! determinants of configuration k in array psi_configuration_to_psi_det_data. + ! + ! n_det_per_config_max: Maximum number of determinants per configuration END_DOC integer :: i, k, iorder @@ -821,12 +686,15 @@ subroutine binary_search_cfg(cfgInp,addcfg) integer, allocatable :: old_order(:) + n_det_per_config_max = 0 + nmax = 1000 allocate(dets(N_int,2,nmax), old_order(nmax)) do k=1,N_configuration istart = psi_configuration_to_psi_det(1,k) iend = psi_configuration_to_psi_det(2,k) + n_det_per_config_max = max(iend-istart+1, n_det_per_config_max) if (iend-istart+1 > nmax) then nmax = iend-istart+1 @@ -835,13 +703,11 @@ subroutine binary_search_cfg(cfgInp,addcfg) endif sze = nmax - call configuration_to_dets_tree_addressing( & - psi_configuration(1,1,k), & + call configuration_to_dets( psi_configuration(1,1,k), & dets, sze, elec_alpha_num, N_int) if (sze /= iend-istart+1) then - print *, 'bug in ', irp_here - stop -1 + call qp_bug(irp_here, iend-istart+1, 'sze /= iend-istart+1') endif do i=1,sze @@ -853,7 +719,7 @@ subroutine binary_search_cfg(cfgInp,addcfg) if (old_order(j) == 0) cycle - call get_excitation_degree(dets(1,1,i), & + call get_excitation_degree(dets(1,1,i), & psi_det(1, 1, old_order(j)), degree, N_int) if (degree == 0) then diff --git a/src/csf/conversion.irp.f b/src/csf/conversion.irp.f deleted file mode 100644 index 75f6e539..00000000 --- a/src/csf/conversion.irp.f +++ /dev/null @@ -1,167 +0,0 @@ -BEGIN_PROVIDER [ double precision, psi_csf_coef, (N_csf, N_states) ] - implicit none - BEGIN_DOC - ! Wafe function in CSF basis - END_DOC - - double precision, allocatable :: buffer(:,:) - allocate ( buffer(N_det, N_states) ) - buffer(1:N_det, 1:N_states) = psi_coef(1:N_det, 1:N_states) - call convertWFfromDETtoCSF(N_states, buffer, psi_csf_coef) -END_PROVIDER - -subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_cfg_out) - use cfunctions - use bitmasks - implicit none - BEGIN_DOC - ! Documentation for DetToCSFTransformationMatrix - ! Provides the matrix of transformatons for the - ! conversion between determinant to CSF basis (in BFs) - END_DOC - integer, intent(in) :: N_st - double precision, intent(in) :: psi_coef_det_in(N_det,N_st) - double precision, intent(out) :: psi_coef_cfg_out(n_CSF,N_st) - integer*8 :: Isomo, Idomo, mask - integer(bit_kind) :: Ialpha(N_int) ,Ibeta(N_int) - integer :: rows, cols, i, j, k - integer :: startdet, enddet - integer :: ndetI - integer :: getNSOMO - double precision,allocatable :: tempBuffer(:,:) - double precision,allocatable :: tempCoeff(:,:) - double precision :: phasedet - integer :: idx - - ! initialization - psi_coef_cfg_out(:,1) = 0.d0 - - integer s, bfIcfg - integer countcsf - integer MS - MS = elec_alpha_num-elec_beta_num - countcsf = 0 - phasedet = 1.0d0 - do i = 1,N_configuration - startdet = psi_configuration_to_psi_det(1,i) - enddet = psi_configuration_to_psi_det(2,i) - ndetI = enddet-startdet+1 - - allocate(tempCoeff(ndetI,N_st)) - do j = startdet, enddet - idx = psi_configuration_to_psi_det_data(j) - Ialpha(:) = psi_det(:,1,idx) - Ibeta(:) = psi_det(:,2,idx) - call get_phase_qp_to_cfg(Ialpha, Ibeta, phasedet) - do k=1,N_st - tempCoeff(j-startdet+1,k) = psi_coef_det_in(idx, k)*phasedet - enddo - enddo - - s = 0 ! s == total number of SOMOs - do k=1,N_int - if (psi_configuration(k,1,i) == 0_bit_kind) cycle - s = s + popcnt(psi_configuration(k,1,i)) - enddo - - if(iand(s,1) .EQ. 0) then - bfIcfg = max(1,nint((binom(s,s/2)-binom(s,(s/2)+1)))) - else - bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1)))) - endif - - ! perhaps blocking with CFGs of same seniority - ! can be more efficient - allocate(tempBuffer(bfIcfg,ndetI)) - tempBuffer = DetToCSFTransformationMatrix(s,:bfIcfg,:ndetI) - - call dgemm('N','N', bfIcfg, N_st, ndetI, 1.d0, tempBuffer, size(tempBuffer,1),& - tempCoeff, size(tempCoeff,1), 0.d0, psi_coef_cfg_out(countcsf+1,1),& - size(psi_coef_cfg_out,1)) - - deallocate(tempCoeff) - deallocate(tempBuffer) - countcsf += bfIcfg - enddo - -end - - -subroutine convertWFfromCSFtoDET(N_st,psi_coef_cfg_in, psi_coef_det) - implicit none - BEGIN_DOC - ! Documentation for convertCSFtoDET - ! This function converts the wavefunction - ! in CFG basis to DET basis using the - ! transformation matrix provided before. - END_DOC - integer, intent(in) :: N_st - double precision,intent(in) :: psi_coef_cfg_in(n_CSF,N_st) - double precision,intent(out) :: psi_coef_det(N_det,N_st) - double precision :: tmp_psi_coef_det(maxDetDimPerBF,N_st) - integer :: s, bfIcfg - integer :: countcsf - integer(bit_kind) :: Ialpha(N_int), Ibeta(N_int) - integer :: rows, cols, i, j, k - integer :: startdet, enddet - integer :: ndetI - integer :: getNSOMO - double precision,allocatable :: tempBuffer(:,:) - double precision,allocatable :: tempCoeff (:,:) - double precision :: phasedet - integer :: idx - - countcsf = 0 - - do i = 1,N_configuration - startdet = psi_configuration_to_psi_det(1,i) - enddet = psi_configuration_to_psi_det(2,i) - ndetI = enddet-startdet+1 - - s = 0 - do k=1,N_int - if (psi_configuration(k,1,i) == 0_bit_kind) cycle - s = s + popcnt(psi_configuration(k,1,i)) - enddo - bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1)))) - - allocate(tempCoeff(bfIcfg,N_st)) - - do k=1,N_st - do j = 1,bfIcfg - tempCoeff(j,k) = psi_coef_cfg_in(countcsf+j,k) - enddo - enddo - - countcsf += bfIcfg - ! perhaps blocking with CFGs of same seniority - ! can be more efficient - allocate(tempBuffer(bfIcfg,ndetI)) - tempBuffer = DetToCSFTransformationMatrix(s,:bfIcfg,:ndetI) - - call dgemm('T','N', ndetI, N_st, bfIcfg, 1.d0, tempBuffer, size(tempBuffer,1),& - tempCoeff, size(tempCoeff,1), 0.d0, tmp_psi_coef_det, & - size(tmp_psi_coef_det,1)) - - do j=startdet,enddet - idx = psi_configuration_to_psi_det_data(j) - Ialpha(:) = psi_det(:,1,idx) - Ibeta(:) = psi_det(:,2,idx) - call get_phase_qp_to_cfg(Ialpha, Ibeta, phasedet) - do k=1,N_st - psi_coef_det(idx,k) = tmp_psi_coef_det(j-startdet+1,k) * phasedet - enddo - enddo - - deallocate(tempCoeff) - deallocate(tempBuffer) - enddo - -end - - - - - - - diff --git a/src/csf/create_excitations.irp.f b/src/csf/create_excitations.irp.f deleted file mode 100644 index c1560148..00000000 --- a/src/csf/create_excitations.irp.f +++ /dev/null @@ -1,279 +0,0 @@ -subroutine do_single_excitation_cfg(key_in,key_out,i_hole,i_particle,ok) - use bitmasks - implicit none - BEGIN_DOC - ! Applies the single excitation operator to a configuration - ! If the excitation is possible, ok is True - END_DOC - integer, intent(in) :: i_hole,i_particle - integer(bit_kind), intent(in) :: key_in(N_int,2) - logical , intent(out) :: ok - integer :: k,j,i - integer(bit_kind) :: mask - integer(bit_kind) :: key_out(N_int,2) - - ASSERT (i_hole > 0) - ASSERT (i_particle <= mo_num) - - ok = .True. - key_out(:,:) = key_in(:,:) - - ! hole - k = shiftr(i_hole-1,bit_kind_shift)+1 - j = i_hole-shiftl(k-1,bit_kind_shift)-1 - mask = ibset(0_bit_kind,j) - - ! Check if the position j is singly occupied - ! 1 -> 0 (SOMO) - ! 0 0 (DOMO) - if (iand(key_out(k,1),mask) /= 0_bit_kind) then - key_out(k,1) = ibclr(key_out(k,1),j) - - ! Check if the position j is doubly occupied - ! 0 -> 1 (SOMO) - ! 1 0 (DOMO) - else if (iand(key_out(k,2),mask) /= 0_bit_kind) then - key_out(k,1) = ibset(key_out(k,1),j) - key_out(k,2) = ibclr(key_out(k,2),j) - - ! The position j is unoccupied: Not OK - ! 0 -> 0 (SOMO) - ! 0 0 (DOMO) - else - ok =.False. - return - endif - - - ! particle - k = shiftr(i_particle-1,bit_kind_shift)+1 - j = i_particle-shiftl(k-1,bit_kind_shift)-1 - mask = ibset(0_bit_kind,j) - - ! Check if the position j is singly occupied - ! 1 -> 0 (SOMO) - ! 0 1 (DOMO) - if (iand(key_out(k,1),mask) /= 0_bit_kind) then - key_out(k,1) = ibclr(key_out(k,1),j) - key_out(k,2) = ibset(key_out(k,2),j) - - ! Check if the position j is doubly occupied : Not OK - ! 0 -> 1 (SOMO) - ! 1 0 (DOMO) - else if (iand(key_out(k,2),mask) /= 0_bit_kind) then - ok = .False. - return - - ! Position at j is unoccupied - ! 0 -> 0 (SOMO) - ! 0 0 (DOMO) - else - key_out(k,1) = ibset(key_out(k,1),j) - endif - -end - -subroutine do_single_excitation_cfg_with_type(key_in,key_out,i_hole,i_particle,ex_type,ok) - use bitmasks - implicit none - BEGIN_DOC - ! Applies the single excitation operator to a configuration - ! Returns the type of excitation in ex_type - ! where the following convention is used - ! 1 = (SOMO -> SOMO) 1 change in Nsomo - ! 2 = (DOMO -> VMO) 1 change in Nsomo - ! 3 = (SOMO -> VMO) 0 change in Nsomo - ! 4 = (DOMO -> SOMO) 0 change in Nsomo - ! If the excitation is possible, ok is True - END_DOC - integer, intent(in) :: i_hole,i_particle - integer(bit_kind), intent(in) :: key_in(N_int,2) - integer , intent(out) :: ex_type - logical , intent(out) :: ok - integer :: k,j,i - integer(bit_kind) :: mask - integer(bit_kind) :: key_out(N_int,2) - logical :: isholeSOMO - logical :: isparticleSOMO - logical :: isholeDOMO - logical :: isparticleVMO - isholeSOMO = .False. - isholeDOMO = .False. - isparticleSOMO = .False. - isparticleVMO = .False. - - ASSERT (i_hole > 0) - ASSERT (i_particle <= mo_num) - - ok = .True. - key_out(:,:) = key_in(:,:) - - ! hole - k = shiftr(i_hole-1,bit_kind_shift)+1 - j = i_hole-shiftl(k-1,bit_kind_shift)-1 - mask = ibset(0_bit_kind,j) - - ! Check if the position j is singly occupied - ! 1 -> 0 (SOMO) - ! 0 0 (DOMO) - if (iand(key_out(k,1),mask) /= 0_bit_kind) then - key_out(k,1) = ibclr(key_out(k,1),j) - isholeSOMO = .True. - - ! Check if the position j is doubly occupied - ! 0 -> 1 (SOMO) - ! 1 0 (DOMO) - else if (iand(key_out(k,2),mask) /= 0_bit_kind) then - key_out(k,1) = ibset(key_out(k,1),j) - key_out(k,2) = ibclr(key_out(k,2),j) - isholeDOMO = .True. - - ! The position j is unoccupied: Not OK - ! 0 -> 0 (SOMO) - ! 0 0 (DOMO) - else - ok =.False. - return - endif - - - ! particle - k = shiftr(i_particle-1,bit_kind_shift)+1 - j = i_particle-shiftl(k-1,bit_kind_shift)-1 - mask = ibset(0_bit_kind,j) - - ! Check if the position j is singly occupied - ! 1 -> 0 (SOMO) - ! 0 1 (DOMO) - if (iand(key_out(k,1),mask) /= 0_bit_kind) then - key_out(k,1) = ibclr(key_out(k,1),j) - key_out(k,2) = ibset(key_out(k,2),j) - isparticleSOMO = .True. - - ! Check if the position j is doubly occupied : Not OK - ! 0 -> 1 (SOMO) - ! 1 0 (DOMO) - else if (iand(key_out(k,2),mask) /= 0_bit_kind) then - ok = .False. - return - - ! Position at j is unoccupied - ! 0 -> 0 (SOMO) - ! 0 0 (DOMO) - else - key_out(k,1) = ibset(key_out(k,1),j) - isparticleVMO = .True. - endif - - if(isholeSOMO) then - ! two possibilities - ! particle is SOMO or VMO - if(isparticleSOMO) then - ! SOMO -> SOMO - ex_type = 1 - else - ! SOMO -> VMO - ex_type = 3 - endif - else - ! two possibilities - ! particle is SOMO or VMO - if(isparticleSOMO) then - ! DOMO -> SOMO - ex_type = 4 - else - ! DOMO -> VMO - ex_type = 2 - endif - endif - -end - -subroutine generate_all_singles_cfg(cfg,singles,n_singles,Nint) - implicit none - use bitmasks - BEGIN_DOC - ! Generate all single excitation wrt a configuration - ! - ! n_singles : on input, max number of singles : - ! elec_alpha_num * (mo_num - elec_beta_num) - ! on output, number of generated singles - END_DOC - integer, intent(in) :: Nint - integer, intent(inout) :: n_singles - integer(bit_kind), intent(in) :: cfg(Nint,2) - integer(bit_kind), intent(out) :: singles(Nint,2,*) - - integer :: i,k, n_singles_ma, i_hole, i_particle - integer(bit_kind) :: single(Nint,2) - logical :: i_ok - - n_singles = 0 - !TODO - !Make list of Somo and Domo for holes - !Make list of Unocc and Somo for particles - do i_hole = 1, mo_num - do i_particle = 1, mo_num - call do_single_excitation_cfg(cfg,single,i_hole,i_particle,i_ok) - if (i_ok) then - n_singles = n_singles + 1 - do k=1,Nint - singles(k,1,n_singles) = single(k,1) - singles(k,2,n_singles) = single(k,2) - enddo - endif - enddo - enddo -end - -subroutine generate_all_singles_cfg_with_type(cfgInp,singles,idxs_singles,pq_singles,ex_type_singles,n_singles,Nint) - implicit none - use bitmasks - BEGIN_DOC - ! Generate all single excitation wrt a configuration - ! - ! n_singles : on input, max number of singles : - ! elec_alpha_num * (mo_num - elec_beta_num) - ! on output, number of generated singles - ! ex_type_singles : on output contains type of excitations : - ! - END_DOC - integer, intent(in) :: Nint - integer, intent(inout) :: n_singles - integer, intent(out) :: idxs_singles(*) - integer, intent(out) :: ex_type_singles(*) - integer, intent(out) :: pq_singles(2,*) - integer(bit_kind), intent(in) :: cfgInp(Nint,2) - integer(bit_kind), intent(out) :: singles(Nint,2,*) - integer(bit_kind) :: Jdet(Nint,2) - - integer :: i,k, n_singles_ma, i_hole, i_particle, ex_type, addcfg - integer(bit_kind) :: single(Nint,2) - logical :: i_ok - - n_singles = 0 - !TODO - !Make list of Somo and Domo for holes - !Make list of Unocc and Somo for particles - do i_hole = 1+n_core_orb, n_core_orb + n_act_orb - do i_particle = 1+n_core_orb, n_core_orb + n_act_orb - if(i_hole .EQ. i_particle) cycle - addcfg = -1 - call do_single_excitation_cfg_with_type(cfgInp,single,i_hole,i_particle,ex_type,i_ok) - if (i_ok) then - call binary_search_cfg(single,addcfg) - if(addcfg .EQ. -1) cycle - n_singles = n_singles + 1 - do k=1,Nint - singles(k,1,n_singles) = single(k,1) - singles(k,2,n_singles) = single(k,2) - ex_type_singles(n_singles) = ex_type - pq_singles(1,n_singles) = i_hole ! p - pq_singles(2,n_singles) = i_particle ! q - idxs_singles(n_singles) = addcfg - enddo - endif - enddo - enddo -end - diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f new file mode 100644 index 00000000..513b5c03 --- /dev/null +++ b/src/csf/csf.irp.f @@ -0,0 +1,243 @@ + BEGIN_PROVIDER [ integer, N_csf ] +&BEGIN_PROVIDER [ integer, psi_configuration_to_psi_csf, (2,N_configuration) ] +&BEGIN_PROVIDER [ integer, psi_configuration_n_csf, (N_configuration) ] +&BEGIN_PROVIDER [ double precision, det_csf_transformation, (n_det_per_config_max*n_det_per_config_max*N_configuration) ] +&BEGIN_PROVIDER [ integer*8, det_csf_transformation_index, (N_configuration) ] + implicit none + BEGIN_DOC + ! First index is the CSF, second is index of the determinant in psi_det + ! det_csf_transformation: Transformation matrix between determinants and CSF. First index is determinant, second is CSF. + ! det_csf_transformation contains all transformation matrices concatenated in + ! a flat 1D array to compress the storage. The address of the matrix is obtained from + ! det_csf_transformation + ! To get the transformation, call get_det_csf_transformation + END_DOC + + integer :: i_det, j_det + integer :: i_cfg, i_csf, i, j, lwork + integer :: sze, istart, iend + double precision, allocatable :: s2mat(:,:) + double precision :: sij + + double precision, allocatable :: eigenvalues(:), work(:) + integer :: info + integer*8 :: index + + lwork = n_det_per_config_max**3 + + allocate(eigenvalues(n_det_per_config_max), work(lwork)) + allocate(s2mat(n_det_per_config_max,n_det_per_config_max)) + + N_csf = 0 + index = 1_8 + + do i_cfg=1,N_configuration + + istart = psi_configuration_to_psi_det(1,i_cfg) + iend = psi_configuration_to_psi_det(2,i_cfg) + sze = iend-istart+1 + + if (sze > n_det_per_config_max) then + call qp_bug(irp_here, -1, 'Configuration has more determinants than allowed by n_det_per_config_max') + endif + + det_csf_transformation_index(i_cfg) = index + if (sze == 1) then + + N_csf = N_csf + 1 + det_csf_transformation(index) = 1.d0 + psi_configuration_to_psi_csf(1,i_cfg) = N_csf + psi_configuration_to_psi_csf(2,i_cfg) = N_csf + psi_configuration_n_csf(i_cfg) = 1 + index = index + 1_8 + + else + + do j=1,sze + j_det = psi_configuration_to_psi_det_data(j+istart-1) + do i=1,j + i_det = psi_configuration_to_psi_det_data(i+istart-1) + call get_s2(psi_det(1,1,i_det),psi_det(1,1,j_det),N_int,sij) + s2mat(i,j) = sij + s2mat(j,i) = sij + enddo + enddo + + call dsyev('V','L', sze, s2mat, size(s2mat,1), eigenvalues, work, lwork, info) + if (info /= 0) then + call qp_bug(irp_here, info, 'Failed in dsyev') + endif + + psi_configuration_to_psi_csf(1,i_cfg) = N_csf+1 + i_csf = 0 + do j=1,sze + if (dabs(eigenvalues(j) - expected_s2) < 0.1d0) then + i_csf = i_csf + 1 + det_csf_transformation(index:index+sze-1) = s2mat(1:sze,j) + index = index + sze + end if + enddo + if (i_csf == 0) cycle + N_csf = N_csf + i_csf + psi_configuration_n_csf(i_cfg) = i_csf + psi_configuration_to_psi_csf(2,i_cfg) = N_csf + + endif + + enddo + + deallocate(s2mat, work, eigenvalues) + + +END_PROVIDER + +subroutine get_det_csf_transformation(matrix, dim, i_cfg) + implicit none + double precision, intent(out) :: matrix(dim,dim) + integer, intent(in) :: dim, i_cfg + + integer :: index, ncsf, ndet + ndet = psi_configuration_n_det(i_cfg) + + if (ndet == 1) then + matrix(1,1) = 1.d0 + return + endif + + index = det_csf_transformation_index(i_cfg) + ncsf = psi_configuration_n_csf(i_cfg) + + if (dim < ndet) call qp_bug(irp_here, 1, 'dimensions too small') + if (dim < ncsf) call qp_bug(irp_here, 2, 'dimensions too small') + + integer :: i, j + do j=1,ncsf + matrix(1:ndet,j) = det_csf_transformation(index:index+ndet-1) + index = index+1 + enddo + +end + +subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_csf_out) + implicit none + BEGIN_DOC + ! Converts a wave functions from determinant space to CSF space + END_DOC + integer, intent(in) :: N_st + double precision, intent(in) :: psi_coef_det_in(N_det,N_st) + double precision, intent(out) :: psi_coef_csf_out(N_csf,N_st) + + integer :: i_state, i, i_csf, i_cfg + integer :: startdet, enddet, i_det, j_det + + double precision, allocatable :: coef(:,:) + + allocate (coef(n_det_per_config_max,N_st)) + + do i_cfg=1,N_configuration + + ! Copy CI coefficients of the configuration in a temporary contiguous buffer + + startdet = psi_configuration_to_psi_det(1,i_cfg) + do i_det=1,psi_configuration_n_det(i_cfg) + j_det = psi_configuration_to_psi_det_data(startdet + i_det - 1) + do i_state=1,N_st + coef(i_det,i_state) = psi_coef_det_in(j_det, i_state) + enddo + enddo + + ! Matrix-multiplication to convert the vector into CSF space + + if (psi_configuration_n_det(i_cfg) == 1) then + + do i_state=1,N_st + psi_coef_csf_out(psi_configuration_to_psi_csf(1,i_cfg), i_state) = coef(1,i_state) + enddo + + else + + integer :: index, ncsf, ndet + index = det_csf_transformation_index(i_cfg) + ncsf = psi_configuration_n_csf(i_cfg) + ndet = psi_configuration_n_det(i_cfg) + + call dgemm('T','N', ncsf, N_st, ndet, 1.d0, & + det_csf_transformation(index), ndet, & + coef, size(coef,1), & + 0.d0, psi_coef_csf_out( psi_configuration_to_psi_csf(1,i_cfg), 1), & + size(psi_coef_csf_out,1)) + endif + + end do + + deallocate(coef) +end + + +subroutine convertWFfromCSFtoDET(N_st,psi_coef_csf_in, psi_coef_det_out) + implicit none + BEGIN_DOC + ! Converts a wave functions from determinant space to CSF space + END_DOC + integer, intent(in) :: N_st + double precision, intent(in) :: psi_coef_csf_in(N_csf,N_st) + double precision, intent(out) :: psi_coef_det_out(N_det,N_st) + + integer :: i_state, i, i_csf, i_cfg + integer :: startdet, enddet, i_det, j_det + + double precision, allocatable :: coef(:,:) + + allocate (coef(n_det_per_config_max,N_st)) + + do i_cfg=1,N_configuration + + ! Matrix-multiplication to convert the vector into CSF space + + if (psi_configuration_n_det(i_cfg) == 1) then + + do i_state = 1,N_st + coef(1,i_state) = psi_coef_csf_in( psi_configuration_to_psi_csf(1,i_cfg), i_state) + enddo + + else + + integer :: index, ncsf, ndet + index = det_csf_transformation_index(i_cfg) + ncsf = psi_configuration_n_csf(i_cfg) + ndet = psi_configuration_n_det(i_cfg) + + call dgemm('N','N', ndet, N_st, ncsf, 1.d0, & + det_csf_transformation(index), ndet, & + psi_coef_csf_in( psi_configuration_to_psi_csf(1,i_cfg), 1), & + size(psi_coef_csf_in,1), & + 0.d0, coef, size(coef,1)) + + end if + + + ! Copy CI coefficients of temporary contiguous buffer to the CI vector + + startdet = psi_configuration_to_psi_det(1,i_cfg) + do i_det=1,psi_configuration_n_det(i_cfg) + j_det = psi_configuration_to_psi_det_data(startdet + i_det - 1) + do i_state = 1,N_st + psi_coef_det_out(j_det, i_state) = coef(i_det,i_state) + enddo + enddo + + end do + + deallocate(coef) +end + + +BEGIN_PROVIDER [ double precision, psi_csf_coef, (N_csf, N_states) ] + implicit none + BEGIN_DOC + ! Wafe function in CSF basis + END_DOC + + call convertWFfromDETtoCSF(N_states, psi_coef, psi_csf_coef) +END_PROVIDER + diff --git a/src/csf/sigma_vector.irp.f b/src/csf/sigma_vector.irp.f deleted file mode 100644 index 5aaba9a3..00000000 --- a/src/csf/sigma_vector.irp.f +++ /dev/null @@ -1,706 +0,0 @@ - real*8 function logabsgamma(x) - implicit none - real*8, intent(in) :: x - logabsgamma = 1.d32 ! Avoid floating point exception - if (x>0.d0) then - logabsgamma = log(abs(gamma(x))) - endif - end function logabsgamma - - BEGIN_PROVIDER [ integer, NSOMOMax] - &BEGIN_PROVIDER [ integer, NCSFMax] - &BEGIN_PROVIDER [ integer*8, NMO] - &BEGIN_PROVIDER [ integer, NBFMax] - &BEGIN_PROVIDER [ integer, n_CSF] - &BEGIN_PROVIDER [ integer, maxDetDimPerBF] - implicit none - BEGIN_DOC - ! Documentation for NSOMOMax - ! The maximum number of SOMOs for the current calculation. - ! required for the calculation of prototype arrays. - END_DOC - NSOMOMax = min(elec_num, cfg_nsomo_max + 2) - ! Note that here we need NSOMOMax + 2 sizes - NCSFMax = max(1,nint((binom(NSOMOMax,(NSOMOMax+1)/2)-binom(NSOMOMax,((NSOMOMax+1)/2)+1)))) ! TODO: NCSFs for MS=0 - NBFMax = NCSFMax - maxDetDimPerBF = max(1,nint((binom(NSOMOMax,(NSOMOMax+1)/2)))) - NMO = n_act_orb - integer i,j,k,l - integer startdet,enddet - integer ncfg,ncfgprev - integer NSOMO - integer dimcsfpercfg - integer detDimperBF - real*8 :: coeff, binom1, binom2 - integer MS - integer ncfgpersomo - real*8, external :: logabsgamma - detDimperBF = 0 - MS = elec_alpha_num-elec_beta_num - ! number of cfgs = number of dets for 0 somos - n_CSF = 0 - ncfgprev = cfg_seniority_index(0) - ncfgpersomo = ncfgprev - do i = iand(MS,1), NSOMOMax-2,2 - if(cfg_seniority_index(i) .EQ. -1) then - cycle - endif - if(cfg_seniority_index(i+2) .EQ. -1) then - ncfgpersomo = N_configuration + 1 - else - if(cfg_seniority_index(i+2) > ncfgpersomo) then - ncfgpersomo = cfg_seniority_index(i+2) - else - ! l = i+k+2 - ! Loop over l with a constraint to ensure that l <= size(cfg_seniority_index,1)-1 - ! Old version commented just below - do l = min(size(cfg_seniority_index,1)-1, i+2), size(cfg_seniority_index,1)-1, 2 - if (cfg_seniority_index(l) >= ncfgpersomo) then - ncfgpersomo = cfg_seniority_index(l) - endif - enddo - !k = 0 - !if ((i+2+k) < size(cfg_seniority_index,1)) then - ! do while(cfg_seniority_index(i+2+k) < ncfgpersomo) - ! k = k + 2 - ! if ((i+2+k) >= size(cfg_seniority_index,1)) then - ! exit - ! endif - ! ncfgpersomo = cfg_seniority_index(i+2+k) - ! enddo - !endif - endif - endif - ncfg = ncfgpersomo - ncfgprev - if(i .EQ. 0 .OR. i .EQ. 1) then - dimcsfpercfg = 1 - elseif( i .EQ. 3) then - dimcsfpercfg = 2 - else - if(iand(MS,1) .EQ. 0) then - dimcsfpercfg = max(1,nint((binom(i,i/2)-binom(i,i/2+1)))) - else - dimcsfpercfg = max(1,nint((binom(i,(i+1)/2)-binom(i,(i+3)/2)))) - endif - endif - n_CSF += ncfg * dimcsfpercfg - if(cfg_seniority_index(i+2) > ncfgprev) then - ncfgprev = cfg_seniority_index(i+2) - else - ! l = i+k+2 - ! Loop over l with a constraint to ensure that l <= size(cfg_seniority_index,1)-1 - ! Old version commented just below - do l = min(size(cfg_seniority_index,1)-1, i+2), size(cfg_seniority_index,1)-1, 2 - if (cfg_seniority_index(l) >= ncfgprev) then - ncfgprev = cfg_seniority_index(l) - endif - enddo - !k = 0 - !if ((i+2+k) < size(cfg_seniority_index,1)) then - ! do while(cfg_seniority_index(i+2+k) < ncfgprev) - ! k = k + 2 - ! if ((i+2+k) >= size(cfg_seniority_index,1)) then - ! exit - ! endif - ! ncfgprev = cfg_seniority_index(i+2+k) - ! enddo - !endif - endif - enddo -END_PROVIDER - - -subroutine get_phase_qp_to_cfg(Ialpha, Ibeta, phaseout) - use bitmasks - implicit none - BEGIN_DOC - ! Documentation for get_phase_qp_to_cfg - ! - ! This function converts from (aaaa)(bbbb) - ! notation to (ab)(ab)(ab)(ab) - ! notation. - ! The cfgCI code works in (ab)(ab)(ab)(ab) - ! notation throughout. - END_DOC - integer(bit_kind),intent(in) :: Ialpha(N_int) - integer(bit_kind),intent(in) :: Ibeta(N_int) - real*8,intent(out) :: phaseout - integer(bit_kind) :: mask, deta(N_int), detb(N_int) - integer :: nbetas - integer :: k - - ! Initialize deta and detb - deta = Ialpha - detb = Ibeta - - ! Find how many alpha electrons there are in all the N_ints - integer :: Na(N_int) - do k=1,N_int - Na(k) = popcnt(deta(k)) - enddo - - integer :: shift, ipos, nperm - phaseout = 1.d0 - do k=1,N_int - - do while(detb(k) /= 0_bit_kind) - ! Find the lowest beta electron and clear it - ipos = trailz(detb(k)) - detb(k) = ibclr(detb(k),ipos) - - ! Create a mask will all MOs higher than the beta electron - mask = not(shiftl(1_bit_kind,ipos + 1) - 1_bit_kind) - - ! Apply the mask to the alpha string to count how many electrons to cross - nperm = popcnt( iand(mask, deta(k)) ) - - ! Count how many alpha electrons are above the beta electron in the other integers - nperm = nperm + sum(Na(k+1:N_int)) - if (iand(nperm,1) == 1) then - phaseout = -phaseout - endif - - enddo - - enddo -end subroutine get_phase_qp_to_cfg - - - - BEGIN_PROVIDER [ integer, AIJpqMatrixDimsList, (0:NSOMOMax,0:NSOMOMax,4,NSOMOMax,NSOMOMax,2)] - &BEGIN_PROVIDER [ integer, rowsmax] - &BEGIN_PROVIDER [ integer, colsmax] - use cfunctions - implicit none - BEGIN_DOC - ! Documentation for AIJpqMatrixList - ! The prototype matrix containing the - ! matrices for each I,J somo pair and orb ids. - END_DOC - integer i,j,k,l - integer*8 Isomo, Jsomo, tmpsomo - Isomo = 0 - Jsomo = 0 - integer rows, cols, nsomoi, nsomoj - rows = -1 - cols = -1 - integer*8 MS - MS = elec_alpha_num-elec_beta_num - integer nsomomin - nsomomin = elec_alpha_num-elec_beta_num - rowsmax = 0 - colsmax = 0 - !allocate(AIJpqMatrixDimsList(NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)) - ! Type - ! 1. SOMO -> SOMO - do i = 2-iand(nsomomin,1), NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - do j = i-2,i-2, 2 - Jsomo = ISHFT(1_8,j)-1 - if(j .GT. NSOMOMax .OR. j .LT. 0) then - cycle - end if - do k = 1,i - do l = 1,i - ! Define Jsomo - if(k.NE.l)then - Jsomo = IBCLR(Isomo, k-1) - Jsomo = IBCLR(Jsomo, l-1) - nsomoi = i - nsomoj = j - else - Isomo = ISHFT(1_8,i)-1 - Jsomo = ISHFT(1_8,i)-1 - nsomoi = i - nsomoj = i - endif - - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - if(rowsmax .LT. rows) then - rowsmax = rows - end if - if(colsmax .LT. cols) then - colsmax = cols - end if - ! i -> j - AIJpqMatrixDimsList(nsomoi,nsomoj,1,k,l,1) = rows - AIJpqMatrixDimsList(nsomoi,nsomoj,1,k,l,2) = cols - end do - end do - end do - end do - ! Type - ! 2. DOMO -> VMO - do i = 0+iand(nsomomin,1), NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - tmpsomo = ISHFT(1_8,i+2)-1 - do j = i+2,i+2, 2 - Jsomo = ISHFT(1_8,j)-1 - if(j .GT. NSOMOMax .OR. j .LT. 0) then - cycle - end if - do k = 1,j - do l = 1,j - if(k .NE. l) then - Isomo = IBCLR(tmpsomo,k-1) - Isomo = IBCLR(Isomo,l-1) - - ! Define Jsomo - Jsomo = ISHFT(1_8,j)-1; - nsomoi = i - nsomoj = j - else - Isomo = ISHFT(1_8,j)-1 - Isomo = IBCLR(Isomo,1-1) - Isomo = IBCLR(Isomo,j-1) - Jsomo = ISHFT(1_8,j)-1 - Isomo = ISHFT(1_8,j)-1 - nsomoi = j - nsomoj = j - endif - - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - if(rowsmax .LT. rows) then - rowsmax = rows - end if - if(colsmax .LT. cols) then - colsmax = cols - end if - ! i -> j - AIJpqMatrixDimsList(nsomoi,nsomoj,2,k,l,1) = rows - AIJpqMatrixDimsList(nsomoi,nsomoj,2,k,l,2) = cols - end do - end do - end do - end do - ! Type - ! 3. SOMO -> VMO - !print *,"Doing SOMO->VMO" - do i = 2-iand(nsomomin,1), NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - do j = i,i, 2 - Jsomo = ISHFT(1_8,j)-1 - if(j .GT. NSOMOMax .OR. j .LE. 0) then - cycle - end if - do k = 1,i - do l = 1,i - if(k .NE. l) then - Isomo = ISHFT(1_8,i+1)-1 - Isomo = IBCLR(Isomo,l-1) - Jsomo = ISHFT(1_8,j+1)-1 - Jsomo = IBCLR(Jsomo,k-1) - else - Isomo = ISHFT(1_8,i)-1 - Jsomo = ISHFT(1_8,j)-1 - endif - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - if(rowsmax .LT. rows) then - rowsmax = rows - end if - if(colsmax .LT. cols) then - colsmax = cols - end if - ! i -> j - AIJpqMatrixDimsList(i,j,3,k,l,1) = rows - AIJpqMatrixDimsList(i,j,3,k,l,2) = cols - end do - end do - end do - end do - ! Type - ! 4. DOMO -> VMO - !print *,"Doing DOMO->SOMO" - do i = 2-iand(nsomomin,1), NSOMOMax, 2 - do j = i,i, 2 - if(j .GT. NSOMOMax .OR. j .LE. 0) then - cycle - end if - do k = 1,i - do l = 1,i - if(k .NE. l) then - Isomo = ISHFT(1_8,i+1)-1 - Isomo = IBCLR(Isomo,k+1-1) - Jsomo = ISHFT(1_8,j+1)-1 - Jsomo = IBCLR(Jsomo,l-1) - else - Isomo = ISHFT(1_8,i)-1 - Jsomo = ISHFT(1_8,j)-1 - endif - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - if(rowsmax .LT. rows) then - rowsmax = rows - end if - if(colsmax .LT. cols) then - colsmax = cols - end if - ! i -> j - AIJpqMatrixDimsList(i,j,4,k,l,1) = rows - AIJpqMatrixDimsList(i,j,4,k,l,2) = cols - end do - end do - end do - end do - END_PROVIDER - - BEGIN_PROVIDER [ real*8, AIJpqContainer, (0:NSOMOMax,0:NSOMOMax,4,NSOMOMax,NSOMOMax,NBFMax,NBFMax)] - use cfunctions - implicit none - BEGIN_DOC - ! Documentation for AIJpqMatrixList - ! The prototype matrix containing the - ! matrices for each I,J somo pair and orb ids. - ! - ! Due to the different types of excitations which - ! include DOMOs and VMOs two prototype DOMOs and two - ! prototype VMOs are needed. Therefore - ! the 4th and 5th dimensions are NSOMOMax+4 and NSOMOMax+4 - ! respectively. - ! - ! The type of excitations are ordered as follows: - ! Type 1 - SOMO -> SOMO - ! Type 2 - DOMO -> VMO - ! Type 3 - SOMO -> VMO - ! Type 4 - DOMO -> SOMO - END_DOC - integer i,j,k,l, orbp, orbq, ri, ci - orbp = 0 - orbq = 0 - integer*8 Isomo, Jsomo, tmpsomo - Isomo = 0 - Jsomo = 0 - integer rows, cols, nsomoi, nsomoj - rows = -1 - cols = -1 - integer*8 MS - MS = 0 - touch AIJpqMatrixDimsList - real*8,dimension(:,:),allocatable :: meMatrix - integer maxdim - !maxdim = max(rowsmax,colsmax) - ! allocate matrix - !allocate(AIJpqMatrixDimsList(NSOMOMax,NSOMOMax,4,NSOMOMax,NSOMOMax,2)) - ! Type - ! 1. SOMO -> SOMO - do i = 2, NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - do j = i-2,i-2, 2 - if(j .GT. NSOMOMax .OR. j .LT. 0) cycle - do k = 1,i - do l = 1,i - - ! Define Jsomo - if(k .NE. l) then - Jsomo = IBCLR(Isomo, k-1) - Jsomo = IBCLR(Jsomo, l-1) - nsomoi = i - nsomoj = j - else - Isomo = ISHFT(1_8,i)-1 - Jsomo = ISHFT(1_8,i)-1 - nsomoi = i - nsomoj = i - endif - - AIJpqContainer(nsomoi,nsomoj,1,k,l,:,:) = 0.0d0 - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - - orbp = k - orbq = l - allocate(meMatrix(rows,cols)) - meMatrix = 0.0d0 - ! fill matrix - call getApqIJMatrixDriver(Isomo, & - Jsomo, & - orbp, & - orbq, & - MS, & - NMO, & - meMatrix, & - rows, & - cols) - ! i -> j - do ri = 1,rows - do ci = 1,cols - AIJpqContainer(nsomoi,nsomoj,1,k,l,ri,ci) = meMatrix(ri, ci) - end do - end do - deallocate(meMatrix) - end do - end do - end do - end do - ! Type - ! 2. DOMO -> VMO - do i = 0, NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - tmpsomo = ISHFT(1_8,i+2)-1 - do j = i+2,i+2, 2 - if(j .GT. NSOMOMax .OR. j .LE. 0) cycle - Jsomo = ISHFT(1_8,j)-1 - do k = 1,j - do l = 1,j - if(k .NE. l) then - Isomo = IBCLR(tmpsomo,k-1) - Isomo = IBCLR(Isomo,l-1) - ! Define Jsomo - Jsomo = ISHFT(1_8,j)-1; - nsomoi = i - nsomoj = j - else - Isomo = ISHFT(1_8,j)-1 - Isomo = IBCLR(Isomo,1-1) - Isomo = IBCLR(Isomo,j-1) - Jsomo = ISHFT(1_8,j)-1 - Isomo = ISHFT(1_8,j)-1 - nsomoi = j - nsomoj = j - endif - - AIJpqContainer(nsomoi,nsomoj,2,k,l,:,:) = 0.0d0 - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - - orbp = k - orbq = l - allocate(meMatrix(rows,cols)) - meMatrix = 0.0d0 - ! fill matrix - call getApqIJMatrixDriver(Isomo, & - Jsomo, & - orbp, & - orbq, & - MS, & - NMO, & - meMatrix, & - rows, & - cols) - ! i -> j - do ri = 1,rows - do ci = 1,cols - AIJpqContainer(nsomoi,nsomoj,2,k,l,ri,ci) = meMatrix(ri, ci) - end do - end do - deallocate(meMatrix) - end do - end do - end do - end do - ! Type - ! 3. SOMO -> VMO - do i = 2, NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - do j = i,i, 2 - Jsomo = ISHFT(1_8,j)-1 - if(j .GT. NSOMOMax .OR. j .LE. 0) cycle - do k = 1,i - do l = 1,i - if(k .NE. l) then - Isomo = ISHFT(1_8,i+1)-1 - Isomo = IBCLR(Isomo,l-1) - Jsomo = ISHFT(1_8,j+1)-1 - Jsomo = IBCLR(Jsomo,k-1) - else - Isomo = ISHFT(1_8,i)-1 - Jsomo = ISHFT(1_8,j)-1 - endif - - AIJpqContainer(i,j,3,k,l,:,:) = 0.0d0 - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - - orbp = k - orbq = l - allocate(meMatrix(rows,cols)) - meMatrix = 0.0d0 - ! fill matrix - call getApqIJMatrixDriver(Isomo, & - Jsomo, & - orbp, & - orbq, & - MS, & - NMO, & - meMatrix, & - rows, & - cols) - ! i -> j - do ri = 1,rows - do ci = 1,cols - AIJpqContainer(i,j,3,k,l,ri,ci) = meMatrix(ri, ci) - end do - end do - deallocate(meMatrix) - end do - end do - end do - end do - ! Type - ! 4. DOMO -> SOMO - do i = 2, NSOMOMax, 2 - Isomo = ISHFT(1_8,i)-1 - do j = i,i, 2 - Jsomo = ISHFT(1_8,i)-1 - if(j .GT. NSOMOMax .OR. j .LE. 0) cycle - do k = 1,i - do l = 1,i - if(k .NE. l) then - Isomo = ISHFT(1_8,i+1)-1 - Isomo = IBCLR(Isomo,k-1) - Jsomo = ISHFT(1_8,j+1)-1 - Jsomo = IBCLR(Jsomo,l+1-1) - else - Isomo = ISHFT(1_8,i)-1 - Jsomo = ISHFT(1_8,j)-1 - endif - - AIJpqContainer(i,j,4,k,l,:,:) = 0.0d0 - call getApqIJMatrixDims(Isomo, & - Jsomo, & - MS, & - rows, & - cols) - - orbp = k - orbq = l - - allocate(meMatrix(rows,cols)) - meMatrix = 0.0d0 - ! fill matrix - call getApqIJMatrixDriver(Isomo, & - Jsomo, & - orbp, & - orbq, & - MS, & - NMO, & - meMatrix, & - rows, & - cols) - ! i -> j - do ri = 1,rows - do ci = 1,cols - AIJpqContainer(i,j,4,k,l,ri,ci) = meMatrix(ri, ci) - end do - end do - deallocate(meMatrix) - end do - end do - end do - end do - END_PROVIDER - - -!!!!!! - - BEGIN_PROVIDER [ real*8, DetToCSFTransformationMatrix, (0:NSOMOMax,NBFMax,maxDetDimPerBF)] - &BEGIN_PROVIDER [ real*8, psi_coef_config, (n_CSF)] - &BEGIN_PROVIDER [ integer, psi_config_data, (N_configuration,2)] - use cfunctions - use bitmasks - implicit none - BEGIN_DOC - ! Documentation for DetToCSFTransformationMatrix - ! Provides the matrix of transformatons for the - ! conversion between determinant to CSF basis (in BFs) - END_DOC - integer(bit_kind) :: mask(N_int), Ialpha(N_int),Ibeta(N_int) - integer :: rows, cols, i, j, k - integer :: startdet, enddet - integer*8 MS, Isomo, Idomo - integer ndetI - integer :: getNSOMO - real*8,dimension(:,:),allocatable :: tempBuffer - real*8,dimension(:),allocatable :: tempCoeff - real*8 :: norm_det1, phasedet - norm_det1 = 0.d0 - MS = elec_alpha_num - elec_beta_num - ! initialization - psi_coef_config = 0.d0 - DetToCSFTransformationMatrix(0,:,:) = 1.d0 - do i = 2-iand(elec_alpha_num-elec_beta_num,1), NSOMOMax,2 - Isomo = IBSET(0_8, i) - 1_8 - ! rows = Ncsfs - ! cols = Ndets - bfIcfg = max(1,nint((binom(i,(i+1)/2)-binom(i,((i+1)/2)+1)))) - ndetI = max(1,nint((binom(i,(i+1)/2)))) - - allocate(tempBuffer(bfIcfg,ndetI)) - call getCSFtoDETTransformationMatrix(Isomo, MS, NBFMax, maxDetDimPerBF, tempBuffer) - DetToCSFTransformationMatrix(i,1:bfIcfg,1:ndetI) = tempBuffer(1:bfIcfg,1:ndetI) - deallocate(tempBuffer) - enddo - - integer s, bfIcfg - integer countcsf - countcsf = 0 - integer countdet - countdet = 0 - integer idx - integer istate - istate = 1 - phasedet = 1.0d0 - do i = 1,N_configuration - startdet = psi_configuration_to_psi_det(1,i) - enddet = psi_configuration_to_psi_det(2,i) - ndetI = enddet-startdet+1 - - allocate(tempCoeff(ndetI)) - countdet = 1 - do j = startdet, enddet - idx = psi_configuration_to_psi_det_data(j) - Ialpha(:) = psi_det(:,1,idx) - Ibeta(:) = psi_det(:,2,idx) - call get_phase_qp_to_cfg(Ialpha, Ibeta, phasedet) - tempCoeff(countdet) = psi_coef(idx, istate)*phasedet - norm_det1 += tempCoeff(countdet)*tempCoeff(countdet) - countdet += 1 - enddo - - s = 0 - do k=1,N_int - if (psi_configuration(k,1,i) == 0_bit_kind) cycle - s = s + popcnt(psi_configuration(k,1,i)) - enddo - bfIcfg = max(1,nint((binom(s,(s+1)/2)-binom(s,((s+1)/2)+1)))) - - ! perhaps blocking with CFGs of same seniority - ! can be more efficient - allocate(tempBuffer(bfIcfg,ndetI)) - tempBuffer = DetToCSFTransformationMatrix(s,:bfIcfg,:ndetI) - - call dgemm('N','N', bfIcfg, 1, ndetI, 1.d0, tempBuffer, size(tempBuffer,1), tempCoeff, size(tempCoeff,1), 0.d0, psi_coef_config(countcsf+1), size(psi_coef_config,1)) - !call dgemv('N', NBFMax, maxDetDimPerBF, 1.d0, tempBuffer, size(tempBuffer,1), tempCoeff, 1, 0.d0, psi_coef_config(countcsf), 1) - - deallocate(tempCoeff) - deallocate(tempBuffer) - psi_config_data(i,1) = countcsf + 1 - countcsf += bfIcfg - psi_config_data(i,2) = countcsf - enddo - - END_PROVIDER diff --git a/src/csf/tree_utils.c b/src/csf/tree_utils.c deleted file mode 100644 index 5336a6da..00000000 --- a/src/csf/tree_utils.c +++ /dev/null @@ -1,309 +0,0 @@ -#include "tree_utils.h" - -void buildTree(Tree *bftree, - Node **inode, - int isomo, - int izeros, - int icpl, - int NSOMOMax, - int MSmax){ - - // Find the maximum parallel couplings 0 - // the maximum anti-parallel couplings 1 - int zeromax = MSmax + (NSOMOMax-MSmax)/2; - int onemax = NSOMOMax - zeromax; - - // Exit condition - if(isomo > NSOMOMax || icpl < 0 || izeros > zeromax ) return; - - // If we find a valid BF assign its address - if(isomo == NSOMOMax){ - (*inode)->addr = bftree->rootNode->addr; - bftree->rootNode->addr += 1; - return; - } - - // Call 0 branch - if(((*inode)->C0) == NULL && izeros+1 <= zeromax){ - ((*inode)->C0) = malloc(sizeof(Node)); - (*(*inode)->C0) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = *inode, .addr = -1, .cpl = 0, .iSOMO = isomo }; - buildTree(bftree, &(*inode)->C0, isomo+1, izeros+1, icpl+1, NSOMOMax, MSmax); - } - else buildTree(bftree, &(*inode)->C0, isomo+1, izeros+1, icpl+1, NSOMOMax, MSmax); - - // Call 1 branch - if(((*inode)->C1) == NULL && icpl-1 >= 0){ - ((*inode)->C1) = malloc(sizeof(Node)); - (*(*inode)->C1) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = *inode, .addr = -1, .cpl = 1, .iSOMO = isomo }; - buildTree(bftree, &(*inode)->C1, isomo+1, izeros+0, icpl-1, NSOMOMax, MSmax); - } - else buildTree(bftree, &(*inode)->C1, isomo+1, izeros+0, icpl-1, NSOMOMax, MSmax); - - return; -} - -void buildTreeDriver(Tree *bftree, int NSOMO, int MS, int *NBF){ - int isomo = 0; // counts the total number of SOMO's - int izeros= 0; // Counts the total number of parallel coupings (i.e. 0's) - int icpl = 0; // keep track of the ith ms (cannot be -ve) - int addr = 0; // Counts the total BF's - - buildTree(bftree, &(bftree->rootNode), isomo, izeros, icpl, NSOMO, MS); - - *NBF = bftree->rootNode->addr; -} - - -void getIthBF(Node *inode, int isomo, bool foundBF, int NSOMOMax, int getaddr, int *vecBF){ - // Exit condition - if(foundBF) return; - if(isomo > NSOMOMax) return; - if(inode == NULL) return; - - if(isomo == NSOMOMax){ - if(inode->addr == getaddr){ - int i; - for(i = NSOMOMax-1; i > -1; i--){ - vecBF[i] = inode->cpl; - inode = inode->PREV; - } - foundBF = true; - return; - } - } - - // Recurse to C0 - if(inode->C0 != NULL){ - getIthBF(inode->C0, isomo+1, foundBF, NSOMOMax, getaddr, vecBF); - } - // Recurse to C1 - if(inode->C1 != NULL){ - getIthBF(inode->C1, isomo+1, foundBF, NSOMOMax, getaddr, vecBF); - } - - return; -} - -void getIthBFDriver(Tree *bftree, int NSOMOMax, int getaddr, int *vecBF){ - int isomo = 0; - bool foundBF = false; - getIthBF((bftree->rootNode), isomo, foundBF, NSOMOMax, getaddr, vecBF); -} - -void genDets(Tree *dettree, - Node **inode, - int isomo, - int izeros, - int icpl, - int NSOMOMax, - int MSmax){ - - // Find the maximum parallel couplings 0 - // the maximum anti-parallel couplings 1 - int zeromax = MSmax + (NSOMOMax-MSmax)/2; - int onemax = NSOMOMax - zeromax; - - // Exit condition - if(isomo > NSOMOMax || izeros > zeromax || abs(icpl) > onemax) return; - - // If we find a valid BF assign its address - if(isomo == NSOMOMax){ - (*inode)->addr = dettree->rootNode->addr; - dettree->rootNode->addr += 1; - return; - } - - // Call 0 branch - if(((*inode)->C0) == NULL && izeros+1 <= zeromax){ - ((*inode)->C0) = malloc(sizeof(Node)); - (*(*inode)->C0) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = *inode, .addr = -1, .cpl = 0, .iSOMO = isomo }; - genDets(dettree, &(*inode)->C0, isomo+1, izeros+1, icpl+0, NSOMOMax, MSmax); - } - else genDets(dettree, &(*inode)->C0, isomo+1, izeros+1, icpl+0, NSOMOMax, MSmax); - - // Call 1 branch - if(((*inode)->C1) == NULL && abs(icpl+1) <= onemax){ - ((*inode)->C1) = malloc(sizeof(Node)); - (*(*inode)->C1) = (Node){ .C0 = NULL, .C1 = NULL, .PREV = *inode, .addr = -1, .cpl = 1, .iSOMO = isomo }; - genDets(dettree, &(*inode)->C1, isomo+1, izeros+0, icpl+1, NSOMOMax, MSmax); - } - else genDets(dettree, &(*inode)->C1, isomo+1, izeros+0, icpl+1, NSOMOMax, MSmax); - - return; -} - -void genDetsDriver(Tree *dettree, int NSOMO, int MS, int *Ndets){ - int isomo = 0; // counts the total number of SOMO's - int izeros= 0; // Counts the total number of parallel coupings (i.e. 0's) - int icpl = 0; // keep track of the ith ms (cannot be -ve) - int addr = 0; // Counts the total BF's - - genDets(dettree, &(dettree->rootNode), isomo, izeros, icpl, NSOMO, MS); - - *Ndets = dettree->rootNode->addr; -} - -void getIthDet(Node *inode, int isomo, bool foundBF, int NSOMOMax, int getaddr, int *vecBF){ - // Exit condition - if(foundBF) return; - if(isomo > NSOMOMax) return; - if(inode == NULL) return; - - if(isomo == NSOMOMax){ - if(inode->addr == getaddr){ - int i; - for(i = NSOMOMax-1; i > -1; i--){ - vecBF[i] = inode->cpl; - inode = inode->PREV; - } - foundBF = true; - return; - } - } - - // Recurse to C0 - if(inode->C0 != NULL){ - getIthDet(inode->C0, isomo+1, foundBF, NSOMOMax, getaddr, vecBF); - } - // Recurse to C1 - if(inode->C1 != NULL){ - getIthDet(inode->C1, isomo+1, foundBF, NSOMOMax, getaddr, vecBF); - } - - return; -} - -void getIthDetDriver(Tree *dettree, int NSOMOMax, int getaddr, int *vecBF){ - int isomo = 0; - bool foundBF = false; - getIthDet((dettree->rootNode), isomo, foundBF, NSOMOMax, getaddr, vecBF); -} - -void findAddofDet(Node *inode, int isomo, bool foundDet, int NSOMOMax, int *inpdet, int *addr){ - // Exit condition - if(foundDet) return; - if(isomo == NSOMOMax){ - foundDet = true; - *addr = inode->addr; - return; - } - - // Recurse to C0 - if(inpdet[isomo] == 0){ - if(inode->C0 != NULL){ - findAddofDet(inode->C0, isomo+1, foundDet, NSOMOMax, inpdet, addr); - } - else{ - *addr = -1; - return; - } - } - else{ - // Recurse to C1 - if(inode->C1 != NULL){ - findAddofDet(inode->C1, isomo+1, foundDet, NSOMOMax, inpdet, addr); - } - else{ - *addr = -1; - return; - } - } - - return; -} - -void findAddofDetDriver(Tree *dettree, int NSOMOMax, int *inpdet, int *addr){ - *addr = -1; - int isomo = 0; - bool foundDet = false; - findAddofDet((dettree->rootNode), isomo, foundDet, NSOMOMax, inpdet, addr); -} - -void getDetlist(Node *inode, int isomo, int NSOMOMax, int *vecBF, int *detlist){ - // Exit condition - if(isomo > NSOMOMax) return; - if(inode == NULL) return; - - if(isomo == NSOMOMax){ - int idet=0; - int k; - for(k=0;kaddr]=idet; - return; - } - - - // Recurse to C0 - if(inode->C0 != NULL){ - vecBF[isomo] = 0; - getDetlist(inode->C0, isomo+1, NSOMOMax, vecBF, detlist); - } - // Recurse to C1 - if(inode->C1 != NULL){ - vecBF[isomo] = 1; - getDetlist(inode->C1, isomo+1, NSOMOMax, vecBF, detlist); - } - - return; -} - -void getDetlistDriver(Tree *dettree, int NSOMOMax, int *detlist){ - int isomo = 0; - int vecBF[NSOMOMax]; - if(dettree->rootNode->addr > 1) getDetlist((dettree->rootNode), isomo, NSOMOMax, vecBF, detlist); -} - -void genDetBasis(Tree *dettree, int Isomo, int MS, int *ndets){ - - int NSOMO=0; - getSetBits(Isomo, &NSOMO); - genDetsDriver(dettree, NSOMO, MS, ndets); - -} - -void callBlasMatxMat(double *A, int rowA, int colA, double *B, int rowB, int colB, double *C, bool transA, bool transB){ - int m = rowA; - int k = colA; - int n = colB; - double alpha = 1.0; - double beta = 0.0; - int val = 0; - - if (transA) val |= 0x1; - if (transB) val |= 0x2; - - switch (val) { - case 0: // notransA, notransB - m = rowA; - n = colB; - k = colA; - f_dgemm('N', 'N', n, m, k, alpha, B, n, A, k, beta, C, n); - break; - case 1: // transA, notransB - m = colA; - n = colB; - k = rowA; - f_dgemm('N', 'T', n, m, k, alpha, B, n, A, colA, beta, C, n); - break; - case 2: // notransA, transB - //m = rowA; - //n = rowB; - //k = colB; - m = rowA; - n = rowB; - k = colA; - f_dgemm('T', 'N', n, m, k, alpha, B, colB, A, k, beta, C, n); - break; - case 3: // transA, transB - m = colA; - n = rowB; - k = rowA; - f_dgemm('T', 'T', n, m, k, alpha, B, colB, A, colA, beta, C, n); - break; - default: - printf("Impossible !!!!\n"); - break; - } -} diff --git a/src/csf/tree_utils.h b/src/csf/tree_utils.h deleted file mode 100644 index 5a788149..00000000 --- a/src/csf/tree_utils.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef TREE_UTILS_H -#define TREE_UTILS_H -#include -#include -#include -#include -#include - -typedef struct bin_node Node; -typedef struct bin_tree Tree; -struct bin_node { - Node *C0; - Node *C1; - Node *PREV; - int addr; - int cpl; - int iSOMO; -}; - -struct bin_tree { - Node *rootNode; - int NBF; -}; - -void f_dgemm(const char transb, const char transa, const int n, const int m, const int k, - const double alpha, const double* B, const int ldb, const double* A, - const int lda, const double beta, double* C, const int ldc); - - - -#define MAX_SOMO 32 - -void buildTreeDriver(Tree *bftree, int NSOMO, int MS, int *NBF); - -void buildTree(Tree *bftree, Node **inode, int isomo, int izeros, int icpl, int NSOMOMax, int MSmax); - -void printTreeDriver(Tree *bftree, int NSOMOMax); -void printTree(Node *bftree, int isomo, int NSOMOMax, int *vecBF); - -void getIthBF(Node *node, int isomo, bool foundBF, int NSOMOMax, int getaddr, int *vecBF); -void getIthBFDriver(Tree *bftree, int NSOMOMax, int getaddr, int *vecBF); - -void getBFIndexList(int NSOMO, int *BF1, int *IdxListBF1); -void getIslands(int NSOMO, int *BF1, int *BF2, int *nislands, int *phasefactor); - -void generateAllBFs(int64_t Isomo, int64_t MS, Tree *bftree, int *NBF, int *NSOMO); -void getSetBits(int64_t n, int *nsetbits); -void getOverlapMatrix(int64_t Isomo, int64_t MS, double **overlapMatrixptr, int *rows, int *cols, int *NSOMOout); -void getOverlapMatrix_withDet(double *bftodetmatrixI, int rowsbftodetI, int colsbftodetI, int64_t Isomo, int64_t MS, double **overlapMatrixI, int *rowsI, int *colsI, int *NSOMO); -void gramSchmidt(double *overlapMatrix, int rows, int cols, double *orthoMatrix); - - -void calculateMETypeSOMOSOMO(int *BF1, int *BF2, int moi, int moj, double *factor, int *phasefactor); -void getOneElMETypeSOMOSOMO(int64_t Isomo, int64_t Jsomos, int moi, int moj, int MS, double **oneElMatrixElementsptr, int *rows, int *cols); - -/*********************** - -Determinant Tree utils -***********************/ - - -void genDets(Tree *dettree, - Node **inode, - int isomo, - int izeros, - int icpl, - int NSOMOMax, - int MSmax); -void genDetsDriver(Tree *dettree, int NSOMO, int MS, int *Ndets); - -void getIthDet(Node *inode, int isomo, bool foundBF, int NSOMOMax, int getaddr, int *vecBF); -void getIthDetDriver(Tree *dettree, int NSOMOMax, int getaddr, int *vecBF); -void getDetlistDriver(Tree *dettree, int NSOMOMax, int *detlist); -void findAddofDet(Node *inode, int isomo, bool foundDet, int NSOMOMax, int *inpdet, int *addr); -void findAddofDetDriver(Tree *dettree, int NSOMOMax, int *inpdet, int *addr); - - -/************************/ - -void genDetBasis(Tree *dettree, int Isomo, int MS, int *ndets); -void getbftodetfunction(Tree *dettree, int NSOMO, int MS, int *BF1, double *rowvec); -void convertBFtoDetBasis(int64_t Isomo, int MS, double **bftodetmatrixptr, int *rows, int *cols); - -// Misc utils -void int_to_bin_digit(int64_t in, int count, int* out); -void printRealMatrix(double *orthoMatrix, int rows, int cols); -void callBlasMatxMat(double *A, int rowA, int colA, double *B, int rowB, int colB, double *C, bool transA, bool transB); -void get_phase_cfg_to_qp_inpList(int *inpdet, int NSOMO, int *phaseout); -void get_phase_cfg_to_qp_inpInt(int inpdet, double *phaseout); - -#endif diff --git a/src/davidson/diagonalization_h_dressed.irp.f b/src/davidson/diagonalization_h_dressed.irp.f deleted file mode 100644 index a7e501ea..00000000 --- a/src/davidson/diagonalization_h_dressed.irp.f +++ /dev/null @@ -1,556 +0,0 @@ -subroutine davidson_diag_h(dets_in,u_in,dim_in,energies,sze,N_st,N_st_diag,Nint,dressing_state,converged) - use bitmasks - implicit none - BEGIN_DOC - ! Davidson diagonalization. - ! - ! dets_in : bitmasks corresponding to determinants - ! - ! u_in : guess coefficients on the various states. Overwritten - ! on exit - ! - ! dim_in : leftmost dimension of u_in - ! - ! sze : Number of determinants - ! - ! N_st : Number of eigenstates - ! - ! Initial guess vectors are not necessarily orthonormal - END_DOC - integer, intent(in) :: dim_in, sze, N_st, N_st_diag, Nint - integer(bit_kind), intent(in) :: dets_in(Nint,2,sze) - double precision, intent(inout) :: u_in(dim_in,N_st_diag) - double precision, intent(out) :: energies(N_st_diag) - integer, intent(in) :: dressing_state - logical, intent(out) :: converged - double precision, allocatable :: H_jj(:) - - double precision, external :: diag_H_mat_elem, diag_S_mat_elem - integer :: i,k - ASSERT (N_st > 0) - ASSERT (sze > 0) - ASSERT (Nint > 0) - ASSERT (Nint == N_int) - PROVIDE all_mo_integrals - allocate(H_jj(sze)) - - H_jj(1) = diag_h_mat_elem(dets_in(1,1,1),Nint) - !$OMP PARALLEL DEFAULT(NONE) & - !$OMP SHARED(sze,H_jj, dets_in,Nint) & - !$OMP PRIVATE(i) - !$OMP DO SCHEDULE(static) - do i=2,sze - H_jj(i) = diag_H_mat_elem(dets_in(1,1,i),Nint) - enddo - !$OMP END DO - !$OMP END PARALLEL - - if (dressing_state > 0) then - do k=1,N_st - do i=1,sze - H_jj(i) += u_in(i,k) * dressing_column_h(i,k) - enddo - enddo - endif - - call davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state,converged) - deallocate (H_jj) -end - - -subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,Nint,dressing_state,converged) - use bitmasks - use mmap_module - implicit none - BEGIN_DOC - ! Davidson diagonalization with specific diagonal elements of the H matrix - ! - ! H_jj : specific diagonal H matrix elements to diagonalize de Davidson - ! - ! dets_in : bitmasks corresponding to determinants - ! - ! u_in : guess coefficients on the various states. Overwritten - ! on exit - ! - ! dim_in : leftmost dimension of u_in - ! - ! sze : Number of determinants - ! - ! N_st : Number of eigenstates - ! - ! N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze - ! - ! Initial guess vectors are not necessarily orthonormal - END_DOC - integer, intent(in) :: dim_in, sze, N_st, N_st_diag_in, Nint - integer(bit_kind), intent(in) :: dets_in(Nint,2,sze) - double precision, intent(in) :: H_jj(sze) - integer, intent(in) :: dressing_state - double precision, intent(inout) :: u_in(dim_in,N_st_diag_in) - double precision, intent(out) :: energies(N_st_diag_in) - - integer :: iter, N_st_diag - integer :: i,j,k,l,m - logical, intent(inout) :: converged - - double precision, external :: u_dot_v, u_dot_u - - integer :: k_pairs, kl - - integer :: iter2, itertot - double precision, allocatable :: y(:,:), h(:,:), lambda(:) - double precision, allocatable :: s_tmp(:,:) - double precision :: diag_h_mat_elem - double precision, allocatable :: residual_norm(:) - character*(16384) :: write_buffer - double precision :: to_print(2,N_st) - double precision :: cpu, wall - integer :: shift, shift2, itermax, istate - double precision :: r1, r2, alpha - logical :: state_ok(N_st_diag_in*davidson_sze_max) - integer :: nproc_target - integer :: order(N_st_diag_in) - double precision :: cmax - double precision, allocatable :: U(:,:), overlap(:,:) - double precision, pointer :: W(:,:) - logical :: disk_based - double precision :: energy_shift(N_st_diag_in*davidson_sze_max) - - include 'constants.include.F' - - N_st_diag = N_st_diag_in - !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: U, W, y, h, lambda - if (N_st_diag*3 > sze) then - print *, 'error in Davidson :' - print *, 'Increase n_det_max_full to ', N_st_diag*3 - stop -1 - endif - - itermax = max(2,min(davidson_sze_max, sze/N_st_diag))+1 - itertot = 0 - - if (state_following) then - allocate(overlap(N_st_diag*itermax, N_st_diag*itermax)) - else - allocate(overlap(1,1)) ! avoid 'if' for deallocate - endif - overlap = 0.d0 - - PROVIDE nuclear_repulsion expected_s2 psi_bilinear_matrix_order psi_bilinear_matrix_order_reverse threshold_davidson_pt2 threshold_davidson_from_pt2 - - call write_time(6) - write(6,'(A)') '' - write(6,'(A)') 'Davidson Diagonalization' - write(6,'(A)') '------------------------' - write(6,'(A)') '' - - ! Find max number of cores to fit in memory - ! ----------------------------------------- - - nproc_target = nproc - double precision :: rss - integer :: maxab - maxab = max(N_det_alpha_unique, N_det_beta_unique)+1 - - m=1 - disk_based = .False. - call resident_memory(rss) - do - r1 = 8.d0 * &! bytes - ( dble(sze)*(N_st_diag*itermax) &! U - + 1.0d0*dble(sze*m)*(N_st_diag*itermax) &! W - + 3.0d0*(N_st_diag*itermax)**2 &! h,y,s_tmp - + 1.d0*(N_st_diag*itermax) &! lambda - + 1.d0*(N_st_diag) &! residual_norm - ! In H_u_0_nstates_zmq - + 2.d0*(N_st_diag*N_det) &! u_t, v_t, on collector - + 2.d0*(N_st_diag*N_det) &! u_t, v_t, on slave - + 0.5d0*maxab &! idx0 in H_u_0_nstates_openmp_work_* - + nproc_target * &! In OMP section - ( 1.d0*(N_int*maxab) &! buffer - + 3.5d0*(maxab) ) &! singles_a, singles_b, doubles, idx - ) / 1024.d0**3 - - if (nproc_target == 0) then - call check_mem(r1,irp_here) - nproc_target = 1 - exit - endif - - if (r1+rss < qp_max_mem) then - exit - endif - - if (itermax > 4) then - itermax = itermax - 1 - else if (m==1.and.disk_based_davidson) then - m=0 - disk_based = .True. - itermax = 6 - else - nproc_target = nproc_target - 1 - endif - - enddo - nthreads_davidson = nproc_target - TOUCH nthreads_davidson - call write_int(6,N_st,'Number of states') - call write_int(6,N_st_diag,'Number of states in diagonalization') - call write_int(6,sze,'Number of determinants') - call write_int(6,nproc_target,'Number of threads for diagonalization') - call write_double(6, r1, 'Memory(Gb)') - if (disk_based) then - print *, 'Using swap space to reduce RAM' - endif - - !--------------- - - write(6,'(A)') '' - write_buffer = '=====' - do i=1,N_st - write_buffer = trim(write_buffer)//' ================ ===========' - enddo - write(6,'(A)') write_buffer(1:6+41*N_st) - write_buffer = 'Iter' - do i=1,N_st - write_buffer = trim(write_buffer)//' Energy Residual ' - enddo - write(6,'(A)') write_buffer(1:6+41*N_st) - write_buffer = '=====' - do i=1,N_st - write_buffer = trim(write_buffer)//' ================ ===========' - enddo - write(6,'(A)') write_buffer(1:6+41*N_st) - - - if (disk_based) then - ! Create memory-mapped files for W and S - type(c_ptr) :: ptr_w, ptr_s - integer :: fd_s, fd_w - call mmap(trim(ezfio_work_dir)//'davidson_w', (/int(sze,8),int(N_st_diag*itermax,8)/),& - 8, fd_w, .False., .True., ptr_w) - call c_f_pointer(ptr_w, w, (/sze,N_st_diag*itermax/)) - else - allocate(W(sze,N_st_diag*itermax)) - endif - - allocate( & - ! Large - U(sze,N_st_diag*itermax), & - - ! Small - h(N_st_diag*itermax,N_st_diag*itermax), & - y(N_st_diag*itermax,N_st_diag*itermax), & - s_tmp(N_st_diag*itermax,N_st_diag*itermax), & - residual_norm(N_st_diag), & - lambda(N_st_diag*itermax)) - - h = 0.d0 - U = 0.d0 - y = 0.d0 - s_tmp = 0.d0 - - - ASSERT (N_st > 0) - ASSERT (N_st_diag >= N_st) - ASSERT (sze > 0) - ASSERT (Nint > 0) - ASSERT (Nint == N_int) - - ! Davidson iterations - ! =================== - - converged = .False. - - do k=N_st+1,N_st_diag - do i=1,sze - call random_number(r1) - call random_number(r2) - r1 = dsqrt(-2.d0*dlog(r1)) - r2 = dtwo_pi*r2 - u_in(i,k) = r1*dcos(r2) * u_in(i,k-N_st) - enddo - u_in(k,k) = u_in(k,k) + 10.d0 - enddo - do k=1,N_st_diag - call normalize(u_in(1,k),sze) - enddo - - do k=1,N_st_diag - do i=1,sze - U(i,k) = u_in(i,k) - enddo - enddo - - - do while (.not.converged) - itertot = itertot+1 - if (itertot == 8) then - exit - endif - - do iter=1,itermax-1 - - shift = N_st_diag*(iter-1) - shift2 = N_st_diag*iter - - if ((iter > 1).or.(itertot == 1)) then - ! Compute |W_k> = \sum_i |i> - ! ----------------------------------- - - if ((sze > 100000).and.distributed_davidson) then - call H_u_0_nstates_zmq (W(1,shift+1),U(1,shift+1),N_st_diag,sze) - else - call H_u_0_nstates_openmp(W(1,shift+1),U(1,shift+1),N_st_diag,sze) - endif - else - ! Already computed in update below - continue - endif - - if (dressing_state > 0) then - - if (N_st == 1) then - - l = dressed_column_idx(1) - double precision :: f - f = 1.0d0/psi_coef(l,1) - do istate=1,N_st_diag - do i=1,sze - W(i,shift+istate) += dressing_column_h(i,1) *f * U(l,shift+istate) - W(l,shift+istate) += dressing_column_h(i,1) *f * U(i,shift+istate) - enddo - - enddo - - else - - call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & - psi_coef, size(psi_coef,1), & - U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) - - call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & - dressing_column_h, size(dressing_column_h,1), s_tmp, size(s_tmp,1), & - 1.d0, W(1,shift+1), size(W,1)) - - - call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & - dressing_column_h, size(dressing_column_h,1), & - U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) - - call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & - psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & - 1.d0, W(1,shift+1), size(W,1)) - - endif - endif - - ! Compute h_kl = = - ! ------------------------------------------- - - call dgemm('T','N', shift2, shift2, sze, & - 1.d0, U, size(U,1), W, size(W,1), & - 0.d0, h, size(h,1)) - call dgemm('T','N', shift2, shift2, sze, & - 1.d0, U, size(U,1), U, size(U,1), & - 0.d0, s_tmp, size(s_tmp,1)) - - ! Diagonalize h - ! --------------- - - integer :: lwork, info - double precision, allocatable :: work(:) - - y = h - lwork = -1 - allocate(work(1)) - call dsygv(1,'V','U',shift2,y,size(y,1), & - s_tmp,size(s_tmp,1), lambda, work,lwork,info) - lwork = int(work(1)) - deallocate(work) - allocate(work(lwork)) - call dsygv(1,'V','U',shift2,y,size(y,1), & - s_tmp,size(s_tmp,1), lambda, work,lwork,info) - deallocate(work) - if (info /= 0) then - stop 'DSYGV Diagonalization failed' - endif - - ! Compute Energy for each eigenvector - ! ----------------------------------- - - call dgemm('N','N',shift2,shift2,shift2, & - 1.d0, h, size(h,1), y, size(y,1), & - 0.d0, s_tmp, size(s_tmp,1)) - - call dgemm('T','N',shift2,shift2,shift2, & - 1.d0, y, size(y,1), s_tmp, size(s_tmp,1), & - 0.d0, h, size(h,1)) - - do k=1,shift2 - lambda(k) = h(k,k) - enddo - - if (state_following) then - - overlap = -1.d0 - do k=1,shift2 - do i=1,shift2 - overlap(k,i) = dabs(y(k,i)) - enddo - enddo - do k=1,N_st - cmax = -1.d0 - do i=1,N_st - if (overlap(i,k) > cmax) then - cmax = overlap(i,k) - order(k) = i - endif - enddo - do i=1,N_st_diag - overlap(order(k),i) = -1.d0 - enddo - enddo - overlap = y - do k=1,N_st - l = order(k) - if (k /= l) then - y(1:shift2,k) = overlap(1:shift2,l) - endif - enddo - do k=1,N_st - overlap(k,1) = lambda(k) - enddo - - endif - - - ! Express eigenvectors of h in the determinant basis - ! -------------------------------------------------- - - call dgemm('N','N', sze, N_st_diag, shift2, & - 1.d0, U, size(U,1), y, size(y,1), 0.d0, U(1,shift2+1), size(U,1)) - call dgemm('N','N', sze, N_st_diag, shift2, & - 1.d0, W, size(W,1), y, size(y,1), 0.d0, W(1,shift2+1), size(W,1)) - - ! Compute residual vector and davidson step - ! ----------------------------------------- - - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) - do k=1,N_st_diag - do i=1,sze - U(i,shift2+k) = & - (lambda(k) * U(i,shift2+k) - W(i,shift2+k) ) & - /max(H_jj(i) - lambda (k),1.d-2) - enddo - - if (k <= N_st) then - residual_norm(k) = u_dot_u(U(1,shift2+k),sze) - to_print(1,k) = lambda(k) + nuclear_repulsion - to_print(2,k) = residual_norm(k) - endif - enddo - !$OMP END PARALLEL DO - - - if ((itertot>1).and.(iter == 1)) then - !don't print - continue - else - write(*,'(1X,I3,1X,100(1X,F16.10,1X,ES11.3))') iter-1, to_print(1:2,1:N_st) - endif - - ! Check convergence - if (iter > 1) then - if (threshold_davidson_from_pt2) then - converged = dabs(maxval(residual_norm(1:N_st))) < threshold_davidson_pt2 - else - converged = dabs(maxval(residual_norm(1:N_st))) < threshold_davidson - endif - endif - - do k=1,N_st - if (residual_norm(k) > 1.d8) then - print *, 'Davidson failed' - stop -1 - endif - enddo - if (converged) then - exit - endif - - logical, external :: qp_stop - if (qp_stop()) then - converged = .True. - exit - endif - - - enddo - - ! Re-contract U and update W - ! -------------------------------- - - call dgemm('N','N', sze, N_st_diag, shift2, 1.d0, & - W, size(W,1), y, size(y,1), 0.d0, u_in, size(u_in,1)) - do k=1,N_st_diag - do i=1,sze - W(i,k) = u_in(i,k) - enddo - enddo - - call dgemm('N','N', sze, N_st_diag, shift2, 1.d0, & - U, size(U,1), y, size(y,1), 0.d0, u_in, size(u_in,1)) - - do k=1,N_st_diag - do i=1,sze - U(i,k) = u_in(i,k) - enddo - enddo - - enddo - - - call nullify_small_elements(sze,N_st_diag,U,size(U,1),threshold_davidson_pt2) - do k=1,N_st_diag - do i=1,sze - u_in(i,k) = U(i,k) - enddo - enddo - - do k=1,N_st_diag - energies(k) = lambda(k) - enddo - write_buffer = '======' - do i=1,N_st - write_buffer = trim(write_buffer)//' ================ ===========' - enddo - write(6,'(A)') trim(write_buffer) - write(6,'(A)') '' - call write_time(6) - - if (disk_based)then - ! Remove temp files - integer, external :: getUnitAndOpen - call munmap( (/int(sze,8),int(N_st_diag*itermax,8)/), 8, fd_w, ptr_w ) - fd_w = getUnitAndOpen(trim(ezfio_work_dir)//'davidson_w','r') - close(fd_w,status='delete') - else - deallocate(W) - endif - - deallocate ( & - residual_norm, & - U, overlap, & - h, y, s_tmp, & - lambda & - ) - FREE nthreads_davidson -end - - - - - - - diff --git a/src/davidson/diagonalization_hcsf_dressed.irp.f b/src/davidson/diagonalization_hcsf_dressed.irp.f index 1fb24e08..e9e8cfc5 100644 --- a/src/davidson/diagonalization_hcsf_dressed.irp.f +++ b/src/davidson/diagonalization_hcsf_dressed.irp.f @@ -15,6 +15,7 @@ subroutine davidson_diag_h_csf(dets_in,u_in,dim_in,energies,sze,sze_csf,N_st,N_s ! ! N_st : Number of eigenstates ! + ! Initial guess vectors are not necessarily orthonormal END_DOC integer, intent(in) :: dim_in, sze, sze_csf, N_st, N_st_diag, Nint integer(bit_kind), intent(in) :: dets_in(Nint,2,sze) @@ -46,9 +47,14 @@ subroutine davidson_diag_h_csf(dets_in,u_in,dim_in,energies,sze,sze_csf,N_st,N_s if (dressing_state > 0) then do k=1,N_st + do i=1,sze - H_jj(i) += u_in(i,k) * dressing_column_h(i,k) + H_jj(i) += u_in(i,k) * dressing_column_h(i,k) enddo + + !l = dressed_column_idx(k) + !H_jj(l) += u_in(l,k) * dressing_column_h(l,k) + enddo endif @@ -79,6 +85,7 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N ! ! N_st_diag_in : Number of states in which H is diagonalized. Assumed > sze ! + ! Initial guess vectors are not necessarily orthonormal END_DOC integer, intent(in) :: dim_in, sze, sze_csf, N_st, N_st_diag_in, Nint integer(bit_kind), intent(in) :: dets_in(Nint,2,sze) @@ -97,7 +104,7 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N integer :: iter2, itertot double precision, allocatable :: y(:,:), h(:,:), lambda(:) - double precision, allocatable :: s_tmp(:,:) + double precision, allocatable :: s_tmp(:,:), prev_y(:,:) double precision :: diag_h_mat_elem double precision, allocatable :: residual_norm(:) character*(16384) :: write_buffer @@ -109,15 +116,23 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N integer :: nproc_target integer :: order(N_st_diag_in) double precision :: cmax - double precision, allocatable :: U(:,:), U_csf(:,:), overlap(:,:) + double precision, allocatable :: U(:,:), overlap(:,:) double precision, pointer :: W(:,:), W_csf(:,:) + double precision, allocatable :: U_csf(:,:), u_csf_in(:,:) logical :: disk_based double precision :: energy_shift(N_st_diag_in*davidson_sze_max) include 'constants.include.F' + if (sze /= N_det) then + call qp_bug(irp_here, -1, 'N_det /= sze') + endif + + if (sze_csf /= N_csf) then + call qp_bug(irp_here, -1, 'N_csf /= sze_csf') + endif + N_st_diag = N_st_diag_in - !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: U, W, y, h, lambda if (N_st_diag*3 > sze) then print *, 'error in Davidson :' print *, 'Increase n_det_max_full to ', N_st_diag*3 @@ -181,12 +196,11 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N exit endif - if (itermax > 4) then - itermax = itermax - 1 - else if (m==1.and.disk_based_davidson) then + if (disk_based_davidson) then m=0 disk_based = .True. - itermax = 6 + else if (itermax > 4) then + itermax = itermax - 1 else nproc_target = nproc_target - 1 endif @@ -225,24 +239,27 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N if (disk_based) then - ! Create memory-mapped files for W and S - type(c_ptr) :: ptr_w, ptr_s - integer :: fd_s, fd_w - call mmap(trim(ezfio_work_dir)//'davidson_w', (/int(sze,8),int(N_st_diag*itermax,8)/),& - 8, fd_w, .False., .True., ptr_w) - call c_f_pointer(ptr_w, W_csf, (/sze_csf,N_st_diag*itermax/)) + ! Create memory-mapped files for W + type(mmap_type) :: map_w, map_w_csf + + call mmap_create_d('', (/ 1_8*sze, 1_8*N_st_diag /), .False., .True., map_w) + call mmap_create_d('', (/ 1_8*sze_csf, 1_8*N_st_diag*itermax /), .False., .True., map_w_csf) + W => map_w%d2 + W_csf => map_w_csf%d2 else allocate(W(sze,N_st_diag),W_csf(sze_csf,N_st_diag*itermax)) endif allocate( & ! Large - U(sze,N_st_diag), & + U(sze,N_st_diag), & U_csf(sze_csf,N_st_diag*itermax), & + u_csf_in(sze_csf,N_st_diag), & ! Small h(N_st_diag*itermax,N_st_diag*itermax), & y(N_st_diag*itermax,N_st_diag*itermax), & + prev_y(N_st_diag*itermax,N_st_diag*itermax), & s_tmp(N_st_diag*itermax,N_st_diag*itermax), & residual_norm(N_st_diag), & lambda(N_st_diag*itermax)) @@ -252,6 +269,10 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N y = 0.d0 s_tmp = 0.d0 + prev_y = 0.d0 + do i = 1, N_st_diag*itermax + prev_y(i,i) = 1d0 + enddo ASSERT (N_st > 0) ASSERT (N_st_diag >= N_st) @@ -264,29 +285,34 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N converged = .False. + call convertWFfromDETtoCSF(N_st_diag,u_in,u_csf_in) + do k=N_st+1,N_st_diag - do i=1,sze + do i=1,sze_csf call random_number(r1) call random_number(r2) r1 = dsqrt(-2.d0*dlog(r1)) r2 = dtwo_pi*r2 - u_in(i,k) = r1*dcos(r2) * u_in(i,k-N_st) + u_csf_in(i,k) = r1*dcos(r2) * u_csf_in(i,k-N_st) enddo - u_in(k,k) = u_in(k,k) + 10.d0 + u_csf_in(k,k) = u_csf_in(k,k) + 10.d0 enddo + do k=1,N_st_diag - call normalize(u_in(1,k),sze) + call normalize(u_csf_in(1,k),sze_csf) enddo + call convertWFfromCSFtoDET(N_st_diag,u_csf_in,u_in) + do k=1,N_st_diag do i=1,sze U(i,k) = u_in(i,k) enddo + do i=1,sze_csf + U_csf(i,k) = u_csf_in(i,k) + enddo enddo - ! Make random verctors eigenstates of S2 - call convertWFfromDETtoCSF(N_st_diag,U(1,1),U_csf(1,1)) - call convertWFfromCSFtoDET(N_st_diag,U_csf(1,1),U(1,1)) do while (.not.converged) itertot = itertot+1 @@ -294,7 +320,10 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N exit endif - do iter=1,itermax-1 + iter = 0 + do while (iter < itermax-1) + iter += 1 +! do iter=1,itermax-1 shift = N_st_diag*(iter-1) shift2 = N_st_diag*iter @@ -303,7 +332,8 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N ! Compute |W_k> = \sum_i |i> ! ----------------------------------- - call convertWFfromCSFtoDET(N_st_diag,U_csf(1,shift+1),U) + call convertWFfromCSFtoDET(N_st_diag,U_csf(1:sze_csf,shift+1:shift2),U(1:sze,1:N_st_diag)) + if ((sze > 100000).and.distributed_davidson) then call H_u_0_nstates_zmq (W,U,N_st_diag,sze) else @@ -333,25 +363,25 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & psi_coef, size(psi_coef,1), & - U(1,1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) + U, size(U,1), 0.d0, s_tmp, size(s_tmp,1)) call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & dressing_column_h, size(dressing_column_h,1), s_tmp, size(s_tmp,1), & - 1.d0, W(1,1), size(W,1)) + 1.d0, W, size(W,1)) call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & dressing_column_h, size(dressing_column_h,1), & - U(1,1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) + U, size(U,1), 0.d0, s_tmp, size(s_tmp,1)) call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & - 1.d0, W(1,1), size(W,1)) + 1.d0, W, size(W,1)) endif endif - call convertWFfromDETtoCSF(N_st_diag,W,W_csf(1,shift+1)) + call convertWFfromDETtoCSF(N_st_diag,W(1:sze,1:N_st_diag),W_csf(1:sze_csf,shift+1:shift2)) ! Compute h_kl = = ! ------------------------------------------- @@ -360,11 +390,11 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N 1.d0, U_csf, size(U_csf,1), W_csf, size(W_csf,1), & 0.d0, h, size(h,1)) call dgemm('T','N', shift2, shift2, sze_csf, & - 1.d0, U_csf, size(U_csf,1), U_csf, size(U_csf,1), & + 1.d0, U_csf, size(U_csf,1), U_csf, size(U_csf,1), & 0.d0, s_tmp, size(s_tmp,1)) ! Diagonalize h - ! --------------- + ! ------------- integer :: lwork, info double precision, allocatable :: work(:) @@ -380,8 +410,14 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N call dsygv(1,'V','U',shift2,y,size(y,1), & s_tmp,size(s_tmp,1), lambda, work,lwork,info) deallocate(work) - if (info /= 0) then - stop 'DSYGV Diagonalization failed' + if (info > 0) then + ! Numerical errors propagate. We need to reduce the number of iterations + itermax = iter-1 + + ! eigenvectors of the previous iteration + y = prev_y + shift2 = shift2 - N_st_diag + exit endif ! Compute Energy for each eigenvector @@ -401,80 +437,139 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N if (state_following) then - overlap = -1.d0 - do i=1,shift2 - do k=1,shift2 - overlap(k,i) = dabs(y(k,i)) + integer :: state(N_st), idx + double precision :: omax + logical :: used + logical, allocatable :: ok(:) + double precision, allocatable :: overlp(:,:) + + allocate(overlp(shift2,N_st),ok(shift2)) + + overlp = 0d0 + do j = 1, shift2-1, N_st_diag + + ! Computes some states from the guess vectors + ! Psi(:,j:j+N_st_diag) = U_csf y(:,j:j+N_st_diag) and put them + ! in U(1,shift2+1:shift2+1+N_st_diag) as temporary array + call dgemm('N','N', sze_csf, N_st_diag, shift2, & + 1.d0, U_csf, size(U_csf,1), y(1,j), size(y,1), 0.d0, & + U_csf(1,shift2+1), size(U_csf,1)) + + ! Overlap + do l = 1, N_st + do k = 1, N_st_diag + do i = 1, sze_csf + overlp(k+j-1,l) += u_csf_in(i,l) * U_csf(i,shift2+k) + enddo + enddo enddo + enddo - do k=1,N_st - cmax = -1.d0 - do i=1,N_st - if (overlap(i,k) > cmax) then - cmax = overlap(i,k) - order(k) = i + + state = 0 + do l = 1, N_st + + omax = 0d0 + idx = 0 + do k = 1, shift2 + + ! Already used ? + used = .False. + do i = 1, N_st + if (state(i) == k) then + used = .True. + endif + enddo + + ! Maximum overlap + if ((dabs(overlp(k,l)) > omax) .and. (.not. used) .and. state_ok(k)) then + omax = dabs(overlp(k,l)) + idx = k endif enddo - do i=1,N_st_diag - overlap(order(k),i) = -1.d0 - enddo + + state(l) = idx enddo - overlap = y - do k=1,N_st - l = order(k) - if (k /= l) then - y(1:shift2,k) = overlap(1:shift2,l) + + ! Check if all states are attributed. If not, exit and N_st_diag will be increased. + do l=1,N_st + if (state(l) == 0) then + return endif enddo - do k=1,N_st - overlap(k,1) = lambda(k) + + ! tmp array before setting state_ok + ok = .False. + do l = 1, N_st + ok(state(l)) = .True. + enddo + + do k = 1, shift2 + if (.not. ok(k)) then + state_ok(k) = .False. + endif enddo + deallocate(overlp,ok) endif + do k=1,shift2 + if (.not. state_ok(k)) then + do l=k+1,shift2 + if (state_ok(l)) then + call dswap(shift2, y(1,k), 1, y(1,l), 1) + call dswap(1, lambda(k), 1, lambda(l), 1) + state_ok(k) = .True. + state_ok(l) = .False. + exit + endif + enddo + endif + enddo + + ! Swapped eigenvectors + prev_y = y + ! Express eigenvectors of h in the csf basis ! ------------------------------------------ call dgemm('N','N', sze_csf, N_st_diag, shift2, & - 1.d0, U_csf, size(U_csf,1), y, size(y,1), 0.d0, U_csf(1,shift2+1), size(U_csf,1)) - call convertWFfromCSFtoDET(N_st_diag,U_csf(1,shift2+1),U) - + 1.d0, U_csf, size(U_csf,1), y, size(y,1), 0.d0, & + U_csf(:,shift2+1:shift2+N_st_diag), size(U_csf,1)) call dgemm('N','N', sze_csf, N_st_diag, shift2, & - 1.d0, W_csf, size(W_csf,1), y, size(y,1), 0.d0, W_csf(1,shift2+1), size(W_csf,1)) - call convertWFfromCSFtoDET(N_st_diag,W_csf(1,shift2+1),W) + 1.d0, W_csf, size(W_csf,1), y, size(y,1), 0.d0, & + W_csf(:,shift2+1:shift2+N_st_diag), size(W_csf,1)) + + ! Express eigenvectors of h in the determinant basis + ! -------------------------------------------------- + + call convertWFfromCSFtoDET(N_st_diag,U_csf(:,shift2+1:shift2+N_st_diag),U) + call convertWFfromCSFtoDET(N_st_diag,W_csf(:,shift2+1:shift2+N_st_diag),W) ! Compute residual vector and davidson step ! ----------------------------------------- - if (without_diagonal) then - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) - do k=1,N_st_diag - do i=1,sze - U(i,k) = (lambda(k) * U(i,k) - W(i,k) ) & - /max(H_jj(i) - lambda (k),1.d-2) - enddo + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) + do k=1,N_st_diag + do i=1,sze + U(i,k) = & + (lambda(k) * U(i,k) - W(i,k) ) & + /max(dabs(H_jj(i) - lambda (k)),1.d-2) * dsign(1d0,H_jj(i) - lambda (k)) enddo - !$OMP END PARALLEL DO - else - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,k) - do k=1,N_st_diag - do i=1,sze - U(i,k) = (lambda(k) * U(i,k) - W(i,k) ) - enddo - enddo - !$OMP END PARALLEL DO - endif - do k=1,N_st - residual_norm(k) = u_dot_u(U(1,k),sze) - to_print(1,k) = lambda(k) + nuclear_repulsion - to_print(2,k) = residual_norm(k) + if (k <= N_st) then + residual_norm(k) = u_dot_u(U(1,k),sze) + to_print(1,k) = lambda(k) + nuclear_repulsion + to_print(2,k) = residual_norm(k) + endif enddo + !$OMP END PARALLEL DO + call convertWFfromDETtoCSF(N_st_diag,U,U_csf(1,shift2+1)) if ((itertot>1).and.(iter == 1)) then - !don't print + ! Don't print continue else write(*,'(1X,I3,1X,100(1X,F16.10,1X,ES11.3))') iter-1, to_print(1:2,1:N_st) @@ -508,14 +603,22 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N enddo - ! Re-contract U - ! ------------- + ! Re-contract U and update W + ! -------------------------- call dgemm('N','N', sze_csf, N_st_diag, shift2, 1.d0, & - U_csf, size(U_csf,1), y, size(y,1), 0.d0, u_in, size(u_in,1)) + W_csf, size(W_csf,1), y, size(y,1), 0.d0, u_csf_in, size(u_csf_in,1)) do k=1,N_st_diag do i=1,sze_csf - U_csf(i,k) = u_in(i,k) + W_csf(i,k) = u_csf_in(i,k) + enddo + enddo + + call dgemm('N','N', sze_csf, N_st_diag, shift2, 1.d0, & + U_csf, size(U_csf,1), y, size(y,1), 0.d0, u_csf_in, size(u_csf_in,1)) + do k=1,N_st_diag + do i=1,sze_csf + U_csf(i,k) = u_csf_in(i,k) enddo enddo call convertWFfromCSFtoDET(N_st_diag,U_csf,U) @@ -543,21 +646,21 @@ subroutine davidson_diag_csf_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,sze_csf,N if (disk_based)then ! Remove temp files - integer, external :: getUnitAndOpen - call munmap( (/int(sze,8),int(N_st_diag*itermax,8)/), 8, fd_w, ptr_w ) - fd_w = getUnitAndOpen(trim(ezfio_work_dir)//'davidson_w','r') - close(fd_w,status='delete') + call mmap_destroy(map_w) + call mmap_destroy(map_w_csf) else - deallocate(W, W_csf) + deallocate(W,W_csf) endif deallocate ( & residual_norm, & U, U_csf, overlap, & - h, y, s_tmp, & + h, u_csf_in, & + y, s_tmp, prev_y, & lambda & ) FREE nthreads_davidson + end diff --git a/src/davidson/diagonalization_hs2_dressed.irp.f b/src/davidson/diagonalization_hs2_dressed.irp.f index ce2cb63f..a1d38cd7 100644 --- a/src/davidson/diagonalization_hs2_dressed.irp.f +++ b/src/davidson/diagonalization_hs2_dressed.irp.f @@ -90,7 +90,7 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d endif call davidson_diag_hjj_sjj(dets_in,u_in,H_jj,S2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state,converged) - deallocate (H_jj) + deallocate(H_jj) end @@ -137,9 +137,9 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ integer :: k_pairs, kl integer :: iter2, itertot - double precision, allocatable :: y(:,:), h(:,:), h_p(:,:), lambda(:), s2(:) + double precision, allocatable :: y(:,:), h(:,:), lambda(:), s2(:) + double precision, allocatable :: s_tmp(:,:), prev_y(:,:), s_(:,:) real, allocatable :: y_s(:,:) - double precision, allocatable :: s_(:,:), s_tmp(:,:), prev_y(:,:) double precision :: diag_h_mat_elem double precision, allocatable :: residual_norm(:) character*(16384) :: write_buffer @@ -159,8 +159,17 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ include 'constants.include.F' + if (state_following.and. (.not. only_expected_s2)) then + print*,'' + print*,'!!! State following only available with only_expected_s2 = .True. !!!' + STOP -1 + endif + + if (sze /= N_det) then + call qp_bug(irp_here, -1, 'N_det /= sze') + endif + N_st_diag = N_st_diag_in - !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: U, W, S, y, y_s, S_d, h, lambda if (N_st_diag*3 > sze) then print *, 'error in Davidson :' print *, 'Increase n_det_max_full to ', N_st_diag*3 @@ -283,12 +292,11 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ ! Small h(N_st_diag*itermax,N_st_diag*itermax), & -! h_p(N_st_diag*itermax,N_st_diag*itermax), & y(N_st_diag*itermax,N_st_diag*itermax), & - prev_y(N_st_diag*itermax,N_st_diag*itermax), & - s_(N_st_diag*itermax,N_st_diag*itermax), & + prev_y(N_st_diag*itermax,N_st_diag*itermax), & s_tmp(N_st_diag*itermax,N_st_diag*itermax), & residual_norm(N_st_diag), & + s_(N_st_diag*itermax,N_st_diag*itermax), & s2(N_st_diag*itermax), & y_s(N_st_diag*itermax,N_st_diag*itermax), & lambda(N_st_diag*itermax)) @@ -355,11 +363,11 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ ! ----------------------------------- if ((sze > 100000).and.distributed_davidson) then - call H_S2_u_0_nstates_zmq (W(1,shift+1),S_d,U(1,shift+1),N_st_diag,sze) + call H_S2_u_0_nstates_zmq (W(1:sze,shift+1:shift2),S_d,U(1,shift+1),N_st_diag,sze) else - call H_S2_u_0_nstates_openmp(W(1,shift+1),S_d,U(1,shift+1),N_st_diag,sze) + call H_S2_u_0_nstates_openmp(W(1:sze,shift+1:shift2),S_d,U(1,shift+1),N_st_diag,sze) endif - S(1:sze,shift+1:shift+N_st_diag) = real(S_d(1:sze,1:N_st_diag)) + S(1:sze,shift+1:shift2) = real(S_d(1:sze,1:N_st_diag)) ! else ! ! Already computed in update below ! continue @@ -386,11 +394,11 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & psi_coef, size(psi_coef,1), & - U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) + U(:,shift+1:shift2), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & dressing_column_h, size(dressing_column_h,1), s_tmp, size(s_tmp,1), & - 1.d0, W(1,shift+1), size(W,1)) + 1.d0, W(:,shift+1:shift2), size(W,1)) call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & dressing_column_s, size(dressing_column_s,1), s_tmp, size(s_tmp,1), & @@ -399,15 +407,15 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & dressing_column_h, size(dressing_column_h,1), & - U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) + U(:,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & - 1.d0, W(1,shift+1), size(W,1)) + 1.d0, W(:,shift+1:shift2), size(W,1)) call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & dressing_column_s, size(dressing_column_s,1), & - U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) + U(:,shift+1:shift2), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) call dgemm('N','N', sze, N_st_diag, N_st, 1.0d0, & psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & @@ -440,34 +448,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ 1.d0, U, size(U,1), U, size(U,1), & 0.d0, s_tmp, size(s_tmp,1)) -! ! Penalty method -! ! -------------- -! -! if (s2_eig) then -! h_p = s_ -! do k=1,shift2 -! h_p(k,k) = h_p(k,k) - expected_s2 -! enddo -! if (only_expected_s2) then -! alpha = 0.1d0 -! h_p = h + alpha*h_p -! else -! alpha = 0.0001d0 -! h_p = h + alpha*h_p -! endif -! else -! h_p = h -! alpha = 0.d0 -! endif - - ! Diagonalize h_p - ! --------------- + ! Diagonalize h + ! ------------- integer :: lwork, info double precision, allocatable :: work(:) y = h -! y = h_p ! Doesn't work for non-singlets lwork = -1 allocate(work(1)) call dsygv(1,'V','U',shift2,y,size(y,1), & @@ -528,14 +515,6 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ enddo endif - if (state_following) then - if (.not. only_expected_s2) then - print*,'' - print*,'!!! State following only available with only_expected_s2 = .True. !!!' - STOP - endif - endif - if (state_following) then integer :: state(N_st), idx @@ -636,13 +615,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ ! -------------------------------------------------- call dgemm('N','N', sze, N_st_diag, shift2, & - 1.d0, U, size(U,1), y, size(y,1), 0.d0, U(1,shift2+1), size(U,1)) + 1.d0, U, size(U,1), y, size(y,1), 0.d0, U(:,shift2+1:shift2+N_st_diag), size(U,1)) call dgemm('N','N', sze, N_st_diag, shift2, & - 1.d0, W, size(W,1), y, size(y,1), 0.d0, W(1,shift2+1), size(W,1)) + 1.d0, W, size(W,1), y, size(y,1), 0.d0, W(:,shift2+1:shift2+N_st_diag), size(W,1)) y_s(:,:) = real(y(:,:)) call sgemm('N','N', sze, N_st_diag, shift2, & - 1., S, size(S,1), y_s, size(y_s,1), 0., S(1,shift2+1), size(S,1)) + 1., S, size(S,1), y_s, size(y_s,1), 0., S(:,shift2+1:shift2+N_st_diag), size(S,1)) ! Compute residual vector and davidson step ! ----------------------------------------- @@ -704,7 +683,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ ! -------------------------------- call sgemm('N','N', sze, N_st_diag, shift2, 1., & - S, size(S,1), y_s, size(y_s,1), 0., S(1,shift2+1), size(S,1)) + S, size(S,1), y_s, size(y_s,1), 0., S(:,shift2+1:shift2+N_st_diag), size(S,1)) do k=1,N_st_diag do i=1,sze S(i,k) = S(i,shift2+k) @@ -730,7 +709,6 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ enddo - call nullify_small_elements(sze,N_st_diag,U,size(U,1),threshold_davidson_pt2) do k=1,N_st_diag do i=1,sze diff --git a/src/davidson/diagonalization_nonsym_h_dressed.irp.f b/src/davidson/diagonalization_nonsym_h_dressed.irp.f index 3ac37f1d..e7481aa1 100644 --- a/src/davidson/diagonalization_nonsym_h_dressed.irp.f +++ b/src/davidson/diagonalization_nonsym_h_dressed.irp.f @@ -339,7 +339,7 @@ subroutine davidson_diag_nonsym_hjj(dets_in, u_in, H_jj, energies, dim_in, sze, if(dressing_state > 0) then call dgemm( 'T', 'N', N_st, N_st_diag, sze, 1.d0 & - , psi_coef, size(psi_coef, 1), U(1, shift+1), size(U, 1) & + , psi_coef, size(psi_coef, 1), U(:, shift+1:shift+N_st_diag), size(U, 1) & , 0.d0, u_tmp, size(u_tmp, 1)) do istate = 1, N_st_diag @@ -405,15 +405,15 @@ subroutine davidson_diag_nonsym_hjj(dets_in, u_in, H_jj, energies, dim_in, sze, call dgemm( 'N', 'N', sze, N_st_diag, shift2, 1.d0 & , U, size(U, 1), y, size(y, 1) & - , 0.d0, U(1,shift2+1), size(U, 1)) + , 0.d0, U(:,shift2+1:shift2+N_st_diag), size(U, 1)) do k = 1, N_st_diag - call normalize(U(1,shift2+k), sze) + call normalize(U(:,shift2+k), sze) enddo call dgemm( 'N', 'N', sze, N_st_diag, shift2, 1.d0 & , W, size(W, 1), y, size(y, 1) & - , 0.d0, W(1,shift2+1), size(W,1)) + , 0.d0, W(:,shift2+1:shift2+N_st_diag), size(W,1)) ! Compute residual vector and davidson step ! ----------------------------------------- diff --git a/src/davidson/u0_h_u0.irp.f b/src/davidson/u0_h_u0.irp.f index 808bbb5d..8978929f 100644 --- a/src/davidson/u0_h_u0.irp.f +++ b/src/davidson/u0_h_u0.irp.f @@ -46,7 +46,7 @@ subroutine u_0_H_u_0(e_0,u_0,n,keys_tmp,Nint,N_st,sze) do i=1,N_st norm = u_dot_u(u_0(1,i),n) if (norm /= 0.d0) then - e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n) / dsqrt(norm) + e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n)/norm else e_0(i) = 0.d0 endif @@ -164,7 +164,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, integer, allocatable :: doubles(:) integer, allocatable :: singles_a(:) integer, allocatable :: singles_b(:) - integer, allocatable :: idx(:), idx0(:) + integer, allocatable :: idx(:), buffer_lrow(:), idx0(:) integer :: maxab, n_singles_a, n_singles_b, kcol_prev integer*8 :: k8 logical :: compute_singles @@ -182,7 +182,8 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, compute_singles=.True. if (.not.compute_singles) then - provide singles_alpha_csc singles_beta_csc + provide singles_alpha_csc + provide singles_beta_csc endif @@ -216,7 +217,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, !$OMP PRIVATE(krow, kcol, tmp_det, spindet, k_a, k_b, i, & !$OMP lcol, lrow, l_a, l_b, utl, kk, u_is_sparse, & !$OMP buffer, doubles, n_doubles, umax, & - !$OMP tmp_det2, hij, idx, l, kcol_prev, & + !$OMP tmp_det2, hij, idx, buffer_lrow, l, kcol_prev, & !$OMP singles_a, n_singles_a, singles_b, ratio, & !$OMP n_singles_b, k8, last_found,left,right,right_max) @@ -227,7 +228,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, singles_a(maxab), & singles_b(maxab), & doubles(maxab), & - idx(maxab), utl(N_st,block_size)) + idx(maxab), buffer_lrow(maxab), utl(N_st,block_size)) kcol_prev=-1 @@ -251,7 +252,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, ASSERT (istart > 0) ASSERT (istep > 0) - !$OMP DO SCHEDULE(guided,64) + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep krow = psi_bilinear_matrix_rows(k_a) @@ -277,6 +278,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, singles_b(n_singles_b) = singles_beta_csc(k8) enddo endif + endif kcol_prev = kcol @@ -294,18 +296,20 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, l_a = psi_bilinear_matrix_columns_loc(lcol) ASSERT (l_a <= N_det) - !DIR$ UNROLL(8) - !DIR$ LOOP COUNT avg(50000) do j=1,psi_bilinear_matrix_columns_loc(lcol+1) - psi_bilinear_matrix_columns_loc(lcol) lrow = psi_bilinear_matrix_rows(l_a) ASSERT (lrow <= N_det_alpha_unique) - buffer(1:$N_int,j) = psi_det_alpha_unique(1:$N_int, lrow) ! hot spot + buffer_lrow(j) = lrow ASSERT (l_a <= N_det) idx(j) = l_a l_a = l_a+1 enddo + + do j=1,psi_bilinear_matrix_columns_loc(lcol+1) - psi_bilinear_matrix_columns_loc(lcol) + buffer(1:$N_int,j) = psi_det_alpha_unique(1:$N_int, buffer_lrow(j)) ! hot spot + enddo j = j-1 call get_all_spin_singles_$N_int( & @@ -373,7 +377,6 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, endif - ! Loop over alpha singles ! ----------------------- @@ -425,7 +428,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, enddo !$OMP END DO - !$OMP DO SCHEDULE(guided,64) + !$OMP DO SCHEDULE(dynamic,64) do k_a=istart+ishift,iend,istep @@ -555,6 +558,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, if (i+kk > n_doubles) exit l_a = doubles(i+kk) lrow = psi_bilinear_matrix_rows(l_a) + ! single => sij = 0 ASSERT (lrow <= N_det_alpha_unique) call i_H_j_double_spin( tmp_det(1,1), psi_det_alpha_unique(1, lrow), $N_int, hij) @@ -741,7 +745,7 @@ subroutine H_u_0_nstates_openmp_work_$N_int(v_t,u_t,N_st,sze,istart,iend,ishift, end do !$OMP END DO - deallocate(buffer, singles_a, singles_b, doubles, idx, utl) + deallocate(buffer, singles_a, singles_b, doubles, idx, buffer_lrow, utl) !$OMP END PARALLEL end diff --git a/src/davidson/u0_hs2_u0.irp.f b/src/davidson/u0_hs2_u0.irp.f index 9e8145fe..c6679d10 100644 --- a/src/davidson/u0_hs2_u0.irp.f +++ b/src/davidson/u0_hs2_u0.irp.f @@ -257,7 +257,7 @@ subroutine H_S2_u_0_nstates_openmp_work_$N_int(v_t,s_t,u_t,N_st,sze,istart,iend, !$OMP PRIVATE(krow, kcol, tmp_det, spindet, k_a, k_b, i, & !$OMP lcol, lrow, l_a, l_b, utl, kk, u_is_sparse, & !$OMP buffer, doubles, n_doubles, umax, & - !$OMP tmp_det2, hij, sij, idx, buffer_lrow, l, kcol_prev, & + !$OMP tmp_det2, hij, sij, idx, buffer_lrow, l, kcol_prev, & !$OMP singles_a, n_singles_a, singles_b, ratio, & !$OMP n_singles_b, k8, last_found,left,right,right_max) diff --git a/src/determinants/determinants.irp.f b/src/determinants/determinants.irp.f index 51d23bb8..eab45db4 100644 --- a/src/determinants/determinants.irp.f +++ b/src/determinants/determinants.irp.f @@ -334,6 +334,7 @@ BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,psi_det_size) ] &BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (psi_det_size,N_states) ] +&BEGIN_PROVIDER [ integer, psi_coef_sorted_bit_order, (psi_det_size) ] implicit none BEGIN_DOC ! Determinants on which we apply $\langle i|H|psi \rangle$ for perturbation. @@ -343,17 +344,18 @@ END_DOC call sort_dets_by_det_search_key(N_det, psi_det, psi_coef, size(psi_coef,1), & - psi_det_sorted_bit, psi_coef_sorted_bit, N_states) + psi_det_sorted_bit, psi_coef_sorted_bit, psi_coef_sorted_bit_order, N_states) END_PROVIDER -subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, sze, det_out, coef_out, N_st) +subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, sze, det_out, coef_out, iorder, N_st) use bitmasks implicit none integer, intent(in) :: Ndet, N_st, sze integer(bit_kind), intent(in) :: det_in (N_int,2,sze) double precision , intent(in) :: coef_in(sze,N_st) integer(bit_kind), intent(out) :: det_out (N_int,2,sze) + integer, intent(out) :: iorder(sze) double precision , intent(out) :: coef_out(sze,N_st) BEGIN_DOC ! Determinants are sorted according to their :c:func:`det_search_key`. @@ -364,11 +366,10 @@ subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, sze, det_out, coef ! END_DOC integer :: i,j,k - integer, allocatable :: iorder(:) integer*8, allocatable :: bit_tmp(:) integer*8, external :: det_search_key - allocate ( iorder(Ndet), bit_tmp(Ndet) ) + allocate ( bit_tmp(Ndet) ) do i=1,Ndet iorder(i) = i @@ -387,7 +388,7 @@ subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, sze, det_out, coef enddo enddo - deallocate(iorder, bit_tmp) + deallocate(bit_tmp) end diff --git a/src/determinants/h_apply.irp.f b/src/determinants/h_apply.irp.f index 65f1a832..fca90fa4 100644 --- a/src/determinants/h_apply.irp.f +++ b/src/determinants/h_apply.irp.f @@ -298,15 +298,16 @@ subroutine remove_duplicates_in_psi_det(found_duplicates) psi_coef(k,:) = psi_coef_sorted_bit(i,:) endif endif + psi_coef_sorted_bit_order(i) = i enddo N_det = k psi_det_sorted_bit(:,:,1:N_det) = psi_det(:,:,1:N_det) psi_coef_sorted_bit(1:N_det,:) = psi_coef(1:N_det,:) - TOUCH N_det psi_det psi_coef psi_det_sorted_bit psi_coef_sorted_bit c0_weight + TOUCH N_det psi_det psi_coef psi_det_sorted_bit psi_coef_sorted_bit psi_coef_sorted_bit_order c0_weight endif psi_det = psi_det_sorted psi_coef = psi_coef_sorted - SOFT_TOUCH psi_det psi_coef psi_det_sorted_bit psi_coef_sorted_bit + SOFT_TOUCH psi_det psi_coef psi_det_sorted_bit psi_coef_sorted_bit psi_coef_sorted_bit_order deallocate (duplicate,bit_tmp) end diff --git a/src/mo_two_e_ints/cholesky.irp.f b/src/mo_two_e_ints/cholesky.irp.f index f4e390af..e5788fcd 100644 --- a/src/mo_two_e_ints/cholesky.irp.f +++ b/src/mo_two_e_ints/cholesky.irp.f @@ -169,7 +169,7 @@ do j=1,mo_num do i=1,mo_num do k=1,cholesky_mo_num - cholesky_mo_transp_sp(k,i,j) = cholesky_mo_transp(k,i,j) + cholesky_mo_transp_sp(k,i,j) = real(cholesky_mo_transp(k,i,j),4) enddo enddo enddo diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index a5f62ec7..6ab6047a 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -774,47 +774,47 @@ subroutine export_trexio(update,full_path) icount = 0_8 rc = trexio_read_csf_num_64(f(1), icount) - print *, icount ! Write CSF to determinant mapping allocate (dc_index(2,BUFSIZE)) allocate (dc_value(BUFSIZE)) + integer :: i_cfg, i_csf, i_det + double precision, allocatable :: tmp(:,:) + double precision :: c + allocate(tmp(n_det_per_config_max,n_det_per_config_max)) + icount = 0_8 offset = 0_8 - icsf = 0 - do ii=1,N_configuration - startdet = psi_configuration_to_psi_det(1,ii) - enddet = psi_configuration_to_psi_det(2,ii) - - s = 0 - do k=1,N_int - if (psi_configuration(k,1,ii) == 0_bit_kind) cycle - s = s + popcnt(psi_configuration(k,1,ii)) - enddo - bfIcfg = max(1,int(binom(s,(s+1)/2)-binom(s,((s+1)/2)+1)+0.5d0)) - - do k=1,bfIcfg - icsf += 1 - do j = startdet, enddet - if (DetToCSFTransformationMatrix(s,k,j-startdet+1) == 0.d0) cycle - icount += 1_8 - idx = psi_configuration_to_psi_det_data(j) - call get_phase_qp_to_cfg(psi_det(1,1,idx), psi_det(1,2,idx), phasedet) - dc_index(1,icount) = icsf - dc_index(2,icount) = idx - dc_value(icount) = DetToCSFTransformationMatrix(s,k,j-startdet+1)*phasedet - if (icount == BUFSIZE) then - do i=1,N_states - rc = trexio_write_csf_det_coefficient(f(i), offset, icount, dc_index, dc_value) - call trexio_assert(rc, TREXIO_SUCCESS) - offset += icount - icount = 0_8 - end do - end if + + do i_cfg=1,N_configuration + + call get_det_csf_transformation(tmp, size(tmp,1), i_cfg) + + do i_csf=psi_configuration_to_psi_csf(1,i_cfg), psi_configuration_to_psi_csf(2,i_cfg) + + do i=psi_configuration_to_psi_det(1,i_cfg), psi_configuration_to_psi_det(2,i_cfg) + c = tmp(i - psi_configuration_to_psi_det(1,i_cfg)+1, & + i_csf - psi_configuration_to_psi_csf(1,i_cfg)+1) + if (dabs(c) > 1.d-12) then + i_det = psi_configuration_to_psi_det_data(i) + icount += 1_8 + dc_index(1,icount) = i_csf + dc_index(2,icount) = i_det + dc_value(icount) = c + if (icount == BUFSIZE) then + do ii=1,N_states + rc = trexio_write_csf_det_coefficient(f(ii), offset, icount, dc_index, & + dc_value) + call trexio_assert(rc, TREXIO_SUCCESS) + offset += icount + icount = 0_8 + end do + end if + endif end do end do - end do + enddo if (icount > 0_8) then do i=1,N_states From 8c1b875f414e096595d97ce9a6b4122101498735 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 17 Jul 2025 17:26:17 +0200 Subject: [PATCH 154/175] Reduced memory and fixed CI --- src/csf/csf.irp.f | 32 +++++++++++++++++++++++-- src/trexio/export_trexio_routines.irp.f | 7 +++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index 513b5c03..18a6ea14 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -1,7 +1,35 @@ +BEGIN_PROVIDER [ integer*8, det_csf_transformation_size ] + implicit none + BEGIN_DOC + ! Size of the det-csf transformation matrix + END_DOC + + integer :: i_cfg + integer*8 :: istart, iend, sze + + det_csf_transformation_size = 0_8 + + do i_cfg=1,N_configuration + + istart = psi_configuration_to_psi_det(1,i_cfg) + iend = psi_configuration_to_psi_det(2,i_cfg) + sze = iend-istart+1 + det_csf_transformation_size = det_csf_transformation_size + sze*sze + + enddo + + call write_time(6) + double precision :: memory + memory = dble(det_csf_transformation_size*8) / (1024.d0**3) + call write_double(6, memory, 'Det-CSF transformation matrix (GB)') + +END_PROVIDER + + BEGIN_PROVIDER [ integer, N_csf ] &BEGIN_PROVIDER [ integer, psi_configuration_to_psi_csf, (2,N_configuration) ] &BEGIN_PROVIDER [ integer, psi_configuration_n_csf, (N_configuration) ] -&BEGIN_PROVIDER [ double precision, det_csf_transformation, (n_det_per_config_max*n_det_per_config_max*N_configuration) ] +&BEGIN_PROVIDER [ double precision, det_csf_transformation, (det_csf_transformation_size)] &BEGIN_PROVIDER [ integer*8, det_csf_transformation_index, (N_configuration) ] implicit none BEGIN_DOC @@ -74,7 +102,7 @@ if (dabs(eigenvalues(j) - expected_s2) < 0.1d0) then i_csf = i_csf + 1 det_csf_transformation(index:index+sze-1) = s2mat(1:sze,j) - index = index + sze + index = index + int(sze,8) end if enddo if (i_csf == 0) cycle diff --git a/src/trexio/export_trexio_routines.irp.f b/src/trexio/export_trexio_routines.irp.f index cf04d2a5..2951d71f 100644 --- a/src/trexio/export_trexio_routines.irp.f +++ b/src/trexio/export_trexio_routines.irp.f @@ -775,9 +775,10 @@ subroutine export_trexio(update,full_path) end do end if - do i=1,N_states - rc = trexio_write_csf_num(f(i), N_csf) - enddo +! TODO: activate with TREXIO 2.6 +! do i=1,N_states +! rc = trexio_write_csf_num(f(i), N_csf) +! enddo icount = 0_8 rc = trexio_read_csf_num_64(f(1), icount) From f55341845915e7e1d42688aa104acae43a30e306 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 17 Jul 2025 17:58:24 +0200 Subject: [PATCH 155/175] Compressed storage of det-csf matrix --- src/csf/csf.irp.f | 50 ++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index 18a6ea14..440a3ae8 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -18,25 +18,21 @@ enddo - call write_time(6) - double precision :: memory - memory = dble(det_csf_transformation_size*8) / (1024.d0**3) - call write_double(6, memory, 'Det-CSF transformation matrix (GB)') - END_PROVIDER BEGIN_PROVIDER [ integer, N_csf ] &BEGIN_PROVIDER [ integer, psi_configuration_to_psi_csf, (2,N_configuration) ] &BEGIN_PROVIDER [ integer, psi_configuration_n_csf, (N_configuration) ] -&BEGIN_PROVIDER [ double precision, det_csf_transformation, (det_csf_transformation_size)] +&BEGIN_PROVIDER [ integer, det_csf_transformation, (det_csf_transformation_size)] &BEGIN_PROVIDER [ integer*8, det_csf_transformation_index, (N_configuration) ] implicit none BEGIN_DOC ! First index is the CSF, second is index of the determinant in psi_det ! det_csf_transformation: Transformation matrix between determinants and CSF. First index is determinant, second is CSF. - ! det_csf_transformation contains all transformation matrices concatenated in - ! a flat 1D array to compress the storage. The address of the matrix is obtained from + ! det_csf_transformation contains all transformation matrices. The numbers are + ! converted into fixed-point precision (9 digits) and concatenated in ! a flat + ! 1D array to compress the storage. The address of the matrix is obtained from ! det_csf_transformation ! To get the transformation, call get_det_csf_transformation END_DOC @@ -73,7 +69,7 @@ if (sze == 1) then N_csf = N_csf + 1 - det_csf_transformation(index) = 1.d0 + det_csf_transformation(index) = 1000000000 psi_configuration_to_psi_csf(1,i_cfg) = N_csf psi_configuration_to_psi_csf(2,i_cfg) = N_csf psi_configuration_n_csf(i_cfg) = 1 @@ -98,10 +94,13 @@ psi_configuration_to_psi_csf(1,i_cfg) = N_csf+1 i_csf = 0 + + s2mat(1:sze,1:sze) = s2mat(1:sze,1:sze) * 1.d9 + do j=1,sze if (dabs(eigenvalues(j) - expected_s2) < 0.1d0) then i_csf = i_csf + 1 - det_csf_transformation(index:index+sze-1) = s2mat(1:sze,j) + det_csf_transformation(index:index+sze-1) = int(s2mat(1:sze,j),4) index = index + int(sze,8) end if enddo @@ -140,8 +139,9 @@ subroutine get_det_csf_transformation(matrix, dim, i_cfg) integer :: i, j do j=1,ncsf - matrix(1:ndet,j) = det_csf_transformation(index:index+ndet-1) - index = index+1 + matrix(1:ndet,j) = dble(det_csf_transformation(index:index+ndet-1)) + matrix(1:ndet,j) = matrix(1:ndet,j)*1.d-9 + index = index+ndet enddo end @@ -155,12 +155,13 @@ subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_csf_out) double precision, intent(in) :: psi_coef_det_in(N_det,N_st) double precision, intent(out) :: psi_coef_csf_out(N_csf,N_st) - integer :: i_state, i, i_csf, i_cfg + integer :: i_state, i, i_csf, i_cfg, j integer :: startdet, enddet, i_det, j_det - double precision, allocatable :: coef(:,:) + double precision, allocatable :: coef(:,:), matrix(:,:) allocate (coef(n_det_per_config_max,N_st)) + allocate (matrix(n_det_per_config_max,n_det_per_config_max)) do i_cfg=1,N_configuration @@ -189,8 +190,14 @@ subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_csf_out) ncsf = psi_configuration_n_csf(i_cfg) ndet = psi_configuration_n_det(i_cfg) + do j=1,ncsf + matrix(1:ndet,j) = dble(det_csf_transformation(index:index+ndet-1)) + matrix(1:ndet,j) = matrix(1:ndet,j)*1.d-9 + index = index+ndet + enddo + call dgemm('T','N', ncsf, N_st, ndet, 1.d0, & - det_csf_transformation(index), ndet, & + matrix, size(matrix,1), & coef, size(coef,1), & 0.d0, psi_coef_csf_out( psi_configuration_to_psi_csf(1,i_cfg), 1), & size(psi_coef_csf_out,1)) @@ -211,12 +218,13 @@ subroutine convertWFfromCSFtoDET(N_st,psi_coef_csf_in, psi_coef_det_out) double precision, intent(in) :: psi_coef_csf_in(N_csf,N_st) double precision, intent(out) :: psi_coef_det_out(N_det,N_st) - integer :: i_state, i, i_csf, i_cfg + integer :: i_state, i, i_csf, i_cfg, j integer :: startdet, enddet, i_det, j_det - double precision, allocatable :: coef(:,:) + double precision, allocatable :: coef(:,:), matrix(:,:) allocate (coef(n_det_per_config_max,N_st)) + allocate (matrix(n_det_per_config_max,n_det_per_config_max)) do i_cfg=1,N_configuration @@ -235,8 +243,14 @@ subroutine convertWFfromCSFtoDET(N_st,psi_coef_csf_in, psi_coef_det_out) ncsf = psi_configuration_n_csf(i_cfg) ndet = psi_configuration_n_det(i_cfg) + do j=1,ncsf + matrix(1:ndet,j) = dble(det_csf_transformation(index:index+ndet-1)) + matrix(1:ndet,j) = matrix(1:ndet,j)*1.d-9 + index = index+ndet + enddo + call dgemm('N','N', ndet, N_st, ncsf, 1.d0, & - det_csf_transformation(index), ndet, & + matrix, size(matrix,1), & psi_coef_csf_in( psi_configuration_to_psi_csf(1,i_cfg), 1), & size(psi_coef_csf_in,1), & 0.d0, coef, size(coef,1)) From 6871561debef86b97806acfc1b7290afba7812d3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 17 Jul 2025 20:02:13 +0200 Subject: [PATCH 156/175] Compressed even more storage of CSF-Det with a hash table --- src/csf/csf.irp.f | 74 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 18 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index 440a3ae8..8ed31b73 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -24,7 +24,8 @@ BEGIN_PROVIDER [ integer, N_csf ] &BEGIN_PROVIDER [ integer, psi_configuration_to_psi_csf, (2,N_configuration) ] &BEGIN_PROVIDER [ integer, psi_configuration_n_csf, (N_configuration) ] -&BEGIN_PROVIDER [ integer, det_csf_transformation, (det_csf_transformation_size)] +&BEGIN_PROVIDER [ integer*2, det_csf_transformation, (det_csf_transformation_size)] +&BEGIN_PROVIDER [ double precision, csf_compressed, (-32768:32768) ] &BEGIN_PROVIDER [ integer*8, det_csf_transformation_index, (N_configuration) ] implicit none BEGIN_DOC @@ -46,6 +47,9 @@ double precision, allocatable :: eigenvalues(:), work(:) integer :: info integer*8 :: index + integer*2 :: compressed + integer*2 :: min_compressed + double precision, parameter :: undefined = 2.d0 lwork = n_det_per_config_max**3 @@ -54,7 +58,12 @@ N_csf = 0 index = 1_8 + min_compressed = -32767_2 + csf_compressed(:) = undefined + csf_compressed(0) = 0.d0 + csf_compressed(huge(1_2)) = 1.d0 + csf_compressed(-huge(1_2)) = -1.d0 do i_cfg=1,N_configuration istart = psi_configuration_to_psi_det(1,i_cfg) @@ -69,7 +78,7 @@ if (sze == 1) then N_csf = N_csf + 1 - det_csf_transformation(index) = 1000000000 + det_csf_transformation(index) = huge(1_2) psi_configuration_to_psi_csf(1,i_cfg) = N_csf psi_configuration_to_psi_csf(2,i_cfg) = N_csf psi_configuration_n_csf(i_cfg) = 1 @@ -95,13 +104,30 @@ psi_configuration_to_psi_csf(1,i_cfg) = N_csf+1 i_csf = 0 - s2mat(1:sze,1:sze) = s2mat(1:sze,1:sze) * 1.d9 - do j=1,sze if (dabs(eigenvalues(j) - expected_s2) < 0.1d0) then i_csf = i_csf + 1 - det_csf_transformation(index:index+sze-1) = int(s2mat(1:sze,j),4) - index = index + int(sze,8) + do i=1,sze + compressed = int(s2mat(i,j)*dble(huge(1_2)), 2) + if ( (csf_compressed(compressed) /= undefined).and. & + (dabs(csf_compressed(compressed) - s2mat(i,j)) > 1.d-9) ) then + compressed = min_compressed + do while (compressed < huge(1_2)) + if (csf_compressed(compressed) == undefined) exit + if (dabs(csf_compressed(compressed) - s2mat(i,j)) < 1.d-9) exit + compressed = compressed + 1_2 + end do + if (compressed == huge(1_2) ) then + do compressed=-huge(1_2), huge(1_2) + print *, compressed, csf_compressed(compressed) + enddo + call qp_bug(irp_here, 1_4*huge(1_2), 'Hash table full') + endif + endif + csf_compressed(compressed) = s2mat(i,j) + det_csf_transformation(index) = compressed + index = index + 1_8 + end do end if enddo if (i_csf == 0) cycle @@ -123,7 +149,8 @@ subroutine get_det_csf_transformation(matrix, dim, i_cfg) double precision, intent(out) :: matrix(dim,dim) integer, intent(in) :: dim, i_cfg - integer :: index, ncsf, ndet + integer*8 :: index + integer :: ncsf, ndet ndet = psi_configuration_n_det(i_cfg) if (ndet == 1) then @@ -138,10 +165,13 @@ subroutine get_det_csf_transformation(matrix, dim, i_cfg) if (dim < ncsf) call qp_bug(irp_here, 2, 'dimensions too small') integer :: i, j + integer*2 :: compressed do j=1,ncsf - matrix(1:ndet,j) = dble(det_csf_transformation(index:index+ndet-1)) - matrix(1:ndet,j) = matrix(1:ndet,j)*1.d-9 - index = index+ndet + do i=1,ndet + compressed = det_csf_transformation(index) + matrix(i,j) = csf_compressed(compressed) + index = index+1_8 + end do enddo end @@ -185,15 +215,19 @@ subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_csf_out) else - integer :: index, ncsf, ndet + integer*8 :: index + integer :: ncsf, ndet index = det_csf_transformation_index(i_cfg) ncsf = psi_configuration_n_csf(i_cfg) ndet = psi_configuration_n_det(i_cfg) + integer*2 :: compressed do j=1,ncsf - matrix(1:ndet,j) = dble(det_csf_transformation(index:index+ndet-1)) - matrix(1:ndet,j) = matrix(1:ndet,j)*1.d-9 - index = index+ndet + do i=1,ndet + compressed = det_csf_transformation(index) + matrix(i,j) = csf_compressed(compressed) + index = index+1_8 + end do enddo call dgemm('T','N', ncsf, N_st, ndet, 1.d0, & @@ -238,15 +272,19 @@ subroutine convertWFfromCSFtoDET(N_st,psi_coef_csf_in, psi_coef_det_out) else - integer :: index, ncsf, ndet + integer*8 :: index + integer :: ncsf, ndet index = det_csf_transformation_index(i_cfg) ncsf = psi_configuration_n_csf(i_cfg) ndet = psi_configuration_n_det(i_cfg) + integer*2 :: compressed do j=1,ncsf - matrix(1:ndet,j) = dble(det_csf_transformation(index:index+ndet-1)) - matrix(1:ndet,j) = matrix(1:ndet,j)*1.d-9 - index = index+ndet + do i=1,ndet + compressed = det_csf_transformation(index) + matrix(i,j) = csf_compressed(compressed) + index = index+1_8 + end do enddo call dgemm('N','N', ndet, N_st, ncsf, 1.d0, & From 962ae56afa9e14737f91be7c01ee3ef44e1bd0e3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Jul 2025 10:37:12 +0200 Subject: [PATCH 157/175] Moved ezfio data from davidson to davidson_keywords --- src/davidson/EZFIO.cfg | 18 ------------------ src/davidson_keywords/EZFIO.cfg | 12 ++++++++++++ 2 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 src/davidson/EZFIO.cfg diff --git a/src/davidson/EZFIO.cfg b/src/davidson/EZFIO.cfg deleted file mode 100644 index 1152560f..00000000 --- a/src/davidson/EZFIO.cfg +++ /dev/null @@ -1,18 +0,0 @@ -[csf_based] -type: logical -doc: If |true|, use the CSF-based algorithm -default: False -interface: ezfio,provider,ocaml - -[only_expected_s2] -type: logical -doc: If |true|, use filter out all vectors with bad |S^2| values -default: True -interface: ezfio,provider,ocaml - -[without_diagonal] -type: logical -doc: If |true|, don't use denominator -default: False -interface: ezfio,provider,ocaml - diff --git a/src/davidson_keywords/EZFIO.cfg b/src/davidson_keywords/EZFIO.cfg index 81b7f949..bbc6edfd 100644 --- a/src/davidson_keywords/EZFIO.cfg +++ b/src/davidson_keywords/EZFIO.cfg @@ -52,3 +52,15 @@ doc: If |true|, use the distributed algorithm. If you plan to run multi-node cal default: False interface: ezfio,provider,ocaml +[only_expected_s2] +type: logical +doc: If |true|, use filter out all vectors with bad |S^2| values +default: True +interface: ezfio,provider,ocaml + +[csf_based] +type: logical +doc: If |true|, use the CSF-based algorithm. Keeps only vectors with expected_s2 +default: False +interface: ezfio,provider,ocaml + From be8e6520284338cda62a9d834900063384ba3fc7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Jul 2025 12:50:21 +0200 Subject: [PATCH 158/175] higher compression of CSF vectors --- src/csf/csf.irp.f | 165 +++++++++++++++++++++------------------------- 1 file changed, 75 insertions(+), 90 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index 8ed31b73..d9ef0835 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -1,69 +1,52 @@ -BEGIN_PROVIDER [ integer*8, det_csf_transformation_size ] +BEGIN_PROVIDER [ integer, csf_unique_vector_value_size ] implicit none BEGIN_DOC - ! Size of the det-csf transformation matrix + ! Is reset in the provider of csf_unique_vector_value END_DOC - - integer :: i_cfg - integer*8 :: istart, iend, sze - - det_csf_transformation_size = 0_8 - - do i_cfg=1,N_configuration - - istart = psi_configuration_to_psi_det(1,i_cfg) - iend = psi_configuration_to_psi_det(2,i_cfg) - sze = iend-istart+1 - det_csf_transformation_size = det_csf_transformation_size + sze*sze - - enddo - + csf_unique_vector_value_size = 10 END_PROVIDER BEGIN_PROVIDER [ integer, N_csf ] &BEGIN_PROVIDER [ integer, psi_configuration_to_psi_csf, (2,N_configuration) ] &BEGIN_PROVIDER [ integer, psi_configuration_n_csf, (N_configuration) ] -&BEGIN_PROVIDER [ integer*2, det_csf_transformation, (det_csf_transformation_size)] -&BEGIN_PROVIDER [ double precision, csf_compressed, (-32768:32768) ] -&BEGIN_PROVIDER [ integer*8, det_csf_transformation_index, (N_configuration) ] +&BEGIN_PROVIDER [ integer, csf_unique_vector_index, (N_det) ] +&BEGIN_PROVIDER [ double precision, csf_unique_vector_value, (csf_unique_vector_value_size) ] implicit none BEGIN_DOC - ! First index is the CSF, second is index of the determinant in psi_det - ! det_csf_transformation: Transformation matrix between determinants and CSF. First index is determinant, second is CSF. - ! det_csf_transformation contains all transformation matrices. The numbers are - ! converted into fixed-point precision (9 digits) and concatenated in ! a flat - ! 1D array to compress the storage. The address of the matrix is obtained from - ! det_csf_transformation - ! To get the transformation, call get_det_csf_transformation + ! To get the det-csf transformation matrix, call get_det_csf_transformation END_DOC integer :: i_det, j_det - integer :: i_cfg, i_csf, i, j, lwork + integer :: i_cfg, i_csf, i, j, k, lwork integer :: sze, istart, iend double precision, allocatable :: s2mat(:,:) double precision :: sij double precision, allocatable :: eigenvalues(:), work(:) integer :: info - integer*8 :: index + integer :: index, index_max, n_unique integer*2 :: compressed - integer*2 :: min_compressed double precision, parameter :: undefined = 2.d0 + double precision, allocatable :: resize_array(:) + logical :: found + integer, allocatable :: unique_index(:) + + PROVIDE expected_s2 N_int psi_det lwork = n_det_per_config_max**3 allocate(eigenvalues(n_det_per_config_max), work(lwork)) allocate(s2mat(n_det_per_config_max,n_det_per_config_max)) + allocate(unique_index(N_det)) N_csf = 0 - index = 1_8 - min_compressed = -32767_2 - csf_compressed(:) = undefined - csf_compressed(0) = 0.d0 - csf_compressed(huge(1_2)) = 1.d0 - csf_compressed(-huge(1_2)) = -1.d0 + n_unique = 1 + unique_index(1) = 1 + csf_unique_vector_value(1) = 1.d0 + index_max = 2 + do i_cfg=1,N_configuration istart = psi_configuration_to_psi_det(1,i_cfg) @@ -74,15 +57,13 @@ call qp_bug(irp_here, -1, 'Configuration has more determinants than allowed by n_det_per_config_max') endif - det_csf_transformation_index(i_cfg) = index if (sze == 1) then N_csf = N_csf + 1 - det_csf_transformation(index) = huge(1_2) + csf_unique_vector_index(N_csf) = 1 psi_configuration_to_psi_csf(1,i_cfg) = N_csf psi_configuration_to_psi_csf(2,i_cfg) = N_csf psi_configuration_n_csf(i_cfg) = 1 - index = index + 1_8 else @@ -107,31 +88,51 @@ do j=1,sze if (dabs(eigenvalues(j) - expected_s2) < 0.1d0) then i_csf = i_csf + 1 - do i=1,sze - compressed = int(s2mat(i,j)*dble(huge(1_2)), 2) - if ( (csf_compressed(compressed) /= undefined).and. & - (dabs(csf_compressed(compressed) - s2mat(i,j)) > 1.d-9) ) then - compressed = min_compressed - do while (compressed < huge(1_2)) - if (csf_compressed(compressed) == undefined) exit - if (dabs(csf_compressed(compressed) - s2mat(i,j)) < 1.d-9) exit - compressed = compressed + 1_2 - end do - if (compressed == huge(1_2) ) then - do compressed=-huge(1_2), huge(1_2) - print *, compressed, csf_compressed(compressed) - enddo - call qp_bug(irp_here, 1_4*huge(1_2), 'Hash table full') - endif - endif - csf_compressed(compressed) = s2mat(i,j) - det_csf_transformation(index) = compressed - index = index + 1_8 + N_csf = N_csf + 1 + + found = .False. + do k=2,n_unique + index = unique_index(k) + if (dabs(s2mat(1,j)-csf_unique_vector_value(index)) < 1.d-9) then + ! We have found that the 1st component matches, we now check the dot product + ! is 1. + double precision :: dot + dot = 0.d0 + do i=1,sze + dot = dot + s2mat(i,j)*csf_unique_vector_value(index+i-1) + enddo + if (dabs(1.d0-dot) < 1.d-9) then + csf_unique_vector_index(N_csf) = index + found = .True. + exit + end if + end if end do + + if (.not.found) then + + ! Reallocate csf_unique_vector_value 2x larger if needed + if (index_max+sze > csf_unique_vector_value_size) then + allocate(resize_array(csf_unique_vector_value_size)) + resize_array(:) = csf_unique_vector_value(:) + deallocate(csf_unique_vector_value) + allocate(csf_unique_vector_value(2*csf_unique_vector_value_size)) + csf_unique_vector_value(:csf_unique_vector_value_size) = resize_array(:) + deallocate(resize_array) + csf_unique_vector_value_size *= 2 +! SOFT_TOUCH csf_unique_vector_value_size + endif + + n_unique = n_unique+1 + csf_unique_vector_index(N_csf) = index_max + unique_index(n_unique) = index_max + csf_unique_vector_value(index_max:index_max+sze-1) = s2mat(1:sze,j) + index_max = index_max + sze + end if + end if enddo if (i_csf == 0) cycle - N_csf = N_csf + i_csf psi_configuration_n_csf(i_cfg) = i_csf psi_configuration_to_psi_csf(2,i_cfg) = N_csf @@ -141,15 +142,17 @@ deallocate(s2mat, work, eigenvalues) - END_PROVIDER + + + + subroutine get_det_csf_transformation(matrix, dim, i_cfg) implicit none double precision, intent(out) :: matrix(dim,dim) integer, intent(in) :: dim, i_cfg - integer*8 :: index integer :: ncsf, ndet ndet = psi_configuration_n_det(i_cfg) @@ -158,24 +161,24 @@ subroutine get_det_csf_transformation(matrix, dim, i_cfg) return endif - index = det_csf_transformation_index(i_cfg) ncsf = psi_configuration_n_csf(i_cfg) if (dim < ndet) call qp_bug(irp_here, 1, 'dimensions too small') if (dim < ncsf) call qp_bug(irp_here, 2, 'dimensions too small') - integer :: i, j - integer*2 :: compressed + integer :: i, j, i_csf + integer :: index + i_csf = psi_configuration_to_psi_csf(1,i_cfg) do j=1,ncsf - do i=1,ndet - compressed = det_csf_transformation(index) - matrix(i,j) = csf_compressed(compressed) - index = index+1_8 - end do + i = csf_unique_vector_index(i_csf+j-1) + matrix(1:ndet,j) = csf_unique_vector_value(i:i+ndet-1) enddo end + + + subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_csf_out) implicit none BEGIN_DOC @@ -215,20 +218,11 @@ subroutine convertWFfromDETtoCSF(N_st,psi_coef_det_in, psi_coef_csf_out) else - integer*8 :: index integer :: ncsf, ndet - index = det_csf_transformation_index(i_cfg) ncsf = psi_configuration_n_csf(i_cfg) ndet = psi_configuration_n_det(i_cfg) - integer*2 :: compressed - do j=1,ncsf - do i=1,ndet - compressed = det_csf_transformation(index) - matrix(i,j) = csf_compressed(compressed) - index = index+1_8 - end do - enddo + call get_det_csf_transformation(matrix, size(matrix,1), i_cfg) call dgemm('T','N', ncsf, N_st, ndet, 1.d0, & matrix, size(matrix,1), & @@ -272,20 +266,11 @@ subroutine convertWFfromCSFtoDET(N_st,psi_coef_csf_in, psi_coef_det_out) else - integer*8 :: index integer :: ncsf, ndet - index = det_csf_transformation_index(i_cfg) ncsf = psi_configuration_n_csf(i_cfg) ndet = psi_configuration_n_det(i_cfg) - integer*2 :: compressed - do j=1,ncsf - do i=1,ndet - compressed = det_csf_transformation(index) - matrix(i,j) = csf_compressed(compressed) - index = index+1_8 - end do - enddo + call get_det_csf_transformation(matrix, size(matrix,1), i_cfg) call dgemm('N','N', ndet, N_st, ncsf, 1.d0, & matrix, size(matrix,1), & From fb6c715b57ebb967f95112ff6f0ffcd1c4bfb0bb Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Jul 2025 14:47:48 +0200 Subject: [PATCH 159/175] dim --- src/csf/csf.irp.f | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index d9ef0835..1a3c59c0 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -148,10 +148,10 @@ -subroutine get_det_csf_transformation(matrix, dim, i_cfg) +subroutine get_det_csf_transformation(matrix, dim1, i_cfg) implicit none - double precision, intent(out) :: matrix(dim,dim) - integer, intent(in) :: dim, i_cfg + double precision, intent(out) :: matrix(dim1,dim1) + integer, intent(in) :: dim1, i_cfg integer :: ncsf, ndet ndet = psi_configuration_n_det(i_cfg) @@ -163,8 +163,8 @@ subroutine get_det_csf_transformation(matrix, dim, i_cfg) ncsf = psi_configuration_n_csf(i_cfg) - if (dim < ndet) call qp_bug(irp_here, 1, 'dimensions too small') - if (dim < ncsf) call qp_bug(irp_here, 2, 'dimensions too small') + if (dim1 < ndet) call qp_bug(irp_here, 1, 'dimensions too small') + if (dim1 < ncsf) call qp_bug(irp_here, 2, 'dimensions too small') integer :: i, j, i_csf integer :: index From c404f5ea0ae7cc266a4676a07aa66a4d854dce54 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Jul 2025 14:51:39 +0200 Subject: [PATCH 160/175] sze --- src/csf/csf.irp.f | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index 1a3c59c0..a38772d3 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -148,10 +148,10 @@ -subroutine get_det_csf_transformation(matrix, dim1, i_cfg) +subroutine get_det_csf_transformation(matrix, sze, i_cfg) implicit none - double precision, intent(out) :: matrix(dim1,dim1) - integer, intent(in) :: dim1, i_cfg + double precision, intent(out) :: matrix(sze,sze) + integer, intent(in) :: sze, i_cfg integer :: ncsf, ndet ndet = psi_configuration_n_det(i_cfg) @@ -163,8 +163,8 @@ subroutine get_det_csf_transformation(matrix, dim1, i_cfg) ncsf = psi_configuration_n_csf(i_cfg) - if (dim1 < ndet) call qp_bug(irp_here, 1, 'dimensions too small') - if (dim1 < ncsf) call qp_bug(irp_here, 2, 'dimensions too small') + if (sze< ndet) call qp_bug(irp_here, 1, 'dimensions too small') + if (sze< ncsf) call qp_bug(irp_here, 2, 'dimensions too small') integer :: i, j, i_csf integer :: index From 57be8668717b816c690d635bbf64aaa0af1dbc9f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 Jul 2025 14:58:00 +0200 Subject: [PATCH 161/175] Fixed csf problem with ifort --- src/csf/csf.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index a38772d3..6371e70e 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -150,8 +150,8 @@ subroutine get_det_csf_transformation(matrix, sze, i_cfg) implicit none - double precision, intent(out) :: matrix(sze,sze) integer, intent(in) :: sze, i_cfg + double precision, intent(out) :: matrix(sze,sze) integer :: ncsf, ndet ndet = psi_configuration_n_det(i_cfg) From 209893944ff7cdbc665c76a1a8cf75a5c988c01e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 4 Sep 2025 15:13:58 +0200 Subject: [PATCH 162/175] Fixed bug in allocation in CSF --- src/csf/csf.irp.f | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/csf/csf.irp.f b/src/csf/csf.irp.f index 6371e70e..f999ce8f 100644 --- a/src/csf/csf.irp.f +++ b/src/csf/csf.irp.f @@ -112,14 +112,17 @@ if (.not.found) then ! Reallocate csf_unique_vector_value 2x larger if needed - if (index_max+sze > csf_unique_vector_value_size) then + if (index_max+sze >= csf_unique_vector_value_size) then + integer :: csf_unique_vector_value_size_new + csf_unique_vector_value_size_new = & + max(2*csf_unique_vector_value_size, index_max+sze) allocate(resize_array(csf_unique_vector_value_size)) resize_array(:) = csf_unique_vector_value(:) deallocate(csf_unique_vector_value) - allocate(csf_unique_vector_value(2*csf_unique_vector_value_size)) + allocate(csf_unique_vector_value(csf_unique_vector_value_size_new)) csf_unique_vector_value(:csf_unique_vector_value_size) = resize_array(:) deallocate(resize_array) - csf_unique_vector_value_size *= 2 + csf_unique_vector_value_size = csf_unique_vector_value_size_new ! SOFT_TOUCH csf_unique_vector_value_size endif From 4110ec5ad9932828a35f044b72e938396a8953c0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 9 Sep 2025 15:37:23 +0200 Subject: [PATCH 163/175] Text in swap_mos and rotate_mos.irp.f --- src/ccsd/ccsd_spin_orb_sub.irp.f | 2 +- src/tools/rotate_mos.irp.f | 5 +++++ src/tools/swap_mos.irp.f | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ccsd/ccsd_spin_orb_sub.irp.f b/src/ccsd/ccsd_spin_orb_sub.irp.f index 16062356..90e8bcb8 100644 --- a/src/ccsd/ccsd_spin_orb_sub.irp.f +++ b/src/ccsd/ccsd_spin_orb_sub.irp.f @@ -127,7 +127,7 @@ subroutine run_ccsd_spin_orb call update_t1(cc_nOab,cc_nVab,f_o,f_v,r1%f,t1%f) call update_t2(cc_nOab,cc_nVab,f_o,f_v,r2%f,t2%f) else - print*,'Unkonw cc_method_method: '//cc_update_method + print*,'Unknown cc_method_method: '//cc_update_method endif call compute_tau_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau%f) diff --git a/src/tools/rotate_mos.irp.f b/src/tools/rotate_mos.irp.f index 30185474..87684383 100644 --- a/src/tools/rotate_mos.irp.f +++ b/src/tools/rotate_mos.irp.f @@ -10,6 +10,11 @@ program rotate_mos double precision :: dsqrt2_inv double precision, allocatable :: mo_coef_tmp(:,:) + print *, 'Rotates molecular orbitals i and j by combining them as' + print *, ' $1/\sqrt{2} ( \phi_i + \phi_j )$ and' + print *, ' $1/\sqrt{2} ( \phi_i - \phi_j )$.' + print *, '' + print *, 'Input i and j:' read(5,*)iorb,jorb allocate(mo_coef_tmp(ao_num,mo_num)) diff --git a/src/tools/swap_mos.irp.f b/src/tools/swap_mos.irp.f index bba9cb34..46592cac 100644 --- a/src/tools/swap_mos.irp.f +++ b/src/tools/swap_mos.irp.f @@ -5,7 +5,9 @@ program swap_mos END_DOC integer :: i,j, i1, i2 double precision :: x - print *, 'MOs to swap?' + print *, 'Swaps molecular orbitals i and j.' + print *, '' + print *, 'Input i and j:' read(*,*) i1, i2 do i=1,ao_num x = mo_coef(i,i1) @@ -13,5 +15,5 @@ program swap_mos mo_coef(i,i2) = x enddo call save_mos - + end From b5f6006cbaa1e44a928aa244e24448f8ca7f95c3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 12 Sep 2025 10:23:03 +0200 Subject: [PATCH 164/175] Printed value of V_ee contained V_ecp --- .../basis_correction/print_routine.irp.f | 7 ++-- src/ccsd/ccsd_spin_orb_sub.irp.f | 4 ++- src/mo_two_e_ints/mo_bi_integrals.irp.f | 4 ++- src/mo_two_e_ints/mo_bi_integrals_erf.irp.f | 4 ++- src/mol_properties/print_e_components.irp.f | 21 +++++------ src/mu_of_r/mu_of_r_conditions.irp.f | 36 +++++++++++++++++-- src/two_rdm_routines/davidson_like_2rdm.irp.f | 8 ++--- src/utils_cc/diis.irp.f | 2 ++ 8 files changed, 61 insertions(+), 25 deletions(-) diff --git a/plugins/local/basis_correction/print_routine.irp.f b/plugins/local/basis_correction/print_routine.irp.f index b2fdef84..11fe0b31 100644 --- a/plugins/local/basis_correction/print_routine.irp.f +++ b/plugins/local/basis_correction/print_routine.irp.f @@ -81,9 +81,12 @@ subroutine print_basis_correction endif print*,'' print*,'**************' + write(*, *) 'Average mu(r)' do istate = 1, N_states - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) [rho ], state ',istate,' = ',mu_average_prov(istate) - write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) [rho^2], state ',istate,' = ',mu_average_prov2(istate) + write(*, *) 'State', istate + write(*, '(A60,X,''='',X,F16.10)') ' \int rho(r) mu(r) dr / \int rho(r) dr = ',mu_average_prov(istate) + write(*, '(A60,X,''='',X,F16.10)') ' \int rho(r)^2 mu(r) dr / \int rho(r)^2 dr = ',mu_average_prov2(istate) + write(*, '(A60,X,''='',X,F16.10)') ' [ \int rho(r)^2 mu(r)^{-2} dr / \int rho(r)^2 dr ]^{-1/2} = ',mu_average_prov3(istate) enddo if(mu_of_r_potential.EQ."cas_full".or. & diff --git a/src/ccsd/ccsd_spin_orb_sub.irp.f b/src/ccsd/ccsd_spin_orb_sub.irp.f index 16062356..7826c92e 100644 --- a/src/ccsd/ccsd_spin_orb_sub.irp.f +++ b/src/ccsd/ccsd_spin_orb_sub.irp.f @@ -82,6 +82,8 @@ subroutine run_ccsd_spin_orb call ccsd_energy_spin(cc_nOab,cc_nVab,t1%f,t2%f,cc_spin_F_ov,cc_spin_v_oovv,energy) print*,'guess energy', uncorr_energy+energy, energy + print *, 'Update_method: ', cc_update_method + ! Loop init nb_iter = 0 @@ -127,7 +129,7 @@ subroutine run_ccsd_spin_orb call update_t1(cc_nOab,cc_nVab,f_o,f_v,r1%f,t1%f) call update_t2(cc_nOab,cc_nVab,f_o,f_v,r2%f,t2%f) else - print*,'Unkonw cc_method_method: '//cc_update_method + print*,'Unknown cc_method_method: '//cc_update_method endif call compute_tau_spin(cc_nOab,cc_nVab,t1%f,t2%f,tau%f) diff --git a/src/mo_two_e_ints/mo_bi_integrals.irp.f b/src/mo_two_e_ints/mo_bi_integrals.irp.f index dd542898..1891d589 100644 --- a/src/mo_two_e_ints/mo_bi_integrals.irp.f +++ b/src/mo_two_e_ints/mo_bi_integrals.irp.f @@ -113,10 +113,12 @@ subroutine four_idx_dgemm allocate (a1(ao_num,ao_num,ao_num,ao_num)) print *, 'Getting AOs' - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(q,r,s) + call get_ao_two_e_integrals(1,1,1,ao_num,a1(1,1,1,1)) + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(q,r,s) COLLAPSE(2) do s=1,ao_num do r=1,ao_num do q=1,ao_num + a1(:,q,r,s) = 0.d0 call get_ao_two_e_integrals(q,r,s,ao_num,a1(1,q,r,s)) enddo enddo diff --git a/src/mo_two_e_ints/mo_bi_integrals_erf.irp.f b/src/mo_two_e_ints/mo_bi_integrals_erf.irp.f index a1910fd4..9bce42d8 100644 --- a/src/mo_two_e_ints/mo_bi_integrals_erf.irp.f +++ b/src/mo_two_e_ints/mo_bi_integrals_erf.irp.f @@ -89,10 +89,12 @@ subroutine four_idx_dgemm_erf allocate (a1(ao_num,ao_num,ao_num,ao_num)) print *, 'Getting AOs' - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(q,r,s) + call get_ao_two_e_integrals_erf(1,1,1,ao_num,a1(1,1,1,1)) + !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(q,r,s) COLLAPSE(2) do s=1,ao_num do r=1,ao_num do q=1,ao_num + a1(:,q,r,s) = 0.d0 call get_ao_two_e_integrals_erf(q,r,s,ao_num,a1(1,q,r,s)) enddo enddo diff --git a/src/mol_properties/print_e_components.irp.f b/src/mol_properties/print_e_components.irp.f index ddf83474..b066af15 100644 --- a/src/mol_properties/print_e_components.irp.f +++ b/src/mol_properties/print_e_components.irp.f @@ -12,6 +12,13 @@ subroutine print_energy_components() print *, 'Energy components' print *, '=================' print *, '' + + print *, 'Vnn : Nucleus-Nucleus potential energy' + print *, 'Ven : Electron-Nucleus potential energy' + print *, 'Vee : Electron-Electron potential energy' + print *, 'T : Electronic kinetic energy' + print *, '' + do k=1,N_states Ven = 0.d0 @@ -22,21 +29,10 @@ subroutine print_energy_components() do i=1,mo_num f = one_e_dm_mo_alpha(i,j,k) + one_e_dm_mo_beta(i,j,k) Ven = Ven + f * mo_integrals_n_e(i,j) - Vecp = Vecp + f * mo_pseudo_integrals(i,j) T = T + f * mo_kinetic_integrals(i,j) enddo enddo - Vee = psi_energy(k) - Ven - Vecp - T - - if (ifirst == 0) then - ifirst = 1 - print *, 'Vnn : Nucleus-Nucleus potential energy' - print *, 'Ven : Electron-Nucleus potential energy' - print *, 'Vee : Electron-Electron potential energy' - print *, 'Vecp : Potential energy of the pseudo-potentials' - print *, 'T : Electronic kinetic energy' - print *, '' - endif + Vee = psi_energy(k) - Ven - T print *, 'State ', k print *, '---------' @@ -44,7 +40,6 @@ subroutine print_energy_components() print *, 'Vnn = ', Vnn print *, 'Ven = ', Ven print *, 'Vee = ', Vee - print *, 'Vecp = ', Vecp print *, 'T = ', T print *, '' enddo diff --git a/src/mu_of_r/mu_of_r_conditions.irp.f b/src/mu_of_r/mu_of_r_conditions.irp.f index 83fa4aac..a1031919 100644 --- a/src/mu_of_r/mu_of_r_conditions.irp.f +++ b/src/mu_of_r/mu_of_r_conditions.irp.f @@ -226,10 +226,10 @@ mu_average_prov = 0.d0 do istate = 1, N_states do ipoint = 1, n_points_final_grid + if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle weight =final_weight_at_r_vector(ipoint) density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) - if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle mu_average_prov(istate) += mu_of_r_prov(ipoint,istate) * weight * density enddo mu_average_prov(istate) = mu_average_prov(istate) / elec_num_grid_becke(istate) @@ -247,14 +247,14 @@ END_DOC integer :: ipoint,istate double precision :: weight,density,norm - mu_average_prov2 = 0.d0 do istate = 1, N_states + mu_average_prov2(istate) = 0.d0 norm = 0.d0 do ipoint = 1, n_points_final_grid + if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle weight =final_weight_at_r_vector(ipoint) density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) - if(mu_of_r_prov(ipoint,istate).gt.1.d+09)cycle mu_average_prov2(istate) += mu_of_r_prov(ipoint,istate) * weight * density*density norm = norm + density*density*weight enddo @@ -289,6 +289,36 @@ END_PROVIDER +BEGIN_PROVIDER [double precision, mu_average_prov3, (N_states)] + implicit none + BEGIN_DOC + ! average value of mu(r) weighted with square of the total one-e density + ! + ! !!!!!! WARNING !!!!!! if no_core_density == .True. then all contributions from the core orbitals + ! + ! in the one- and two-body density matrix are excluded + END_DOC + integer :: ipoint,istate + double precision :: weight,density,norm, ratio + do istate = 1, N_states + mu_average_prov3(istate) = 0.d0 + norm = 0.d0 + do ipoint = 1, n_points_final_grid + weight =final_weight_at_r_vector(ipoint) + density = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate) & + + one_e_dm_and_grad_beta_in_r(4,ipoint,istate) + if(mu_of_r_prov(ipoint,istate).lt.1.d-09)cycle + ratio = density/mu_of_r_prov(ipoint,istate) + mu_average_prov3(istate) += ratio*ratio * weight + norm += density*density*weight + enddo + mu_average_prov3(istate) = mu_average_prov3(istate) / norm + mu_average_prov3(istate) = 1.d0/dsqrt(mu_average_prov3(istate)) + print *, norm + enddo +END_PROVIDER + + BEGIN_PROVIDER [double precision, mu_of_r_projector_mo, (n_points_final_grid) ] implicit none BEGIN_DOC diff --git a/src/two_rdm_routines/davidson_like_2rdm.irp.f b/src/two_rdm_routines/davidson_like_2rdm.irp.f index d92f1924..2444b709 100644 --- a/src/two_rdm_routines/davidson_like_2rdm.irp.f +++ b/src/two_rdm_routines/davidson_like_2rdm.irp.f @@ -196,7 +196,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin ASSERT (istart > 0) ASSERT (istep > 0) - !$OMP DO SCHEDULE(dynamic) + !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep !print *, 'aa', k_a, '/', iend @@ -282,12 +282,12 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin enddo enddo - !$OMP END DO NOWAIT + !$OMP END DO NOWAIT ! call update_keys_values_n_states(keys,values,nkeys,dim1,n_st,big_array,lock_2rdm) call update_keys_values_n_states_local(keys,values,nkeys,dim1,n_st,big_array_local) nkeys = 0 - !$OMP DO SCHEDULE(dynamic) + !$OMP DO SCHEDULE(dynamic) do k_a=istart+ishift,iend,istep !print *, 'ab', k_a, '/', iend @@ -545,7 +545,7 @@ subroutine orb_range_2_rdm_openmp_work_$N_int(big_array,dim1,norb,list_orb,ispin nkeys = 0 end do - !$OMP END DO NOWAIT + !$OMP END DO NOWAIT deallocate(buffer, singles_a, singles_b, doubles, idx, keys, values) !$OMP CRITICAL do i=1,N_states diff --git a/src/utils_cc/diis.irp.f b/src/utils_cc/diis.irp.f index a64a454f..d1620f27 100644 --- a/src/utils_cc/diis.irp.f +++ b/src/utils_cc/diis.irp.f @@ -233,6 +233,7 @@ subroutine compute_err1(nO,nV,f_o,f_v,r1,err1) integer :: i,a + print *, 'coucou' !$OMP PARALLEL & !$OMP SHARED(err1,r1,f_o,f_v,nO,nV,cc_level_shift) & !$OMP PRIVATE(i,a) & @@ -265,6 +266,7 @@ subroutine compute_err2(nO,nV,f_o,f_v,r2,err2) integer :: i,j,a,b +print *, 'coucou2' !$OMP PARALLEL & !$OMP SHARED(err2,r2,f_o,f_v,nO,nV,cc_level_shift) & !$OMP PRIVATE(i,j,a,b) & From eac3a074b73e517a95a6ecb7e22338cc3b8db1a4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 26 Sep 2025 10:35:38 +0200 Subject: [PATCH 165/175] Introduced multiple ROHF parameters --- src/scf_utils/EZFIO.cfg | 8 ++ src/scf_utils/fock_matrix.irp.f | 198 ++++++++++++++++++-------------- 2 files changed, 119 insertions(+), 87 deletions(-) diff --git a/src/scf_utils/EZFIO.cfg b/src/scf_utils/EZFIO.cfg index 1ca97217..673aec53 100644 --- a/src/scf_utils/EZFIO.cfg +++ b/src/scf_utils/EZFIO.cfg @@ -63,3 +63,11 @@ doc: If true, you set to zero all Fock elements between the orbital set to activ interface: ezfio,provider,ocaml default: False +[rohf_parameters] +type: character*(32) +doc: Parameterization used for the ROHF Fock matrix: Roothaan|McWeeny|Davidson|Guest|Binkley|Faegri|Euler|Canonical +interface: ezfio,provider,ocaml +default: Roothaan + + + diff --git a/src/scf_utils/fock_matrix.irp.f b/src/scf_utils/fock_matrix.irp.f index 051da9eb..6d5fc1c8 100644 --- a/src/scf_utils/fock_matrix.irp.f +++ b/src/scf_utils/fock_matrix.irp.f @@ -1,3 +1,101 @@ +BEGIN_PROVIDER [ double precision, Fock_matrix_param, (2,3) ] + implicit none + BEGIN_DOC + ! Fock matrix parameters. + ! (1,1) : A cc (2,1) : B cc + ! (1,2) : A oo (2,2) : B oo + ! (1,3) : A vv (2,3) : B vv + END_DOC + + if (trim(rohf_parameters) == 'Roothaan') then + ! C. C. J. Roothaan, Rev. Mod. Phys. 32, 179 ␁1960. + + Fock_matrix_param(1,1) = -0.5d0 + Fock_matrix_param(2,1) = 1.5d0 + Fock_matrix_param(1,2) = 0.5d0 + Fock_matrix_param(2,2) = 0.5d0 + Fock_matrix_param(1,3) = 1.5d0 + Fock_matrix_param(2,3) = -0.5d0 + + else if (trim(rohf_parameters) == 'McWeeny') then + ! R. McWeeny and G. Diercksen, J. Chem. Phys. 49, 4852 ␁1968 + + Fock_matrix_param(1,1) = 1.d0/3.d0 + Fock_matrix_param(2,1) = 2.d0/3.d0 + Fock_matrix_param(1,2) = 1.d0/3.d0 + Fock_matrix_param(2,2) = 1.d0/3.d0 + Fock_matrix_param(1,3) = 2.d0/3.d0 + Fock_matrix_param(2,3) = 1.d0/3.d0 + + else if (trim(rohf_parameters) == 'Davidson') then + ! E. R. Davidson, Chem. Phys. Lett. 21, 565 ␁1973 + + Fock_matrix_param(1,1) = 0.5d0 + Fock_matrix_param(2,1) = 0.5d0 + Fock_matrix_param(1,2) = 1.0d0 + Fock_matrix_param(2,2) = 0.0d0 + Fock_matrix_param(1,3) = 1.0d0 + Fock_matrix_param(2,3) = 0.0d0 + + else if (trim(rohf_parameters) == 'Guest') then + ! M. F. Guest and V. R. Saunders, Mol. Phys. 28, 819 ␁1974. + + Fock_matrix_param(1,1) = 0.5d0 + Fock_matrix_param(2,1) = 0.5d0 + Fock_matrix_param(1,2) = 0.5d0 + Fock_matrix_param(2,2) = 0.5d0 + Fock_matrix_param(1,3) = 0.0d0 + Fock_matrix_param(2,3) = 0.5d0 + + else if (trim(rohf_parameters) == 'Binkley') then + ! J. S. Binkley, J. A. Pople, and P. A. Dobosh, Mol. Phys. 28, 1423 ␁1974. + + Fock_matrix_param(1,1) = 0.5d0 + Fock_matrix_param(2,1) = 0.5d0 + Fock_matrix_param(1,2) = 1.0d0 + Fock_matrix_param(2,2) = 0.0d0 + Fock_matrix_param(1,3) = 0.0d0 + Fock_matrix_param(2,3) = 1.0d0 + + else if (trim(rohf_parameters) == 'Faegri') then + ! K. Faegri and R. Manne, Mol. Phys. 31, 1037 ␁1976. + + Fock_matrix_param(1,1) = 0.5d0 + Fock_matrix_param(2,1) = 0.5d0 + Fock_matrix_param(1,2) = 1.0d0 + Fock_matrix_param(2,2) = 0.0d0 + Fock_matrix_param(1,3) = 0.5d0 + Fock_matrix_param(2,3) = 0.5d0 + + else if (trim(rohf_parameters) == 'Euler') then + ! Plakhutin, B. N., et al. J. Chem. Phys., . 125, 20, p. 204110, doi:10.1063/1.2393223. + + Fock_matrix_param(1,1) = 0.5d0 + Fock_matrix_param(2,1) = 0.5d0 + Fock_matrix_param(1,2) = 0.5d0 + Fock_matrix_param(2,2) = 0.0d0 + Fock_matrix_param(1,3) = 0.5d0 + Fock_matrix_param(2,3) = 0.5d0 + + else if (trim(rohf_parameters) == 'Canonical') then + ! Plakhutin, B. N., et al. J. Chem. Phys., . 125, 20, p. 204110, doi:10.1063/1.2393223. + + Fock_matrix_param(1,1) = 0.0d0 + Fock_matrix_param(2,1) = 1.0d0 + Fock_matrix_param(1,2) = 1.0d0 + Fock_matrix_param(2,2) = 0.0d0 + Fock_matrix_param(1,3) = 1.0d0 + Fock_matrix_param(2,3) = 0.0d0 + + else + + stop 'Unknown set of ROHF parameters' + + endif + + +END_PROVIDER + BEGIN_PROVIDER [ double precision, Fock_matrix_mo, (mo_num,mo_num) ] &BEGIN_PROVIDER [ double precision, Fock_matrix_diag_mo, (mo_num)] implicit none @@ -36,8 +134,8 @@ do j = 1, elec_beta_num ! Core do i = 1, elec_beta_num - fock_matrix_mo(i,j) = - 0.5d0 * fock_matrix_mo_alpha(i,j) & - + 1.5d0 * fock_matrix_mo_beta(i,j) + fock_matrix_mo(i,j) = Fock_matrix_param(1,1) * fock_matrix_mo_alpha(i,j) + & + Fock_matrix_param(2,1) * fock_matrix_mo_beta(i,j) enddo ! Open do i = elec_beta_num+1, elec_alpha_num @@ -45,8 +143,8 @@ enddo ! Virtual do i = elec_alpha_num+1, mo_num - fock_matrix_mo(i,j) = 0.5d0 * fock_matrix_mo_alpha(i,j) & - + 0.5d0 * fock_matrix_mo_beta(i,j) + fock_matrix_mo(i,j) = 0.5d0 * fock_matrix_mo_alpha(i,j) + & + 0.5d0 * fock_matrix_mo_beta(i,j) enddo enddo ! Open @@ -57,12 +155,12 @@ enddo ! Open do i = elec_beta_num+1, elec_alpha_num - fock_matrix_mo(i,j) = 0.5d0 * fock_matrix_mo_alpha(i,j) & - + 0.5d0 * fock_matrix_mo_beta(i,j) + fock_matrix_mo(i,j) = Fock_matrix_param(1,2) * fock_matrix_mo_alpha(i,j) + & + Fock_matrix_param(2,2) * fock_matrix_mo_beta(i,j) enddo ! Virtual do i = elec_alpha_num+1, mo_num - fock_matrix_mo(i,j) = fock_matrix_mo_alpha(i,j) + fock_matrix_mo(i,j) = fock_matrix_mo_alpha(i,j) enddo enddo ! Virtual @@ -78,86 +176,12 @@ enddo ! Virtual do i = elec_alpha_num+1, mo_num - fock_matrix_mo(i,j) = 1.5d0 * fock_matrix_mo_alpha(i,j) & - - 0.5d0 * fock_matrix_mo_beta(i,j) + fock_matrix_mo(i,j) = Fock_matrix_param(1,3) * fock_matrix_mo_alpha(i,j) + & + Fock_matrix_param(2,3) * fock_matrix_mo_beta(i,j) enddo enddo endif - ! Old - ! BEGIN_DOC - ! Fock matrix on the MO basis. - ! For open shells, the ROHF Fock Matrix is :: - ! - ! | F-K | F + K/2 | F | - ! |---------------------------------| - ! | F + K/2 | F | F - K/2 | - ! |---------------------------------| - ! | F | F - K/2 | F + K | - ! - ! - ! F = 1/2 (Fa + Fb) - ! - ! K = Fb - Fa - ! - ! END_DOC - !integer :: i,j,n - !if (all_shells_closed) then - ! Fock_matrix_mo = Fock_matrix_mo_alpha - !else - - ! do j=1,elec_beta_num - ! ! F-K - ! do i=1,elec_beta_num !CC - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j))& - ! - (Fock_matrix_mo_beta(i,j) - Fock_matrix_mo_alpha(i,j)) - ! enddo - ! ! F+K/2 - ! do i=elec_beta_num+1,elec_alpha_num !CA - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j))& - ! + 0.5d0*(Fock_matrix_mo_beta(i,j) - Fock_matrix_mo_alpha(i,j)) - ! enddo - ! ! F - ! do i=elec_alpha_num+1, mo_num !CV - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j)) - ! enddo - ! enddo - - ! do j=elec_beta_num+1,elec_alpha_num - ! ! F+K/2 - ! do i=1,elec_beta_num !AC - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j))& - ! + 0.5d0*(Fock_matrix_mo_beta(i,j) - Fock_matrix_mo_alpha(i,j)) - ! enddo - ! ! F - ! do i=elec_beta_num+1,elec_alpha_num !AA - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j)) - ! enddo - ! ! F-K/2 - ! do i=elec_alpha_num+1, mo_num !AV - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j))& - ! - 0.5d0*(Fock_matrix_mo_beta(i,j) - Fock_matrix_mo_alpha(i,j)) - ! enddo - ! enddo - - ! do j=elec_alpha_num+1, mo_num - ! ! F - ! do i=1,elec_beta_num !VC - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j)) - ! enddo - ! ! F-K/2 - ! do i=elec_beta_num+1,elec_alpha_num !VA - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j))& - ! - 0.5d0*(Fock_matrix_mo_beta(i,j) - Fock_matrix_mo_alpha(i,j)) - ! enddo - ! ! F+K - ! do i=elec_alpha_num+1,mo_num !VV - ! Fock_matrix_mo(i,j) = 0.5d0*(Fock_matrix_mo_alpha(i,j)+Fock_matrix_mo_beta(i,j)) & - ! + (Fock_matrix_mo_beta(i,j) - Fock_matrix_mo_alpha(i,j)) - ! enddo - ! enddo - - !endif do i = 1, mo_num Fock_matrix_diag_mo(i) = Fock_matrix_mo(i,i) @@ -167,9 +191,9 @@ if(frozen_orb_scf)then integer :: iorb,jorb ! active|core|active - !active | | 0 | + !active | | 0 | !core | 0 | | 0 - !active | | 0 | + !active | | 0 | do i = 1, n_core_orb iorb = list_core(i) do j = 1, n_act_orb @@ -261,10 +285,10 @@ do i=1,ao_num SCF_energy += & (ao_one_e_integrals(i,j) + Fock_matrix_ao_alpha(i,j) ) * SCF_density_matrix_ao_alpha(i,j) +& - (ao_one_e_integrals(i,j) + Fock_matrix_ao_beta (i,j) ) * SCF_density_matrix_ao_beta (i,j) + (ao_one_e_integrals(i,j) + Fock_matrix_ao_beta (i,j) ) * SCF_density_matrix_ao_beta (i,j) enddo enddo - SCF_energy = 0.5d0 * SCF_energy + extra_e_contrib_density + nuclear_repulsion + SCF_energy = 0.5d0 * SCF_energy + extra_e_contrib_density + nuclear_repulsion END_PROVIDER From 5864de5326986c6d509ec5da1469fda49e528afd Mon Sep 17 00:00:00 2001 From: eginer Date: Fri, 10 Oct 2025 16:08:15 +0200 Subject: [PATCH 166/175] corrected bug in copy_wf.irp.f --- plugins/local/fci_tc_bi/copy_wf.irp.f | 8 ++++++-- src/utils/constants.include.F | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/local/fci_tc_bi/copy_wf.irp.f b/plugins/local/fci_tc_bi/copy_wf.irp.f index c46f20d2..5a2f8501 100644 --- a/plugins/local/fci_tc_bi/copy_wf.irp.f +++ b/plugins/local/fci_tc_bi/copy_wf.irp.f @@ -116,6 +116,7 @@ subroutine remove_duplicates_in_psi_det_tc(found_duplicates) logical,allocatable :: duplicate(:) logical :: dup + allocate (duplicate(N_det), bit_tmp(N_det)) found_duplicates = .False. @@ -128,6 +129,7 @@ subroutine remove_duplicates_in_psi_det_tc(found_duplicates) !$DIR FORCEINLINE bit_tmp(i) = det_search_key(psi_det_sorted_bit_tc(1,1,i),N_int) duplicate(i) = .False. + call debug_det(psi_det_sorted_bit_tc(1,1,i),N_int) enddo !$OMP END DO @@ -207,9 +209,11 @@ subroutine remove_duplicates_in_psi_det_tc(found_duplicates) ! function. END_DOC + integer, allocatable :: iorder(:) + allocate(iorder(size(psi_r_coef_bi_ortho,1))) call sort_dets_by_det_search_key(N_det, psi_det, psi_r_coef_bi_ortho, size(psi_r_coef_bi_ortho,1), & - psi_det_sorted_bit_tc, psi_r_coef_sorted_bit, N_states) + psi_det_sorted_bit_tc, psi_r_coef_sorted_bit, iorder, N_states) call sort_dets_by_det_search_key(N_det, psi_det, psi_l_coef_bi_ortho, size(psi_l_coef_bi_ortho,1), & - psi_det_sorted_bit_tc, psi_l_coef_sorted_bit, N_states) + psi_det_sorted_bit_tc, psi_l_coef_sorted_bit, iorder, N_states) END_PROVIDER diff --git a/src/utils/constants.include.F b/src/utils/constants.include.F index 830b71a1..09a2b107 100644 --- a/src/utils/constants.include.F +++ b/src/utils/constants.include.F @@ -21,6 +21,7 @@ double precision, parameter :: c_1_3 = 1.d0/3.d0 double precision, parameter :: sq_op5 = dsqrt(0.5d0) double precision, parameter :: dlog_2pi = dlog(2.d0*dacos(-1.d0)) +double precision, parameter :: const_rs= (3.d0/(4.D0*pi))**(1.d0/3.d0) ! physical constants and units conversion factors double precision, parameter :: k_boltzman_si = 1.38066d-23 ! K k^-1 From 5e5e9421092e884671b302cfd5bcb710f309816a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 10:34:05 +0100 Subject: [PATCH 167/175] Add backward-compatibility of EZFIO in qp_create --- etc/qp.rc | 18 +++++++---------- ocaml/qp_create_ezfio.ml | 20 ++++++++++++++++--- ..._jastrow.py => qp_import_champ_jastrow.py} | 0 3 files changed, 24 insertions(+), 14 deletions(-) rename scripts/{import_champ_jastrow.py => qp_import_champ_jastrow.py} (100%) diff --git a/etc/qp.rc b/etc/qp.rc index 4e206096..cbe895cf 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -25,7 +25,7 @@ Usage: qp get Returns the value of /. - qp set [] + qp set [] Sets the value of /. If the value is not given in the command line it is read from the standard input. @@ -41,8 +41,8 @@ Usage: Running quantum package commands: - qp convert_output_to_ezfio - qp create_ezfio + qp convert_output_to_ezfio + qp create_ezfio qp plugins The corresponding commands start with "qp_". qp reset To get help for a command , run qp set_frozen_core --help @@ -169,23 +169,19 @@ _qp_Complete() ;; create_ezfio) case "${prev}" in - create_ezfio) - COMPREPLY=( $(compgen -W "-b -a -c -d -h -m -o -p -x $(\ls)" -- $cur ) ) - return 0 - ;; - -m|-d|-c) + -m|-c) # Charge, multiplicity COMPREPLY=( $(compgen -W "" -- $cur ) ) return 0;; - -b) + -b) # Basis COMPREPLY=( $(compgen -W "$(ls ${QP_ROOT}/data/basis)" -- $cur ) ) return 0 ;; - -p) + -p) # Pseudo COMPREPLY=( $(compgen -W "$(cd ${QP_ROOT}/data/pseudo ; \ls)" -- $cur ) ) return 0 ;; *) - COMPREPLY=( $(compgen -W "-b -a -c -d -h -m -o -p -x $(\ls)" -- $cur ) ) + COMPREPLY=( $(compgen -W "-b -a -c -d -h -m -o -p -x -q $(\ls)" -- $cur ) ) return 0 ;; esac;; diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index ba0e2b7b..c03e46fa 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -57,7 +57,7 @@ let ghost_centers ~threshold ~molecule ~nuclei = (** Run the program *) -let run ?o b au c d m p cart xyz_file = +let run ?o b au c d m p qmc cart xyz_file = (* Read molecule *) let molecule = @@ -263,10 +263,15 @@ let run ?o b au c d m p cart xyz_file = if Sys.file_exists ezfio_file then failwith (ezfio_file^" already exists"); + let convention = + if qmc then 20210101 + else 20250211 + in + let write_file () = (* Create EZFIO *) Ezfio.set_file ezfio_file; - Ezfio.set_ezfio_files_ezfio_convention 20250211; + Ezfio.set_ezfio_files_ezfio_convention convention; Ezfio.set_basis_ao_normalized true ; (* Write Pseudo *) @@ -725,10 +730,15 @@ If a file with the same name as the basis set exists, this file will be read. O arg=With_arg ""; doc="Name of the pseudopotential."} ; + { opt=Optional ; short='q'; long="qmc"; + arg=Without_arg; + doc="Use old EZFIO conventions for compatibility with QMC=Chem and QMCPACK"} ; + { opt=Optional ; short='x'; long="cartesian"; arg=Without_arg; doc="Compute AOs in the Cartesian basis set (6d, 10f, ...)."} ; + (* If you add an option, don't forget to modify also etc/qp.rc for bash completion *) anonymous "FILE" Mandatory "Input file in xyz format or z-matrix."; ] |> set_specs @@ -775,6 +785,10 @@ If a file with the same name as the basis set exists, this file will be read. O Command_line.get "pseudo" in + let qmc = + Command_line.get_bool "qmc" + in + let cart = Command_line.get_bool "cartesian" in @@ -785,7 +799,7 @@ If a file with the same name as the basis set exists, this file will be read. O | x::_ -> x in - run ?o:output basis au charge ghost multiplicity pseudo cart xyz_filename + run ?o:output basis au charge ghost multiplicity pseudo qmc cart xyz_filename ) with (* | Failure txt -> Printf.eprintf "Fatal error: %s\n%!" txt *) diff --git a/scripts/import_champ_jastrow.py b/scripts/qp_import_champ_jastrow.py similarity index 100% rename from scripts/import_champ_jastrow.py rename to scripts/qp_import_champ_jastrow.py From 7bb450dc82843ffd4cc1d7b7bd642f51bbfa07ca Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 11:34:23 +0100 Subject: [PATCH 168/175] Logic error in condition check in ao_extra_basis --- src/ao_extra_basis/prov_fit_1s.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ao_extra_basis/prov_fit_1s.irp.f b/src/ao_extra_basis/prov_fit_1s.irp.f index 99a18a6b..7f3aa570 100644 --- a/src/ao_extra_basis/prov_fit_1s.irp.f +++ b/src/ao_extra_basis/prov_fit_1s.irp.f @@ -258,7 +258,7 @@ integer function return_xyz_int(power) return_xyz_int = 1 else if (power(2) == 1 .and. power(1) ==0 .and. power(3) ==0)then return_xyz_int = 2 - else if (power(3) == 1 .and. power(1) ==0 .and. power(1) ==0)then + else if (power(3) == 1 .and. power(1) ==0 .and. power(2) ==0)then return_xyz_int = 3 else return_xyz_int = -1000 From 089ac62bd38d863e9dda4cc495f5923e15353aaa Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 11:35:00 +0100 Subject: [PATCH 169/175] Update src/ao_extra_basis/prov_fit_1s.irp.f Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/ao_extra_basis/prov_fit_1s.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ao_extra_basis/prov_fit_1s.irp.f b/src/ao_extra_basis/prov_fit_1s.irp.f index 99a18a6b..7f3aa570 100644 --- a/src/ao_extra_basis/prov_fit_1s.irp.f +++ b/src/ao_extra_basis/prov_fit_1s.irp.f @@ -258,7 +258,7 @@ integer function return_xyz_int(power) return_xyz_int = 1 else if (power(2) == 1 .and. power(1) ==0 .and. power(3) ==0)then return_xyz_int = 2 - else if (power(3) == 1 .and. power(1) ==0 .and. power(1) ==0)then + else if (power(3) == 1 .and. power(1) ==0 .and. power(2) ==0)then return_xyz_int = 3 else return_xyz_int = -1000 From a1bd2dba03668026915fbc683ec469558d134324 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 11:35:22 +0100 Subject: [PATCH 170/175] Update src/ao_extra_basis/install Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/ao_extra_basis/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ao_extra_basis/install b/src/ao_extra_basis/install index e7e668e1..b85012ff 100755 --- a/src/ao_extra_basis/install +++ b/src/ao_extra_basis/install @@ -3,8 +3,8 @@ # Check if the QP_ROOT environment variable is set. if [[ -z ${QP_ROOT} ]] then - print "The QP_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." + echo "The QP_ROOT environment variable is not set." + echo "Please reload the quantum_package.rc file." exit -1 fi From 9a4f6e2878df245d1417e8b4aac0b245767b232f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 11:41:19 +0100 Subject: [PATCH 171/175] Removed debug statement --- plugins/local/fci_tc_bi/copy_wf.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/local/fci_tc_bi/copy_wf.irp.f b/plugins/local/fci_tc_bi/copy_wf.irp.f index 5a2f8501..35f508b5 100644 --- a/plugins/local/fci_tc_bi/copy_wf.irp.f +++ b/plugins/local/fci_tc_bi/copy_wf.irp.f @@ -129,7 +129,7 @@ subroutine remove_duplicates_in_psi_det_tc(found_duplicates) !$DIR FORCEINLINE bit_tmp(i) = det_search_key(psi_det_sorted_bit_tc(1,1,i),N_int) duplicate(i) = .False. - call debug_det(psi_det_sorted_bit_tc(1,1,i),N_int) +! call debug_det(psi_det_sorted_bit_tc(1,1,i),N_int) enddo !$OMP END DO From bbdf64367a626d0becfbdaa60c3ef4a664493a0f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 11:41:42 +0100 Subject: [PATCH 172/175] Fixed tuto --- plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f b/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f index 68d965cb..df3bab14 100644 --- a/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f +++ b/plugins/local/tuto_plugins/tuto_I/traces_one_e.irp.f @@ -30,7 +30,6 @@ ! have the same number of functions END_DOC integer :: i,j - double precision :: accu double precision, allocatable :: inv_overlap_times_integrals(:,:) ! = h S^{-1} allocate(inv_overlap_times_integrals(ao_num,ao_num)) ! routine that computes the product of two matrices, you can check it with @@ -50,7 +49,7 @@ test += ao_one_e_integrals(j,i) * s_inv(i,j) enddo enddo - if(dabs(accu - trace_ao_one_e_ints).gt.1.d-12)then + if(dabs(test - trace_ao_one_e_ints).gt.1.d-12)then print*,'Warning ! ' print*,'Something is wrong because Tr(AB) \ne sum_{mn}A_mn B_nm' endif From 83208dcfb2c0fae20137274fc4b0ce61d80ebbf2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 11:42:08 +0100 Subject: [PATCH 173/175] Fixed qp_geom_opt --- scripts/qp_geom_opt.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/qp_geom_opt.py b/scripts/qp_geom_opt.py index c089a5d8..c8f67d24 100755 --- a/scripts/qp_geom_opt.py +++ b/scripts/qp_geom_opt.py @@ -5,11 +5,11 @@ qp_geom_opt [-s state] [-r executable] [-f] [-t tolerance] Options: - -s --state= Excited state to optimize + -s --state= Excited state to optimize -f --scf Perform an SCF after each geomety change - -r --qp_run=executable Excited state to optimize + -r --qp_run=executable Excited state to optimize -t --tol=tolerance Convergence criterion on the energy -""" +""" try: @@ -22,7 +22,7 @@ print("(`source ${QP_ROOT}/quantum_package.rc`)") print(sys.exit(1)) - + import numpy as np import subprocess from scipy.optimize import minimize @@ -60,13 +60,13 @@ def get_energy(file, state, arguments): executable = arguments["--qp_run"] result = subprocess.run( f"qp_run {executable} {file} > {file}.energy.out", shell=True) - + energy = None with open(f"{file}.energy.out", 'r') as f: for line in f: if "Energy of state" in line and f"{state}" in line: energy = float(line.split()[-1]) # Extracts the energy value - + return energy raise ValueError("Energy not found in Quantum Package output. Update script {sys.argv[0]}") @@ -95,7 +95,7 @@ def energy_function(coord, file, state, arguments): num_atoms = len(label) coord = coord.reshape(3, num_atoms).T # Reshape into (num_atoms, 3) coord_angstrom = coord * 0.529177 # Convert atomic units to angstroms - + print(num_atoms) print(f"Energy: {energy:15.10f}") for i, (x, y, z) in enumerate(coord_angstrom): @@ -109,7 +109,7 @@ def optimize_geometry(file, state, arguments): x0 = get_coordinates().flatten() if arguments["--tol"]: - tolerance = float(tol=arguments["--tol"]) + tolerance = float(arguments["--tol"]) else: tolerance = 1.e-3 @@ -117,20 +117,20 @@ def optimize_geometry(file, state, arguments): method='Powell', tol=tolerance, options={'xtol': tolerance, 'ftol': tolerance}) - + # result = minimize(energy_function, x0, args=(file, state, arguments), # method='BFGS', # jac=None, # tol=tolerance, # options={'eps': 1.e-3}) - + if result.success: print("Optimization successful!") print("Final energy:", result.fun) print("Optimized coordinates:", result.x) else: print("Optimization failed:", result.message) - + set_coordinates(result.x) # Store the optimized geometry return result From c50f6ebc006c963f85eaa219e4ad9b59ce03edd8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 29 Oct 2025 18:00:19 +0100 Subject: [PATCH 174/175] Improved CASSCF convergence --- src/casscf_cipsi/dav_sx_mat.irp.f | 17 +++++---- src/casscf_cipsi/neworbs.irp.f | 51 +++++++++++++++------------ src/dav_general_mat/dav_general.irp.f | 4 +-- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/src/casscf_cipsi/dav_sx_mat.irp.f b/src/casscf_cipsi/dav_sx_mat.irp.f index 1e24f0e2..412678a8 100644 --- a/src/casscf_cipsi/dav_sx_mat.irp.f +++ b/src/casscf_cipsi/dav_sx_mat.irp.f @@ -3,12 +3,12 @@ subroutine davidson_diag_sx_mat(N_st, u_in, energies) implicit none integer, intent(in) :: N_st - double precision, intent(out) :: u_in(nMonoEx+1,n_states_diag), energies(N_st) + double precision, intent(out) :: u_in(nMonoEx+1,N_st*n_states_diag), energies(N_st) integer :: i,j,N_st_tmp, dim_in, sze, N_st_diag_in integer, allocatable :: list_guess(:) double precision, allocatable :: H_jj(:) - logical :: converged - N_st_diag_in = n_states_diag + logical :: converged + N_st_diag_in = n_states_diag * N_st provide SXmatrix sze = nMonoEx+1 dim_in = sze @@ -18,9 +18,9 @@ subroutine davidson_diag_sx_mat(N_st, u_in, energies) list_guess(1) = 1 do j = 2, nMonoEx+1 H_jj(j) = SXmatrix(j,j) - if(H_jj(j).lt.0.d0)then - list_guess(N_st_tmp) = j + if(H_jj(j).lt.0.d0)then N_st_tmp += 1 + list_guess(N_st_tmp) = j endif enddo if(N_st_tmp .ne. N_st)then @@ -29,12 +29,11 @@ subroutine davidson_diag_sx_mat(N_st, u_in, energies) print*,N_st_tmp, N_st stop endif - print*,'Number of possibly interesting states = ',N_st + print*,'Number of possibly interesting states = ', N_st print*,'Corresponding diagonal elements of the SX matrix ' u_in = 0.d0 - do i = 1, min(N_st, N_st_diag_in) -! do i = 1, N_st - j = list_guess(i) + do i = 1, N_st + j = list_guess(i) print*,'i,j',i,j print*,'SX(i,i) = ',H_jj(j) u_in(j,i) = 1.d0 diff --git a/src/casscf_cipsi/neworbs.irp.f b/src/casscf_cipsi/neworbs.irp.f index b44ac065..96031480 100644 --- a/src/casscf_cipsi/neworbs.irp.f +++ b/src/casscf_cipsi/neworbs.irp.f @@ -4,20 +4,20 @@ BEGIN_DOC ! Single-excitation matrix END_DOC - + integer :: i,j - + do i=1,nMonoEx+1 do j=1,nMonoEx+1 SXmatrix(i,j)=0.D0 end do end do - + do i=1,nMonoEx SXmatrix(1,i+1)=gradvec2(i) SXmatrix(1+i,1)=gradvec2(i) end do - if(diag_hess_cas)then + if(diag_hess_cas)then do i = 1, nMonoEx SXmatrix(i+1,i+1) = hessdiag(i) enddo @@ -29,7 +29,7 @@ end do end do endif - + do i = 1, nMonoEx SXmatrix(i+1,i+1) += level_shift_casscf enddo @@ -44,7 +44,7 @@ write(6,*) ' diagonal of the Hessian : ',i,hessmat(i,i) end do end if - + END_PROVIDER BEGIN_PROVIDER [real*8, SXeigenvec, (nMonoEx+1,nMonoEx+1)] @@ -58,7 +58,7 @@ print*,'Using the Davidson algorithm to diagonalize the SXmatrix' endif double precision, allocatable :: u_in(:,:),energies(:) - allocate(u_in(nMonoEx+1,n_states_diag),energies(n_guess_sx_mat)) + allocate(u_in(nMonoEx+1,n_guess_sx_mat*n_states_diag),energies(n_guess_sx_mat)) call davidson_diag_sx_mat(n_guess_sx_mat, u_in, energies) integer :: i,j SXeigenvec = 0.d0 @@ -71,7 +71,7 @@ enddo else if(bavard)then - print*,'Diagonalize the SXmatrix with Jacobi' + print*,'Diagonalize the SXmatrix with Lapack' endif call lapack_diag(SXeigenval,SXeigenvec,SXmatrix,nMonoEx+1,nMonoEx+1) endif @@ -93,10 +93,10 @@ implicit none if(state_following_casscf)then energy_improvement = SXeigenval(best_vector_ovrlp_casscf) - else + else energy_improvement = SXeigenval(1) endif - END_PROVIDER + END_PROVIDER @@ -115,8 +115,7 @@ end if end if end do - if(best_vector_ovrlp_casscf.lt.0)then -! best_vector_ovrlp_casscf = minloc(SXeigenval) + if(best_vector_ovrlp_casscf.lt.0)then best_vector_ovrlp_casscf = 1 endif c0=SXeigenvec(1,best_vector_ovrlp_casscf) @@ -124,8 +123,9 @@ write(6,*) ' SXdiag : eigenvalue for best overlap with ' write(6,*) ' previous orbitals = ',SXeigenval(best_vector_ovrlp_casscf) write(6,*) ' weight of the 1st element ',c0 + write(6,*) ' weight of the 1st elements ', SXeigenvec(1,:) endif - END_PROVIDER + END_PROVIDER BEGIN_PROVIDER [double precision, SXvector, (nMonoEx+1)] implicit none @@ -135,6 +135,7 @@ integer :: i double precision :: c0 c0=SXeigenvec(1,best_vector_ovrlp_casscf) + if (c0*c0 < 0.5d0) c0 = 1.d0 do i=1,nMonoEx+1 SXvector(i)=SXeigenvec(i,best_vector_ovrlp_casscf)/c0 end do @@ -147,7 +148,7 @@ ! Updated orbitals END_DOC integer :: i,j,ialph - + if(state_following_casscf)then print*,'Using the state following casscf ' call dgemm('N','T', ao_num,mo_num,mo_num,1.d0, & @@ -170,7 +171,7 @@ !soft_touch mo_coef !call save_mos_no_occ !stop - else + else level_shift_casscf *= 0.5D0 level_shift_casscf = max(level_shift_casscf,0.002d0) !touch level_shift_casscf @@ -180,7 +181,7 @@ NewOrbs, size(NewOrbs,1)) endif endif - + END_PROVIDER BEGIN_PROVIDER [real*8, Umat, (mo_num,mo_num) ] @@ -190,11 +191,11 @@ END_DOC integer :: i,j,indx,k,iter,t,a,ii,tt,aa logical :: converged - - real*8 :: Tpotmat (mo_num,mo_num), Tpotmat2 (mo_num,mo_num) - real*8 :: Tmat(mo_num,mo_num) + + real*8 :: Tpotmat (mo_num,mo_num), Tpotmat2 (mo_num,mo_num) + real*8 :: Tmat(mo_num,mo_num) real*8 :: f - + ! the orbital rotation matrix T Tmat(:,:)=0.D0 indx=1 @@ -225,9 +226,13 @@ Tmat(aa,tt)=-SXvector(indx) end do end do - + ! Form the exponential call exp_matrix_taylor(Tmat,mo_num,Umat,converged) + if (bavard) then + print *, 'maxval(Tmat), minval(Tmat)', maxval(Tmat), minval(Tmat) + print *, 'maxval(Umat), minval(Umat)', maxval(Umat), minval(Umat) + endif ! Tpotmat(:,:)=0.D0 ! Umat(:,:) =0.D0 @@ -246,10 +251,10 @@ ! Tmat, size(Tmat,1), 0.d0, & ! Tpotmat, size(Tpotmat,1)) ! Umat(:,:) = Umat(:,:) + Tpotmat(:,:) -! +! ! converged = ( sum(abs(Tpotmat(:,:))) < 1.d-6).or.(iter>30) ! end do END_PROVIDER - + diff --git a/src/dav_general_mat/dav_general.irp.f b/src/dav_general_mat/dav_general.irp.f index 114476c2..456cafa8 100644 --- a/src/dav_general_mat/dav_general.irp.f +++ b/src/dav_general_mat/dav_general.irp.f @@ -140,7 +140,7 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv write(6,'(A)') '' write_buffer = '=====' do i=1,N_st - write_buffer = trim(write_buffer)//' ================ ===========' + write_buffer = trim(write_buffer)//' =============== ===========' enddo write(6,'(A)') write_buffer(1:6+41*N_st) write_buffer = 'Iter' @@ -320,7 +320,7 @@ subroutine davidson_general(u_in,H_jj,energies,dim_in,sze,N_st,N_st_diag_in,conv !don't print continue else - write(*,'(1X,I3,1X,100(1X,F16.10,1X,F11.6,1X,ES11.3))') iter-1, to_print(1:2,1:N_st) + write(*,'(1X,I3,100(1X,F16.10,1X,ES11.3))') iter-1, to_print(1:2,1:N_st) endif ! Check convergence From 6e791b1a0b23651dfd88b713cca72309b028d96c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 31 Oct 2025 09:58:35 +0100 Subject: [PATCH 175/175] Upgrade to trexio 2.6.0 --- configure | 2 +- src/casscf_cipsi/neworbs.irp.f | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index 7b5fa0c9..2d08a424 100755 --- a/configure +++ b/configure @@ -9,7 +9,7 @@ echo "QP_ROOT="$QP_ROOT unset CC unset CCXX -TREXIO_VERSION=2.5.0 +TREXIO_VERSION=2.6.0 # Force GCC instead of ICC for dependencies export CC=gcc diff --git a/src/casscf_cipsi/neworbs.irp.f b/src/casscf_cipsi/neworbs.irp.f index 96031480..2d994728 100644 --- a/src/casscf_cipsi/neworbs.irp.f +++ b/src/casscf_cipsi/neworbs.irp.f @@ -123,7 +123,6 @@ write(6,*) ' SXdiag : eigenvalue for best overlap with ' write(6,*) ' previous orbitals = ',SXeigenval(best_vector_ovrlp_casscf) write(6,*) ' weight of the 1st element ',c0 - write(6,*) ' weight of the 1st elements ', SXeigenvec(1,:) endif END_PROVIDER