From 4367d03353ced5f5fcb2b7b758070e20051653ae Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 2 May 2022 16:37:15 +0200 Subject: [PATCH 1/3] Fix typos in function names --- org/qmckl_numprec.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org/qmckl_numprec.org b/org/qmckl_numprec.org index 3b73dc3..7c5f26f 100644 --- a/org/qmckl_numprec.org +++ b/org/qmckl_numprec.org @@ -250,19 +250,19 @@ qmckl_exit_code qmckl_set_numprec_range(const qmckl_context context, const int r # Fortran interface #+begin_src f90 :tangle (eval fh_func) interface - integer (qmckl_exit_code) function qmckl_numprec_set_range(context, range) bind(C) + integer (qmckl_exit_code) function qmckl_set_numprec_range(context, range) bind(C) use, intrinsic :: iso_c_binding import integer (qmckl_context), intent(in), value :: context integer (c_int32_t), intent(in), value :: range - end function qmckl_numprec_set_range + end function qmckl_set_numprec_range end interface #+end_src ~qmckl_get_numprec_range~ returns the value of the numerical range in the context. #+begin_src c :comments org :tangle (eval h_func) :exports none -int32_t qmckl_get_numprec_get_range(const qmckl_context context); +int32_t qmckl_get_numprec_range(const qmckl_context context); #+end_src # Source From 5a833cf3f09e6e1fd102517a36db029b47b6e120 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 5 May 2022 16:25:32 +0200 Subject: [PATCH 2/3] Restored dgemm for AO to MO in doc version --- org/qmckl_mo.org | 52 +++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/org/qmckl_mo.org b/org/qmckl_mo.org index 88fe69c..5d49030 100644 --- a/org/qmckl_mo.org +++ b/org/qmckl_mo.org @@ -666,25 +666,41 @@ integer function qmckl_compute_mo_basis_mo_vgl_doc_f(context, & integer*8 :: i,j,k double precision :: c1, c2, c3, c4, c5 - do j=1,point_num - mo_vgl(:,:,j) = 0.d0 - do k=1,ao_num - if (ao_vgl(k,1,j) /= 0.d0) then - c1 = ao_vgl(k,1,j) - c2 = ao_vgl(k,2,j) - c3 = ao_vgl(k,3,j) - c4 = ao_vgl(k,4,j) - c5 = ao_vgl(k,5,j) - do i=1,mo_num - mo_vgl(i,1,j) = mo_vgl(i,1,j) + coef_normalized_t(i,k) * c1 - mo_vgl(i,2,j) = mo_vgl(i,2,j) + coef_normalized_t(i,k) * c2 - mo_vgl(i,3,j) = mo_vgl(i,3,j) + coef_normalized_t(i,k) * c3 - mo_vgl(i,4,j) = mo_vgl(i,4,j) + coef_normalized_t(i,k) * c4 - mo_vgl(i,5,j) = mo_vgl(i,5,j) + coef_normalized_t(i,k) * c5 - end do - end if + integer*8 :: LDA, LDB, LDC + + info = QMCKL_SUCCESS + if (.False.) then ! fast algorithm + do j=1,point_num + mo_vgl(:,:,j) = 0.d0 + do k=1,ao_num + if (ao_vgl(k,1,j) /= 0.d0) then + c1 = ao_vgl(k,1,j) + c2 = ao_vgl(k,2,j) + c3 = ao_vgl(k,3,j) + c4 = ao_vgl(k,4,j) + c5 = ao_vgl(k,5,j) + do i=1,mo_num + mo_vgl(i,1,j) = mo_vgl(i,1,j) + coef_normalized_t(i,k) * c1 + mo_vgl(i,2,j) = mo_vgl(i,2,j) + coef_normalized_t(i,k) * c2 + mo_vgl(i,3,j) = mo_vgl(i,3,j) + coef_normalized_t(i,k) * c3 + mo_vgl(i,4,j) = mo_vgl(i,4,j) + coef_normalized_t(i,k) * c4 + mo_vgl(i,5,j) = mo_vgl(i,5,j) + coef_normalized_t(i,k) * c5 + end do + end if + end do end do - end do + + else ! dgemm + + LDA = size(coef_normalized_t,1) + LDB = size(ao_vgl,1) + LDC = size(mo_vgl,1) + + info = qmckl_dgemm(context,'N', 'N', mo_num, point_num*5_8, ao_num*1_8, 1.d0, & + coef_normalized_t, LDA, ao_vgl, LDB, & + 0.d0, mo_vgl, LDC) + + end if end function qmckl_compute_mo_basis_mo_vgl_doc_f #+end_src From 1889fed1006921c78fc11c8de16e9cb780f41d84 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 5 May 2022 20:49:44 +0200 Subject: [PATCH 3/3] Fixed mo bug --- org/qmckl_mo.org | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/org/qmckl_mo.org b/org/qmckl_mo.org index 5d49030..66023c0 100644 --- a/org/qmckl_mo.org +++ b/org/qmckl_mo.org @@ -669,7 +669,7 @@ integer function qmckl_compute_mo_basis_mo_vgl_doc_f(context, & integer*8 :: LDA, LDB, LDC info = QMCKL_SUCCESS - if (.False.) then ! fast algorithm + if (.True.) then ! fast algorithm do j=1,point_num mo_vgl(:,:,j) = 0.d0 do k=1,ao_num @@ -810,11 +810,12 @@ qmckl_compute_mo_basis_mo_vgl_hpc (const qmckl_context context, #endif for (int64_t ipoint=0 ; ipoint < point_num ; ++ipoint) { double* restrict const vgl1 = &(mo_vgl[ipoint*5*mo_num]); - const double* restrict avgl1 = &(ao_vgl[ipoint*5*ao_num]); double* restrict const vgl2 = vgl1 + mo_num; double* restrict const vgl3 = vgl1 + (mo_num << 1); double* restrict const vgl4 = vgl1 + (mo_num << 1) + mo_num; double* restrict const vgl5 = vgl1 + (mo_num << 2); + + const double* restrict avgl1 = &(ao_vgl[ipoint*5*ao_num]); const double* restrict avgl2 = avgl1 + ao_num; const double* restrict avgl3 = avgl1 + (ao_num << 1); const double* restrict avgl4 = avgl1 + (ao_num << 1) + ao_num; @@ -849,6 +850,7 @@ qmckl_compute_mo_basis_mo_vgl_hpc (const qmckl_context context, } int64_t n; + for (n=0 ; n < nidx-4 ; n+=4) { int64_t k = idx[n]; const double* restrict ck1 = coef_normalized_t + idx[n ]*mo_num; @@ -893,8 +895,7 @@ qmckl_compute_mo_basis_mo_vgl_hpc (const qmckl_context context, } } - int64_t n0 = nidx-4; - n0 = n0 < 0 ? 0 : n0; + const int64_t n0 = n < 0 ? 0 : n; for (int64_t n=n0 ; n < nidx ; n+=1) { const double* restrict ck = coef_normalized_t + idx[n]*mo_num; const double a1 = av1[n];