From 2e45927e04909c3f7c396e910b46e78cc81e91a7 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 30 Jan 2023 17:35:11 +0100 Subject: [PATCH 01/30] Added AVX2 detection to autoconfig script. Fixed minor SIMD bug in tests. --- configure.ac | 2 ++ org/qmckl_sherman_morrison_woodbury.org | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cefb260..727c585 100644 --- a/configure.ac +++ b/configure.ac @@ -223,6 +223,8 @@ AC_RUN_IFELSE( int simd=1; #if defined(__AVX512F__) simd=8; +#elif defined(__AVX2__) + simd=4; #elif defined(__AVX__) simd=4; #elif defined(__SSE2__) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 71d6544..fcceed9 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -418,7 +418,7 @@ The tests for the kernels are executed on datasets that are extracted from a run #+begin_src c :tangle (eval c_test) const uint64_t Dim = 21; -const uint64_t LDS = (1 + (Dim) / SIMD_LENGTH) * SIMD_LENGTH; +const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH; const double breakdown = 1e-3; const double tolerance = 1e-3; double res[441]; From d3aebe52fff635d91029b0107ce556bf56495050 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 2 Feb 2023 17:04:34 +0100 Subject: [PATCH 02/30] Started adding the pedagogical kernels for the HAVE_DOC builds. --- org/qmckl_sherman_morrison_woodbury.org | 656 +++++++++++++----------- 1 file changed, 366 insertions(+), 290 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index fcceed9..0c4b7a9 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -9,281 +9,307 @@ * Headers #+begin_src elisp :noexport :results none :exports none -(org-babel-lob-ingest "../tools/lib.org") -#+end_src + (org-babel-lob-ingest "../tools/lib.org") + #+end_src #+begin_src c :comments link :tangle (eval c_test) :noweb yes -#include "qmckl.h" -#include "assert.h" -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include + #include "qmckl.h" + #include "assert.h" + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + #include -int main() { - qmckl_context context; - context = qmckl_context_create(); - qmckl_exit_code rc; + int main() { + qmckl_context context; + context = qmckl_context_create(); + qmckl_exit_code rc; #+end_src #+NAME:kernel_generator_range #+begin_src python :noweb yes :exports none -range(2, 22) + range(2, 22) #+end_src * Naïve Sherman-Morrison - ** ~qmckl_sherman_morrison_naive~ - :PROPERTIES: - :Name: qmckl_sherman_morrison_naive - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: + :PROPERTIES: + :Name: qmckl_sherman_morrison_naive + :CRetType: qmckl_exit_code + :FRetType: qmckl_exit_code + :END: - This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in - the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to - zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. + This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in + the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to + zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. - The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is - \[ + The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is + \[ (S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u} - \] + \] - where - $S$ is the Slater-matrix, - $u$ and $v^T$ are the column and row vectors containing the updates, - $S^{-1}$ is the inverse of the Slater-matrix. + where + $S$ is the Slater-matrix, + $u$ and $v^T$ are the column and row vectors containing the updates, + $S^{-1}$ is the inverse of the Slater-matrix. - Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying - updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse - matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to - evaluate each individual update $u_j$ when it is applied. + Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying + updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse + matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to + evaluate each individual update $u_j$ when it is applied. - This value sets the lower bound for which the - denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular matrix - $S$, or at least in an inverse of $S$ of very poor numerical quality. Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, - the update is applied as usual and the kernel exits with return code \texttt{QMCKL_SUCCESS}. - If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits with return code \texttt{QMCKL_FAILURE}. + This value sets the lower bound for which the + denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular matrix + $S$, or at least in an inverse of $S$ of very poor numerical quality. Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, + the update is applied as usual and the kernel exits with return code \texttt{QMCKL_SUCCESS}. + If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits with return code \texttt{QMCKL_FAILURE}. - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. + If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting + from applying the updates to the original matrix. - #+NAME: qmckl_sherman_morrison_naive_args - | qmckl_context | context | in | Global state | - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | uint64_t | N_updates | in | Number of rank-1 updates to be applied to Slater_inv | - | double | Updates[N_updates*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[N_updates] | in | Array containing the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | - | double* | determinant | inout | Determinant of the Slater-matrix | + #+NAME: qmckl_sherman_morrison_naive_args + | qmckl_context | context | in | Global state | + | uint64_t | LDS | in | Leading dimension of Slater_inv | + | uint64_t | Dim | in | Dimension of Slater_inv | + | uint64_t | N_updates | in | Number of rank-1 updates to be applied to Slater_inv | + | double | Updates[N_updates*Dim] | in | Array containing the updates | + | uint64_t | Updates_index[N_updates] | in | Array containing the rank-1 updates | + | double | breakdown | in | Break-down parameter on which to fail or not | + | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | + | double* | determinant | inout | Determinant of the Slater-matrix | *** Requirements - * ~context~ is not ~QMCKL_NULL_CONTEXT~ - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~context~ is not ~QMCKL_NULL_CONTEXT~ + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + +*** Fortran source + + #+begin_src f90 :tangle (eval f) + integer function qmckl_sherman_morrison_naive_doc_f & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + real (c_double ) , intent(inout) :: determinant + + write(*,*) "Function 'qmckl_sherman_morrison_naive_doc_f' does nothing for now..." + + end function qmckl_sherman_morrison_naive_doc_f + #+end_src + *** C header - #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) + #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_naive( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src + #+RESULTS: + #+begin_src c :tangle (eval h_func) :comments org + qmckl_exit_code qmckl_sherman_morrison_naive( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant); + #+end_src + #+begin_src c :tangle (eval h_func) :comments org + qmckl_exit_code qmckl_sherman_morrison_naive_doc( + const qmckl_context context, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant); + #+end_src +*** C source + #+begin_src c :tangle (eval c) :comments org + #include + #include + #include "qmckl.h" + #include "config.h" + // Order important because + // __GNUC__ also set in ICC, ICX and CLANG + // __clang__ also set in ICX + #if defined(__INTEL_COMPILER) + #define IVDEP _Pragma("ivdep") + #define ALIGNED _Pragma("vector aligned") + #elif defined(__INTEL_LLVM_COMPILER) + #define IVDEP _Pragma("ivdep") + #define ALIGNED _Pragma("vector aligned") + #elif defined(__clang__) + #define IVDEP _Pragma("clang loop vectorize(enable)") + #define ALIGNED + #elif defined(__GNUC__) + #define IVDEP _Pragma("GCC ivdep") + #define ALIGNED + #endif - #+begin_src c :tangle (eval c) :comments org -#include -#include -#include "qmckl.h" -#include "config.h" + qmckl_exit_code qmckl_sherman_morrison_naive_hpc( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict determinant) { -// Order important because -// __GNUC__ also set in ICC, ICX and CLANG -// __clang__ also set in ICX -#if defined(__INTEL_COMPILER) - #define IVDEP _Pragma("ivdep") - #define ALIGNED _Pragma("vector aligned") -#elif defined(__INTEL_LLVM_COMPILER) - #define IVDEP _Pragma("ivdep") - #define ALIGNED _Pragma("vector aligned") -#elif defined(__clang__) - #define IVDEP _Pragma("clang loop vectorize(enable)") - #define ALIGNED -#elif defined(__GNUC__) - #define IVDEP _Pragma("GCC ivdep") - #define ALIGNED -#endif + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith( context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_naive_hpc", + NULL); + } -qmckl_exit_code qmckl_sherman_morrison_naive_hpc( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { + double __attribute__((aligned(8))) C[Dim]; + double __attribute__((aligned(8))) D[LDS]; - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith( context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive_hpc", - NULL); - } - - double __attribute__((aligned(8))) C[Dim]; - double __attribute__((aligned(8))) D[LDS]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = S^{-1} x u_l - for (uint64_t i = 0; i < Dim; i++) { + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = S^{-1} x u_l + for (uint64_t i = 0; i < Dim; i++) { C[i] = 0.0f; IVDEP ALIGNED for (uint64_t j = 0; j < LDS; j++) { - C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; + C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; } - } + } - // Denominator: v_l^T * C - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; + // Denominator: v_l^T * C + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; - if (fabs(den) < breakdown) { + if (fabs(den) < breakdown) return QMCKL_FAILURE; - } - double iden = 1.0f / den; - // Update det(A) - if (determinant) + double iden = 1.0f / den; + + // Update det(A) + if (determinant) *determinant *= den; - // selecting column: v_l^T * S_inv - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { + // selecting column: v_l^T * S_inv + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { D[j] = Slater_inv[cui * LDS + j]; - } + } - // A^{-1} = A^{-1} - C x D / den - for (uint64_t i = 0; i < Dim; i++) { + // A^{-1} = A^{-1} - C x D / den + for (uint64_t i = 0; i < Dim; i++) { IVDEP ALIGNED for (uint64_t j = 0; j < LDS; j++) { - const double update = C[i] * D[j] * iden; - Slater_inv[i * LDS + j] -= update; + const double update = C[i] * D[j] * iden; + Slater_inv[i * LDS + j] -= update; } + } + l += 1; } - l += 1; - } - return QMCKL_SUCCESS; -} - #+end_src - - - - - - #+NAME:naive_template_code - #+begin_src c -static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}( - const qmckl_context context, - const uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith( context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive_{Dim}", - NULL); - } - - #define D{Dim}_P ((1+({Dim}-1)/SIMD_LENGTH)*SIMD_LENGTH) - - double __attribute__((aligned(8))) C[{Dim}]; - double __attribute__((aligned(8))) D[D{Dim}_P]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = A^{-1} x U_l - for (uint64_t i = 0; i < {Dim}; i++) { - C[i] = 0; - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; + return QMCKL_SUCCESS; } - } + #+end_src - // Denominator - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; + #+NAME:naive_template_code + #+begin_src c + static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}( + const qmckl_context context, + const uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict determinant) { - if (fabs(den) < breakdown) { - return QMCKL_FAILURE; - } - double iden = 1.0f / den; + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith(context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_naive_{Dim}", + NULL); + } - // Update det(A) - if (determinant) - *determinant *= den; + #define D{Dim}_P ((1+({Dim}-1)/SIMD_LENGTH)*SIMD_LENGTH) - // selecting column: D = v_l^T * S_inv - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - D[j] = Slater_inv[cui * D{Dim}_P + j]; - } + double __attribute__((aligned(8))) C[{Dim}]; + double __attribute__((aligned(8))) D[D{Dim}_P]; - // A^{-1} = A^{-1} - C x D / den - for (uint64_t i = 0; i < {Dim}; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - double update = C[i] * D[j] * iden; - Slater_inv[i * D{Dim}_P + j] -= update; + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = A^{-1} x U_l + for (uint64_t i = 0; i < {Dim}; i++) { + C[i] = 0; + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; + } + } + + // Denominator + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; + + if (fabs(den) < breakdown) { + return QMCKL_FAILURE; + } + double iden = 1.0f / den; + + // Update det(A) + if (determinant) + *determinant *= den; + + // selecting column: D = v_l^T * S_inv + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + D[j] = Slater_inv[cui * D{Dim}_P + j]; + } + + // A^{-1} = A^{-1} - C x D / den + for (uint64_t i = 0; i < {Dim}; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + double update = C[i] * D[j] * iden; + Slater_inv[i * D{Dim}_P + j] -= update; + } + } + + l += 1; + } + + return QMCKL_SUCCESS; } - } - - l += 1; - } - - return QMCKL_SUCCESS; -} - #+end_src - - - - + #+end_src #+NAME:naive_kernel_generator #+begin_src python :noweb yes :exports none @@ -298,10 +324,6 @@ for Dim in <>: return '\n'.join(result) #+end_src - - - - #+NAME:naive_switch-case_generator #+begin_src python :noweb yes :exports none text=""" @@ -322,10 +344,6 @@ for Dim in <>: return '\n'.join(result) #+end_src - - - - #+begin_src c :tangle (eval c) :comments org :noweb yes <> @@ -346,6 +364,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, NULL); } + #ifdef HAVE_HPC if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases switch (Dim) { <> @@ -363,20 +382,115 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, determinant); } + #else + return qmckl_sherman_morrison_naive_doc(context, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); + #endif return QMCKL_FAILURE; } #+end_src +*** Test :noexport: + The tests for the kernels are executed on datasets that are extracted from a run of + QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. + The tests are run such that the kernels reject the computed inverse whenever the computed + intermediate determinants or denominators are smaller than 1e-3. This is the default value in + QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix + $R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return + QMCKL_FAILURE if the values are larger than this tolerance value. + #+begin_src c :tangle (eval c_test) + const uint64_t Dim = 21; + const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH; + const double breakdown = 1e-3; + const double tolerance = 1e-3; + double res[441]; + #include "sm_test.h" -*** Performance + assert(Updates1 != NULL); + assert(Updates_index1 != NULL); + assert(Slater_inv1 != NULL); - This function performs best when there is only 1 rank-1 update in the update cycle. It is not useful to - use Sherman-Morrison with update splitting for these cycles since splitting can never resolve a situation - where applying the update causes singular behaviour. + // original determinant of Slater1 (before applying updates) + double det = 3.407025646103221e-10; + rc = qmckl_sherman_morrison_naive(context, + LDS, + Dim, + N_updates1, + Updates1, + Updates_index1, + breakdown, + Slater_inv1, + &det); + + // Check that the determinant is updated properly + assert(fabs(det + 4.120398385068217e-10) < 1e-15); + + for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + res[i * Dim + j] = 0; + for (unsigned int k = 0; k < Dim; k++) { + res[i * Dim + j] += Slater1[i * Dim + k] * Slater_inv1[k * LDS + j]; + } + } + } + rc = QMCKL_SUCCESS; + for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { + rc = QMCKL_FAILURE; + } + if (i != j && fabs(res[i * Dim + j]) > tolerance) { + rc = QMCKL_FAILURE; + } + } + } + assert(rc == QMCKL_SUCCESS); + #+end_src + +** Performance + + This function performs best when there is only 1 rank-1 update in the update cycle. It is + not useful to use Sherman-Morrison with update splitting for these cycles since splitting + can never resolve a situation where applying the update causes singular behaviour. + +** C interface +#+begin_src f90 :tangle (eval f) :comments org :exports none + interface + integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + real (c_double ) , intent(inout) :: determinant + + integer(c_int32_t), external :: qmckl_sherman_morrison_naive_doc_f + info = qmckl_sherman_morrison_naive_doc_f & + (context, Dim, N_updates, Updates, & + Updates_index, breakdown, Slater_inv, determinant) + + end function qmckl_sherman_morrison_naive_doc + end interface + #+end_src ** Fortran interface :noexport: :PROPERTIES: @@ -412,63 +526,31 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, end interface #+end_src -*** Test :noexport: + #+begin_src f90 :tangle (eval fh_func) :comments org :exports none + interface + integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & + (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) -The tests for the kernels are executed on datasets that are extracted from a run of QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. The tests are run such that the kernels reject the computed inverse whenever the computed intermediate determinants or denominators are smaller than 1e-3. This is the default value in QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix $R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return QMCKL_FAILURE if the values are larger than this tolerance value. + use, intrinsic :: iso_c_binding + import + implicit none - #+begin_src c :tangle (eval c_test) -const uint64_t Dim = 21; -const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH; -const double breakdown = 1e-3; -const double tolerance = 1e-3; -double res[441]; + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*Dim) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) + real (c_double ) , intent(inout) :: determinant -#include "sm_test.h" - -assert(Updates1 != NULL); -assert(Updates_index1 != NULL); -assert(Slater_inv1 != NULL); - -// original determinant of Slater1 (before applying updates) -double det = 3.407025646103221e-10; -rc = qmckl_sherman_morrison_naive(context, - LDS, - Dim, - N_updates1, - Updates1, - Updates_index1, - breakdown, - Slater_inv1, - &det); - -// Check that the determinant is updated properly -assert(fabs(det + 4.120398385068217e-10) < 1e-15); - -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - res[i * Dim + j] = 0; - for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater1[i * Dim + k] * Slater_inv1[k * LDS + j]; - } - } -} -rc = QMCKL_SUCCESS; -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { - rc = QMCKL_FAILURE; - } - if (i != j && fabs(res[i * Dim + j]) > tolerance) { - rc = QMCKL_FAILURE; - } - } -} -assert(rc == QMCKL_SUCCESS); - #+end_src + end function qmckl_sherman_morrison_naive_doc + end interface + #+end_src * Woodbury 2x2 - -** ~qmckl_woodbury_2x2~ + ** ~qmckl_woodbury_2x2~ :PROPERTIES: :Name: qmckl_woodbury_2x2 :CRetType: qmckl_exit_code @@ -790,13 +872,12 @@ qmckl_exit_code qmckl_woodbury_2x2(const qmckl_context context, - *** Performance This function is most efficient when used in cases where there are only 2 rank-1 updates and it is sure they will not result in a singular matrix. -** Fortran interface :noexport: + ** Fortran interface :noexport: :PROPERTIES: :Name: qmckl_woodbury_2x2 :CRetType: qmckl_exit_code @@ -860,7 +941,6 @@ assert(rc == QMCKL_SUCCESS); #+end_src * Woodbury 3x3 - ** ~qmckl_woodbury_3x3~ :PROPERTIES: :Name: qmckl_woodbury_3x3 @@ -1209,13 +1289,12 @@ qmckl_exit_code qmckl_woodbury_3x3(const qmckl_context context, #+end_src - *** Performance... This function is most efficient when used in cases where there are only 3 rank-1 updates and it is sure they will not result in a singular matrix. -** Fortran interface :noexport: + ** Fortran interface :noexport: :PROPERTIES: :Name: qmckl_woodbury_3x3 :CRetType: qmckl_exit_code @@ -1279,7 +1358,6 @@ assert(rc == QMCKL_SUCCESS); #+end_src * Sherman-Morrison with update splitting - ** ~qmckl_sherman_morrison_splitting~ :PROPERTIES: :Name: qmckl_sherman_morrison_splitting @@ -1314,7 +1392,6 @@ assert(rc == QMCKL_SUCCESS); If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting from applying the updates to the original matrix. - *** Requirements * ~context~ is not ~QMCKL_NULL_CONTEXT~ @@ -1454,8 +1531,7 @@ assert(rc == QMCKL_SUCCESS); #+end_src * Woodbury 3x3 and 2x2 with Sherman-Morrison and update splitting - -** ~qmckl_sherman_morrison_smw32s~ + ** ~qmckl_sherman_morrison_smw32s~ :PROPERTIES: :Name: qmckl_sherman_morrison_smw32s :CRetType: qmckl_exit_code @@ -1639,7 +1715,7 @@ qmckl_exit_code qmckl_sherman_morrison_smw32s(const qmckl_context context, This kernel performs best for update cycles with 2 or more rank-1 updates and the fail-rate is low. -** Fortran interface :noexport: + ** Fortran interface :noexport: :PROPERTIES: :Name: qmckl_sherman_morrison_smw32s :CRetType: qmckl_exit_code From 8a89003bf24e1df8535da8598f3fd39fcccbd10d Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 2 Feb 2023 17:23:14 +0100 Subject: [PATCH 03/30] Commented call to `_doc` kernel. --- org/qmckl_sherman_morrison_woodbury.org | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 0c4b7a9..30117b9 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -364,7 +364,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, NULL); } - #ifdef HAVE_HPC + // #ifdef HAVE_HPC if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases switch (Dim) { <> @@ -382,16 +382,16 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, determinant); } - #else - return qmckl_sherman_morrison_naive_doc(context, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); - #endif + // #else + // return qmckl_sherman_morrison_naive_doc(context, + // Dim, + // N_updates, + // Updates, + // Updates_index, + // breakdown, + // Slater_inv, + // determinant); + // #endif return QMCKL_FAILURE; } From 06127f24cb42a4d3f34c4faef0f9319a23a0833a Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 2 Feb 2023 17:34:33 +0100 Subject: [PATCH 04/30] added return value to fortran interface. --- org/qmckl_sherman_morrison_woodbury.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 30117b9..e7e78ca 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -468,7 +468,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, interface integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) + bind(C) result(info) use, intrinsic :: iso_c_binding import From cc17b79316481db9703c592d0f6347bfaba24e56 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Fri, 10 Feb 2023 16:45:22 +0100 Subject: [PATCH 05/30] Still working --- org/qmckl_sherman_morrison_woodbury.org | 2314 ++++------------------- 1 file changed, 417 insertions(+), 1897 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index e7e78ca..7d2b32d 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -3,42 +3,42 @@ #+INCLUDE: ../tools/lib.org #+STARTUP: content - Low- and high-level functions that use the Sherman-Morrison and - Woodbury matrix inversion formulas to update the inverse of a - non-singular matrix +Low- and high-level functions that use the Sherman-Morrison and +Woodbury matrix inversion formulas to update the inverse of a +non-singular matrix * Headers - #+begin_src elisp :noexport :results none :exports none - (org-babel-lob-ingest "../tools/lib.org") - #+end_src +#+begin_src elisp :noexport :results none :exports none +(org-babel-lob-ingest "../tools/lib.org") +#+end_src - #+begin_src c :comments link :tangle (eval c_test) :noweb yes - #include "qmckl.h" - #include "assert.h" - #ifdef HAVE_CONFIG_H - #include "config.h" - #endif - #include +#+begin_src c :comments link :tangle (eval c_test) :noweb yes +#include "qmckl.h" +#include "assert.h" +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif +#include - int main() { - qmckl_context context; - context = qmckl_context_create(); - qmckl_exit_code rc; - #+end_src +int main() { + qmckl_context context; + context = qmckl_context_create(); + qmckl_exit_code rc; +#+end_src - #+NAME:kernel_generator_range - #+begin_src python :noweb yes :exports none - range(2, 22) - #+end_src +#+NAME:kernel_generator_range +#+begin_src python :noweb yes :exports none +range(2, 22) +#+end_src + * Naïve Sherman-Morrison -** ~qmckl_sherman_morrison_naive~ :PROPERTIES: :Name: qmckl_sherman_morrison_naive :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: - + This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. @@ -67,18 +67,87 @@ If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting from applying the updates to the original matrix. - #+NAME: qmckl_sherman_morrison_naive_args - | qmckl_context | context | in | Global state | - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | uint64_t | N_updates | in | Number of rank-1 updates to be applied to Slater_inv | - | double | Updates[N_updates*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[N_updates] | in | Array containing the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | - | double* | determinant | inout | Determinant of the Slater-matrix | +#+NAME: qmckl_sherman_morrison_naive_args +| Variable | Type | In/Out | Description | +|-----------------+-------------------------+--------+------------------------------------------------------| +| ~context~ | ~qmckl_context~ | in | Global state | +| ~LDS~ | ~uint64_t~ | in | Leading dimension of Slater_inv | +| ~Dim~ | ~uint64_t~ | in | Dimension of Slater_inv | +| ~N_updates~ | ~uint64_t~ | in | Number of rank-1 updates to be applied to Slater_inv | +| ~Updates~ | ~double[N_updates*LDS]~ | in | Array containing the updates | +| ~Updates_index~ | ~uint64_t[N_updates]~ | in | Array containing the rank-1 updates | +| ~breakdown~ | ~double~ | in | Break-down parameter on which to fail or not | +| ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse of a Slater-matrix | +| ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | -*** Requirements +** Pedagogical kernel source (in Fortran) + +#+begin_src f90 :tangle (eval f) +integer function qmckl_sherman_morrison_naive_doc_f(context, & + LDS, Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + determinant) result(info) + + use qmckl + implicit none + integer*8 , intent(in) :: context + integer*8 , intent(in) :: LDS, Dim + integer*8 , intent(in) :: N_updates + integer*8 , intent(in) :: Updates_index(N_updates) + real*8 , intent(in) :: Updates(N_updates*LDS) + real*8 , intent(in) :: breakdown + real*8 , intent(inout) :: Slater_inv(Dim*LDS) + real*8 , intent(inout) :: determinant + + info = 0 + + if (context == QMCKL_NULL_CONTEXT) then + info = QMCKL_INVALID_CONTEXT + return + endif + + write(*,*) "Function 'qmckl_sherman_morrison_naive_doc_f' does nothing for now..." + + info = QMCKL_SUCCESS + +end function qmckl_sherman_morrison_naive_doc_f +#+end_src + +*** C interface to the pedagogical kernel + +#+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval f) :comments org :exports none +integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + integer(c_int32_t), external :: qmckl_sherman_morrison_naive_doc_f + info = qmckl_sherman_morrison_naive_doc_f & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) + +end function qmckl_sherman_morrison_naive_doc +#+end_src + +** Requirements * ~context~ is not ~QMCKL_NULL_CONTEXT~ * ~LDS >= 2~ @@ -88,263 +157,261 @@ * ~Updates_index~ is allocated with $N_updates$ elements * ~breakdown~ is a small number such that $0 < breakdown << 1$ * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~determinant > 0~ -*** Fortran source +** C headers (exposed in qmckl.h) - #+begin_src f90 :tangle (eval f) - integer function qmckl_sherman_morrison_naive_doc_f & - (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) +#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - use, intrinsic :: iso_c_binding - implicit none +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_sherman_morrison_naive ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant ); +#+end_src - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) - real (c_double ) , intent(inout) :: determinant +#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_hpc") - write(*,*) "Function 'qmckl_sherman_morrison_naive_doc_f' does nothing for now..." +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_sherman_morrison_naive_hpc ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant ); +#+end_src - end function qmckl_sherman_morrison_naive_doc_f - #+end_src +#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_sherman_morrison_naive_doc ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant ); +#+end_src -*** C header +** C sources - #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) +#+begin_src c :tangle (eval c) :comments org +#include +#include +#include "qmckl.h" +#include "config.h" - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_naive( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src +// Order important because +// __GNUC__ also set in ICC, ICX and CLANG +// __clang__ also set in ICX +#if defined(__INTEL_COMPILER) + #define IVDEP _Pragma("ivdep") + #define ALIGNED _Pragma("vector aligned") +#elif defined(__INTEL_LLVM_COMPILER) + #define IVDEP _Pragma("ivdep") + #define ALIGNED _Pragma("vector aligned") +#elif defined(__clang__) + #define IVDEP _Pragma("clang loop vectorize(enable)") + #define ALIGNED +#elif defined(__GNUC__) + #define IVDEP _Pragma("GCC ivdep") + #define ALIGNED +#endif +#+end_src - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_naive_doc( - const qmckl_context context, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src +#+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_sherman_morrison_naive_hpc( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict determinant) { -*** C source + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith( context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_naive_hpc", + NULL); + } - #+begin_src c :tangle (eval c) :comments org - #include - #include - #include "qmckl.h" - #include "config.h" + double __attribute__((aligned(8))) C[Dim]; + double __attribute__((aligned(8))) D[LDS]; - // Order important because - // __GNUC__ also set in ICC, ICX and CLANG - // __clang__ also set in ICX - #if defined(__INTEL_COMPILER) - #define IVDEP _Pragma("ivdep") - #define ALIGNED _Pragma("vector aligned") - #elif defined(__INTEL_LLVM_COMPILER) - #define IVDEP _Pragma("ivdep") - #define ALIGNED _Pragma("vector aligned") - #elif defined(__clang__) - #define IVDEP _Pragma("clang loop vectorize(enable)") - #define ALIGNED - #elif defined(__GNUC__) - #define IVDEP _Pragma("GCC ivdep") - #define ALIGNED - #endif - - qmckl_exit_code qmckl_sherman_morrison_naive_hpc( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith( context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive_hpc", - NULL); - } - - double __attribute__((aligned(8))) C[Dim]; - double __attribute__((aligned(8))) D[LDS]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = S^{-1} x u_l - for (uint64_t i = 0; i < Dim; i++) { - C[i] = 0.0f; - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; - } - } - - // Denominator: v_l^T * C - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; - - if (fabs(den) < breakdown) - return QMCKL_FAILURE; - - double iden = 1.0f / den; - - // Update det(A) - if (determinant) - *determinant *= den; - - // selecting column: v_l^T * S_inv - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - D[j] = Slater_inv[cui * LDS + j]; - } - - // A^{-1} = A^{-1} - C x D / den - for (uint64_t i = 0; i < Dim; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - const double update = C[i] * D[j] * iden; - Slater_inv[i * LDS + j] -= update; - } - } - l += 1; - } - return QMCKL_SUCCESS; + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = S^{-1} x u_l + for (uint64_t i = 0; i < Dim; i++) { + C[i] = 0.0f; + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; } - #+end_src + } - #+NAME:naive_template_code - #+begin_src c - static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}( - const qmckl_context context, - const uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { + // Denominator: v_l^T * C + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive_{Dim}", - NULL); - } + if (fabs(den) < breakdown) + return QMCKL_FAILURE; - #define D{Dim}_P ((1+({Dim}-1)/SIMD_LENGTH)*SIMD_LENGTH) + double iden = 1.0f / den; - double __attribute__((aligned(8))) C[{Dim}]; - double __attribute__((aligned(8))) D[D{Dim}_P]; + // Update det(A) + if (determinant) + *determinant *= den; - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = A^{-1} x U_l - for (uint64_t i = 0; i < {Dim}; i++) { - C[i] = 0; - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; - } - } + // selecting column: v_l^T * S_inv + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + D[j] = Slater_inv[cui * LDS + j]; + } - // Denominator - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; - - if (fabs(den) < breakdown) { - return QMCKL_FAILURE; - } - double iden = 1.0f / den; - - // Update det(A) - if (determinant) - *determinant *= den; - - // selecting column: D = v_l^T * S_inv - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - D[j] = Slater_inv[cui * D{Dim}_P + j]; - } - - // A^{-1} = A^{-1} - C x D / den - for (uint64_t i = 0; i < {Dim}; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - double update = C[i] * D[j] * iden; - Slater_inv[i * D{Dim}_P + j] -= update; - } - } - - l += 1; - } - - return QMCKL_SUCCESS; + // A^{-1} = A^{-1} - C x D / den + for (uint64_t i = 0; i < Dim; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + const double update = C[i] * D[j] * iden; + Slater_inv[i * LDS + j] -= update; } - #+end_src + } + l += 1; + } + return QMCKL_SUCCESS; +} +#+end_src - #+NAME:naive_kernel_generator - #+begin_src python :noweb yes :exports none +#+NAME:naive_template_code +#+begin_src c + static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}( + const qmckl_context context, + const uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict determinant) { + + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith(context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_naive_{Dim}", + NULL); + } + + #define D{Dim}_P ((1+({Dim}-1)/SIMD_LENGTH)*SIMD_LENGTH) + + double __attribute__((aligned(8))) C[{Dim}]; + double __attribute__((aligned(8))) D[D{Dim}_P]; + + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = A^{-1} x U_l + for (uint64_t i = 0; i < {Dim}; i++) { + C[i] = 0; + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; + } + } + + // Denominator + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; + + if (fabs(den) < breakdown) { + return QMCKL_FAILURE; + } + double iden = 1.0f / den; + + // Update det(A) + if (determinant) + *determinant *= den; + + // selecting column: D = v_l^T * S_inv + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + D[j] = Slater_inv[cui * D{Dim}_P + j]; + } + + // A^{-1} = A^{-1} - C x D / den + for (uint64_t i = 0; i < {Dim}; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + double update = C[i] * D[j] * iden; + Slater_inv[i * D{Dim}_P + j] -= update; + } + } + + l += 1; + } + + return QMCKL_SUCCESS; + } + #+end_src + +#+NAME:naive_kernel_generator +#+begin_src python :noweb yes :exports none text=""" <> """ result = [] for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) + Dim=str(Dim) + result.append(text.replace("{Dim}",Dim) ) return '\n'.join(result) - #+end_src +#+end_src - #+NAME:naive_switch-case_generator - #+begin_src python :noweb yes :exports none +#+NAME:naive_switch-case_generator +#+begin_src python :noweb yes :exports none text=""" case {Dim}: return qmckl_sherman_morrison_naive_{Dim}(context, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); """ result = [] for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) + Dim=str(Dim) +result.append(text.replace("{Dim}",Dim) ) return '\n'.join(result) - #+end_src +#+end_src - #+begin_src c :tangle (eval c) :comments org :noweb yes +#+begin_src c :tangle (eval c) :comments org :noweb yes <> qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, @@ -364,7 +431,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, NULL); } - // #ifdef HAVE_HPC + #ifdef HAVE_HPC if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases switch (Dim) { <> @@ -382,23 +449,108 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, determinant); } - // #else - // return qmckl_sherman_morrison_naive_doc(context, - // Dim, - // N_updates, - // Updates, - // Updates_index, - // breakdown, - // Slater_inv, - // determinant); - // #endif + #else + return qmckl_sherman_morrison_naive_doc(context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); + #endif return QMCKL_FAILURE; } - #+end_src +#+end_src -*** Test :noexport: +** Fortran interface + :PROPERTIES: + :Name: qmckl_sherman_morrison_naive + :CRetType: qmckl_exit_code + :FRetType: qmckl_exit_code + :END: +#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive_hpc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sherman_morrison_naive_hpc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sherman_morrison_naive_hpc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sherman_morrison_naive_doc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sherman_morrison_naive & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sherman_morrison_naive +end interface +#+end_src + +** Test The tests for the kernels are executed on datasets that are extracted from a run of QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. The tests are run such that the kernels reject the computed inverse whenever the computed @@ -457,1638 +609,6 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, assert(rc == QMCKL_SUCCESS); #+end_src -** Performance - - This function performs best when there is only 1 rank-1 update in the update cycle. It is - not useful to use Sherman-Morrison with update splitting for these cycles since splitting - can never resolve a situation where applying the update causes singular behaviour. - -** C interface -#+begin_src f90 :tangle (eval f) :comments org :exports none - interface - integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & - (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) result(info) - - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) - real (c_double ) , intent(inout) :: determinant - - integer(c_int32_t), external :: qmckl_sherman_morrison_naive_doc_f - info = qmckl_sherman_morrison_naive_doc_f & - (context, Dim, N_updates, Updates, & - Updates_index, breakdown, Slater_inv, determinant) - - end function qmckl_sherman_morrison_naive_doc - end interface - #+end_src - -** Fortran interface :noexport: - :PROPERTIES: - :Name: qmckl_sherman_morrison_naive - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - #+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src f90 :tangle (eval fh_func) :comments org :exports none - interface - integer(c_int32_t) function qmckl_sherman_morrison_naive & - (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(LDS*Dim) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_sherman_morrison_naive - end interface - #+end_src - - #+begin_src f90 :tangle (eval fh_func) :comments org :exports none - interface - integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & - (context, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*Dim) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_sherman_morrison_naive_doc - end interface - #+end_src - -* Woodbury 2x2 - ** ~qmckl_woodbury_2x2~ - :PROPERTIES: - :Name: qmckl_woodbury_2x2 - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - The Woodbury 2x2 kernel. It is used to apply two rank-1 updates at once. The formula used in - this algorithm is called the Woodbury Matrix Identity - \[ - (S + U V)^{-1} = S^{-1} - C B^{-1} D - \] - where - $S$ is the Slater-matrix - $U$ and $V$ are the matrices containing the updates and the canonical basis matrix - $S^{-1}$ is the inverse of the Slater-matrix - $C:= S^{-1}U$, a Dim $\times 2$ matrix - $B := 1 + VC$, the $2 \times 2$ matrix that is going to be inverted - $D := VS^{-1}$, a $2 \times Dim$ matrix - - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. - - - - #+NAME: qmckl_woodbury_2x2_args - | qmckl_context | context | in | Global state | - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | double | Updates[2*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[2] | in | Array containing the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | - | double* | determinant | inout | Determinant of Slater-matrix | - -*** Requirements - - - ~context~ is not ~qmckl_null_context~ - - ~LDS >= 2~ - - ~Dim >= 2~ - - ~Updates~ is allocated with $2 \times Dim$ elements - - ~Updates_index~ is allocated with $2$ elements - - ~breakdown~ is a small number such that $0 < breakdown << 1$ - - ~Slater_inv~ is allocated with $Dim \times Dim$ elements - -*** C header - - #+CALL: generate_c_header(table=qmckl_woodbury_2x2_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_woodbury_2x2( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src - -*** C source - - #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_woodbury_2x2_hpc(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { -/* - C := S^{-1} * U, dim x 2 - B := 1 + V * C, 2 x 2 - D := V * S^{-1}, 2 x dim -*/ - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_woodbury_2x2_hpc", - NULL); - } - - const uint64_t row1 = (Updates_index[0] - 1); - const uint64_t row2 = (Updates_index[1] - 1); - - // Compute C = (S^T)^{-1}U : Dim x 2 - double __attribute__((aligned(8))) C[2 * Dim]; - for (uint64_t i = 0; i < Dim; i++) { - C[i * 2] = 0; - C[i * 2 + 1] = 0; - IVDEP - ALIGNED - for (uint64_t k = 0; k < LDS; k++) { - C[i * 2] += Slater_inv[i * LDS + k] * Updates[k]; - C[i * 2 + 1] += Slater_inv[i * LDS + k] * Updates[LDS + k]; - } - } - - // Compute B = 1 + VC : 2 x 2 - const double B0 = C[row1 * 2] + 1; - const double B1 = C[row1 * 2 + 1]; - const double B2 = C[row2 * 2]; - const double B3 = C[row2 * 2 + 1] + 1; - - // Check if determinant of inverted matrix is not zero - double det = B0 * B3 - B1 * B2; - if (fabs(det) < breakdown) { - return QMCKL_FAILURE; - } - - // Update det(S) when passed - if (determinant) - *determinant *= det; - - // Compute B^{-1} with explicit formula for 2 x 2 inversion - double __attribute__((aligned(8))) Binv[4], idet = 1.0 / det; - Binv[0] = idet * B3; - Binv[1] = -1.0 * idet * B1; - Binv[2] = -1.0 * idet * B2; - Binv[3] = idet * B0; - - // tmp = B^{-1}D : 2 x LDS - double __attribute__((aligned(8))) tmp[2 * LDS]; - double* r1dim = &(Slater_inv[row1 * LDS]); - double* r2dim = &(Slater_inv[row2 * LDS]); - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - tmp[j] = Binv[0] * r1dim[j] + Binv[1] * r2dim[j]; - tmp[LDS + j] = Binv[2] * r1dim[j] + Binv[3] * r2dim[j]; - } - - // Compute (S^T)^{-1} - C * tmp : Dim x LDS - for (uint64_t i = 0; i < Dim; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - Slater_inv[i * LDS + j] -= C[i * 2] * tmp[j]; - Slater_inv[i * LDS + j] -= C[i * 2 + 1] * tmp[LDS + j]; - } - } - - return QMCKL_SUCCESS; -} - #+end_src - - - - - - #+NAME:woodbury_2x2_kernel_template - #+begin_src c -static inline qmckl_exit_code qmckl_woodbury_2x2_{Dim}( - const qmckl_context context, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { -/* - C := S^{-1} * U, dim x 2 - B := 1 + V * C, 2 x 2 - D := V * S^{-1}, 2 x dim -*/ - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_woodbury_2x2_{Dim}", - NULL); - } - - const uint64_t row1 = (Updates_index[0] - 1); - const uint64_t row2 = (Updates_index[1] - 1); - - // Compute C = (S^T)^{-1}U : {Dim} x 2 - double __attribute__((aligned(8))) C[2 * {Dim}]; - for (uint64_t i = 0; i < {Dim}; i++) { - C[i * 2] = 0; - C[i * 2 + 1] = 0; - IVDEP - ALIGNED - for (uint64_t k = 0; k < D{Dim}_P; k++) { - C[i * 2] += Slater_inv[i * D{Dim}_P + k] * Updates[k]; - C[i * 2 + 1] += Slater_inv[i * D{Dim}_P + k] * Updates[D{Dim}_P + k]; - } - } - - // Compute B = 1 + VC : 2 x 2 - const double B0 = C[row1 * 2] + 1; - const double B1 = C[row1 * 2 + 1]; - const double B2 = C[row2 * 2]; - const double B3 = C[row2 * 2 + 1] + 1; - - // Check if determinant of inverted matrix is not zero - double det = B0 * B3 - B1 * B2; - if (fabs(det) < breakdown) { - return QMCKL_FAILURE; - } - - // Update det(S) when passed - if (determinant) - *determinant *= det; - - // Compute B^{-1} with explicit formula for 2 x 2 inversion - double __attribute__((aligned(8))) Binv[4], idet = 1.0 / det; - Binv[0] = idet * B3; - Binv[1] = -1.0 * idet * B1; - Binv[2] = -1.0 * idet * B2; - Binv[3] = idet * B0; - - // tmp = B^{-1}D : 2 x D{Dim}_P - double __attribute__((aligned(8))) tmp[2 * D{Dim}_P]; - double* r1dim = &(Slater_inv[row1 * D{Dim}_P]); - double* r2dim = &(Slater_inv[row2 * D{Dim}_P]); - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - tmp[j] = Binv[0] * r1dim[j] + Binv[1] * r2dim[j]; - tmp[D{Dim}_P + j] = Binv[2] * r1dim[j] + Binv[3] * r2dim[j]; - } - - // Compute (S^T)^{-1} - C * tmp : {Dim} x D{Dim}_P - for (uint64_t i = 0; i < {Dim}; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - Slater_inv[i * D{Dim}_P + j] -= C[i * 2] * tmp[j]; - Slater_inv[i * D{Dim}_P + j] -= C[i * 2 + 1] * tmp[D{Dim}_P + j]; - } - } - - return QMCKL_SUCCESS; -} - #+end_src - - - - #+NAME:woodbury_2x2_kernel_generator - #+begin_src python :noweb yes :exports none -text=""" -<> -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) - #+end_src - - - - #+NAME:woodbury_2x2_switch-case_generator - #+begin_src python :noweb yes :exports none -text=""" -case {Dim}: - return qmckl_woodbury_2x2_{Dim}(context, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) - #+end_src - - - - - #+begin_src c :tangle (eval c) :comments org :noweb yes -<> - -qmckl_exit_code qmckl_woodbury_2x2(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_woodbury_2x2", - NULL); - } - - if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases - switch (Dim) { - <> - } - } - else { // When SIMD_LENGTH > 1, called with LDS == Dim AND Dim != (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) - return qmckl_woodbury_2x2_hpc(context, - LDS, - Dim, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); - - } - - return QMCKL_FAILURE; -} - #+end_src - - - - -*** Performance - - This function is most efficient when used in cases where there are only 2 rank-1 updates and - it is sure they will not result in a singular matrix. - - ** Fortran interface :noexport: - :PROPERTIES: - :Name: qmckl_woodbury_2x2 - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - #+CALL: generate_f_interface(table=qmckl_woodbury_2x2_args,rettyp=get_value("FRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src f90 :tangle (eval fh_func) :comments org :exports none - interface - integer(c_int32_t) function qmckl_woodbury_2x2 & - (context, LDS, Dim, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - real (c_double ) , intent(in) :: Updates(2*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(2) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(LDS*Dim) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_woodbury_2x2 - end interface - #+end_src - -*** Test :noexport: - - #+begin_src c :tangle (eval c_test) -assert(Updates2 != NULL); -assert(Updates_index2 != NULL); -assert(Slater_inv2 != NULL); -det = -1.4432116661319376e-11; -rc = qmckl_woodbury_2x2(context, LDS, Dim, Updates2, Updates_index2, breakdown, Slater_inv2, &det); -assert(fabs(det-2.367058141251457e-10) < 1e-15); -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - res[i * Dim + j] = 0; - for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater2[i * Dim + k] * Slater_inv2[k * LDS + j]; - } - } -} -rc = QMCKL_SUCCESS; -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { - rc = QMCKL_FAILURE; - } - if (i != j && fabs(res[i * Dim + j]) > tolerance) { - rc = QMCKL_FAILURE; - } - } -} -assert(rc == QMCKL_SUCCESS); - #+end_src - -* Woodbury 3x3 -** ~qmckl_woodbury_3x3~ - :PROPERTIES: - :Name: qmckl_woodbury_3x3 - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - The 3x3 version of the Woodbury 2x2 kernel. It is used to apply three - rank-1 updates at once. The formula used in this kernel is the same as for Woodbury 2x2, - except for the sizes of the following matrices: - - $C:= S^{-1}U$, a Dim $\times 3$ matrix - $B := 1 + VC$, the $3 \times 3$ matrix that is going to be inverted - $D := VS^{-1}$, a $3 \times Dim$ matrix - - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. - #pragma ivdep - #pragma vector aligned - - #+NAME: qmckl_woodbury_3x3_args - | qmckl_context | context | in | Global state | - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | double | Updates[3*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[3] | in | Array containing the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | - | double* | determinant | inout | Determinant of Slater-matrix | - -*** Requirements - - - ~context~ is not ~qmckl_null_context~ - - ~LDS >= 2~ - - ~Dim >= 2~ - - ~Updates~ is allocated with $3 \times Dim$ elements - - ~Updates_index~ is allocated with $3$ elements - - ~breakdown~ is a small number such that $0 < breakdown << 1$ - - ~Slater_inv~ is allocated with $Dim \times Dim$ elements - -*** C header - - #+CALL: generate_c_header(table=qmckl_woodbury_3x3_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_woodbury_3x3( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src - -*** C source - - #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_woodbury_3x3_hpc(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { -/* - C := S^{-1} * U, dim x 3 - B := 1 + V * C, 3 x 3 - D := V * S^{-1}, 3 x dim -,*/ - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_woodbury_3x3_hpc", - NULL); - } - - const uint64_t row1 = (Updates_index[0] - 1); - const uint64_t row2 = (Updates_index[1] - 1); - const uint64_t row3 = (Updates_index[2] - 1); - - // Compute C = (S^T)^{-1}U : Dim x 3 - double __attribute__((aligned(8))) C[3 * Dim]; - for (uint64_t i = 0; i < Dim; i++) { - C[i * 3] = 0; - C[i * 3 + 1] = 0; - C[i * 3 + 2] = 0; - IVDEP - ALIGNED - for (uint64_t k = 0; k < LDS; k++) { - C[i * 3] += Slater_inv[i * LDS + k] * Updates[k]; - C[i * 3 + 1] += Slater_inv[i * LDS + k] * Updates[LDS + k]; - C[i * 3 + 2] += Slater_inv[i * LDS + k] * Updates[2 * LDS + k]; - } - } - - // Compute B = 1 + VC : 3 x 3 - const double B0 = C[row1 * 3] + 1; - const double B1 = C[row1 * 3 + 1]; - const double B2 = C[row1 * 3 + 2]; - const double B3 = C[row2 * 3]; - const double B4 = C[row2 * 3 + 1] + 1; - const double B5 = C[row2 * 3 + 2]; - const double B6 = C[row3 * 3]; - const double B7 = C[row3 * 3 + 1]; - const double B8 = C[row3 * 3 + 2] + 1; - - // Check if determinant of B is not too close to zero - double det; - det = B0 * (B4 * B8 - B5 * B7) - B1 * (B3 * B8 - B5 * B6) + - B2 * (B3 * B7 - B4 * B6); - if (fabs(det) < breakdown) { - return QMCKL_FAILURE; - } - - // Update det(Slater) if passed - if (determinant) - *determinant *= det; - - // Compute B^{-1} with explicit formula for 3 x 3 inversion - double __attribute__((aligned(8))) Binv[9], idet = 1.0 / det; - Binv[0] = (B4 * B8 - B7 * B5) * idet; - Binv[1] = -(B1 * B8 - B7 * B2) * idet; - Binv[2] = (B1 * B5 - B4 * B2) * idet; - Binv[3] = -(B3 * B8 - B6 * B5) * idet; - Binv[4] = (B0 * B8 - B6 * B2) * idet; - Binv[5] = -(B0 * B5 - B3 * B2) * idet; - Binv[6] = (B3 * B7 - B6 * B4) * idet; - Binv[7] = -(B0 * B7 - B6 * B1) * idet; - Binv[8] = (B0 * B4 - B3 * B1) * idet; - - // tmp = B^{-1}D : 3 x LDS - double __attribute__((aligned(8))) tmp[3 * LDS]; - double* r1dim = &(Slater_inv[row1 * LDS]); - double* r2dim = &(Slater_inv[row2 * LDS]); - double* r3dim = &(Slater_inv[row3 * LDS]); - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - tmp[j] = Binv[0] * r1dim[j] + Binv[1] * r2dim[j] + Binv[2] * r3dim[j]; - tmp[LDS + j] = - Binv[3] * r1dim[j] + Binv[4] * r2dim[j] + Binv[5] * r3dim[j]; - tmp[2 * LDS + j] = - Binv[6] * r1dim[j] + Binv[7] * r2dim[j] + Binv[8] * r3dim[j]; - } - - // Compute (S^T)^{-1} - C * tmp : Dim x LDS - for (uint64_t i = 0; i < Dim; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - Slater_inv[i * LDS + j] -= C[i * 3] * tmp[j]; - Slater_inv[i * LDS + j] -= C[i * 3 + 1] * tmp[LDS + j]; - Slater_inv[i * LDS + j] -= C[i * 3 + 2] * tmp[2 * LDS + j]; - } - } - - return QMCKL_SUCCESS; -} - #+end_src - - - #+NAME:woodbury_3x3_kernel_template - #+begin_src c -qmckl_exit_code qmckl_woodbury_3x3_{Dim}( - const qmckl_context context, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict determinant) { -/* - C := S^{-1} * U, dim x 3 - B := 1 + V * C, 3 x 3 - D := V * S^{-1}, 3 x dim -,*/ - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_woodbury_3x3_{Dim}", - NULL); - } - - const uint64_t row1 = (Updates_index[0] - 1); - const uint64_t row2 = (Updates_index[1] - 1); - const uint64_t row3 = (Updates_index[2] - 1); - - // Compute C = (S^T)^{-1}U : {Dim} x 3 - double __attribute__((aligned(8))) C[3 * {Dim}]; - for (uint64_t i = 0; i < {Dim}; i++) { - C[i * 3] = 0; - C[i * 3 + 1] = 0; - C[i * 3 + 2] = 0; - IVDEP - ALIGNED - for (uint64_t k = 0; k < D{Dim}_P; k++) { - C[i * 3] += Slater_inv[i * D{Dim}_P + k] * Updates[k]; - C[i * 3 + 1] += Slater_inv[i * D{Dim}_P + k] * Updates[D{Dim}_P + k]; - C[i * 3 + 2] += Slater_inv[i * D{Dim}_P + k] * Updates[2 * D{Dim}_P + k]; - } - } - - // Compute B = 1 + VC : 3 x 3 - const double B0 = C[row1 * 3] + 1; - const double B1 = C[row1 * 3 + 1]; - const double B2 = C[row1 * 3 + 2]; - const double B3 = C[row2 * 3]; - const double B4 = C[row2 * 3 + 1] + 1; - const double B5 = C[row2 * 3 + 2]; - const double B6 = C[row3 * 3]; - const double B7 = C[row3 * 3 + 1]; - const double B8 = C[row3 * 3 + 2] + 1; - - // Check if determinant of B is not too close to zero - double det; - det = B0 * (B4 * B8 - B5 * B7) - B1 * (B3 * B8 - B5 * B6) + - B2 * (B3 * B7 - B4 * B6); - if (fabs(det) < breakdown) { - return QMCKL_FAILURE; - } - - // Update det(Slater) if passed - if (determinant) - *determinant *= det; - - // Compute B^{-1} with explicit formula for 3 x 3 inversion - double __attribute__((aligned(8))) Binv[9], idet = 1.0 / det; - Binv[0] = (B4 * B8 - B7 * B5) * idet; - Binv[1] = -(B1 * B8 - B7 * B2) * idet; - Binv[2] = (B1 * B5 - B4 * B2) * idet; - Binv[3] = -(B3 * B8 - B6 * B5) * idet; - Binv[4] = (B0 * B8 - B6 * B2) * idet; - Binv[5] = -(B0 * B5 - B3 * B2) * idet; - Binv[6] = (B3 * B7 - B6 * B4) * idet; - Binv[7] = -(B0 * B7 - B6 * B1) * idet; - Binv[8] = (B0 * B4 - B3 * B1) * idet; - - // tmp = B^{-1}D : 3 x D{Dim}_P - double __attribute__((aligned(8))) tmp[3 * D{Dim}_P]; - double* r1dim = &(Slater_inv[row1 * D{Dim}_P]); - double* r2dim = &(Slater_inv[row2 * D{Dim}_P]); - double* r3dim = &(Slater_inv[row3 * D{Dim}_P]); - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - tmp[j] = Binv[0] * r1dim[j] + Binv[1] * r2dim[j] + Binv[2] * r3dim[j]; - tmp[D{Dim}_P + j] = - Binv[3] * r1dim[j] + Binv[4] * r2dim[j] + Binv[5] * r3dim[j]; - tmp[2 * D{Dim}_P + j] = - Binv[6] * r1dim[j] + Binv[7] * r2dim[j] + Binv[8] * r3dim[j]; - } - - // Compute (S^T)^{-1} - C * tmp : {Dim} x D{Dim}_P - for (uint64_t i = 0; i < {Dim}; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - Slater_inv[i * D{Dim}_P + j] -= C[i * 3] * tmp[j]; - Slater_inv[i * D{Dim}_P + j] -= C[i * 3 + 1] * tmp[D{Dim}_P + j]; - Slater_inv[i * D{Dim}_P + j] -= C[i * 3 + 2] * tmp[2 * D{Dim}_P + j]; - } - } - - return QMCKL_SUCCESS; -} - #+end_src - - - #+NAME:woodbury_3x3_kernel_generator - #+begin_src python :noweb yes :exports none -text=""" -<> -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) - #+end_src - - - #+NAME:woodbury_3x3_switch-case_generator - #+begin_src python :noweb yes :exports none -text=""" -case {Dim}: - return qmckl_woodbury_3x3_{Dim}(context, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) - #+end_src - - - #+begin_src c :tangle (eval c) :comments org :noweb yes -<> - -qmckl_exit_code qmckl_woodbury_3x3(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_woodbury_3x3", - NULL); - } - - if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases - switch (Dim) { - <> - } - } - else { // When SIMD_LENGTH > 1, called with LDS == Dim AND Dim != (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) - return qmckl_woodbury_3x3_hpc(context, - LDS, - Dim, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); - - } - - return QMCKL_FAILURE; -} - #+end_src - - -*** Performance... - - This function is most efficient when used in cases where there are only 3 rank-1 updates and - it is sure they will not result in a singular matrix. - - ** Fortran interface :noexport: - :PROPERTIES: - :Name: qmckl_woodbury_3x3 - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - #+CALL: generate_f_interface(table=qmckl_woodbury_3x3_args,rettyp=get_value("FRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src f90 :tangle (eval fh_func) :comments org :exports none - interface - integer(c_int32_t) function qmckl_woodbury_3x3 & - (context, LDS, Dim, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - real (c_double ) , intent(in) :: Updates(3*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(3) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(LDS*Dim) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_woodbury_3x3 - end interface - #+end_src - -*** Test :noexport: - - #+begin_src c :tangle (eval c_test) -assert(Updates3 != NULL); -assert(Updates_index3 != NULL); -assert(Slater_inv3_1 != NULL); -det = -1.23743195512859e-09; -rc = qmckl_woodbury_3x3(context, LDS, Dim, Updates3, Updates_index3, breakdown, Slater_inv3_1, &det); -assert(fabs(det - 1.602708950725074e-10) < 1e-15); -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - res[i * Dim + j] = 0; - for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater3[i * Dim + k] * Slater_inv3_1[k * LDS + j]; - } - } -} -rc = QMCKL_SUCCESS; -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { - rc = QMCKL_FAILURE; - } - if (i != j && fabs(res[i * Dim + j]) > tolerance) { - rc = QMCKL_FAILURE; - } - } -} -assert(rc == QMCKL_SUCCESS); - #+end_src - -* Sherman-Morrison with update splitting -** ~qmckl_sherman_morrison_splitting~ - :PROPERTIES: - :Name: qmckl_sherman_morrison_splitting - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - This is a variation on the 'Naive' Sherman-Morrison kernel. Whenever the denominator $1+v_j^T S^{-1} u_j$ in - the Sherman-Morrison formula is deemed to be too close to zero, the update $u_j$ is split in half: - $u_j \rightarrow \frac{1}{2} u_j$. One half is applied immediately --necessarily increasing the value of the - denominator because of the split-- while the other halve is put in a queue that will be applied when all the - remaining updates have been treated. - - The kernel is executed recursively until the queue is eiter empty and all - updates are applied successfully, or the size of the queue equals the number of initial updates. In the last - case the Slater-matrix that would have resulted from applying the updates is singular and therefore the - kernel exits with an exit code. - - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. - - #+NAME: qmckl_sherman_morrison_splitting_args - | qmckl_context | context | in | Global state | - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | uint64_t | N_updates | in | Number of rank-1 updates to be applied to Slater_inv | - | double | Updates[N_updates*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[N_updates] | in | Array containing the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | - | double* | determinant | inout | Determinant of the Slater-matrix | - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. - -*** Requirements - - * ~context~ is not ~QMCKL_NULL_CONTEXT~ - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements - -*** C header - - #+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_splitting( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src - -*** C source - - #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_sherman_morrison_splitting(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_splitting", - NULL); - } - - double __attribute__((aligned(8))) later_updates[LDS * N_updates]; - uint64_t later_index[N_updates]; - uint64_t later = 0; - - qmckl_exit_code rc = qmckl_slagel_splitting( - LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, - later_updates, later_index, &later, determinant); - if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; - - if (later > 0) { - qmckl_exit_code rc = qmckl_sherman_morrison_splitting( - context, LDS, Dim, later, later_updates, later_index, breakdown, - Slater_inv, determinant); - if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; - } - - return QMCKL_SUCCESS; -} - - #+end_src - -*** Performance... - - This kernel performs best when there are 2 or more rank-1 update cycles and fail-rate is high. - -** Fortran interface :noexport: - :PROPERTIES: - :Name: qmckl_sherman_morrison_splitting - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - #+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src f90 :tangle (eval fh_func) :comments org :exports none - interface - integer(c_int32_t) function qmckl_sherman_morrison_splitting & - (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(LDS*Dim) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_sherman_morrison_splitting - end interface - #+end_src - -*** Test :noexport: - - #+begin_src c :tangle (eval c_test) -assert(Updates3 != NULL); -assert(Updates_index3 != NULL); -assert(Slater_inv3_2 != NULL); -det = -1.23743195512859e-09; -rc = qmckl_sherman_morrison_splitting(context, LDS, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2, &det); -assert(fabs(det - 1.602708950725074e-10) < 1e-15); -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - res[i * Dim + j] = 0; - for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater3[i * Dim + k] * Slater_inv3_2[k * LDS + j]; - } - } -} -rc = QMCKL_SUCCESS; -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { - rc = QMCKL_FAILURE; - } - if (i != j && fabs(res[i * Dim + j]) > tolerance) { - rc = QMCKL_FAILURE; - } - } -} -assert(rc == QMCKL_SUCCESS); - #+end_src - -* Woodbury 3x3 and 2x2 with Sherman-Morrison and update splitting - ** ~qmckl_sherman_morrison_smw32s~ - :PROPERTIES: - :Name: qmckl_sherman_morrison_smw32s - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - The Woodbury 3x3 and 2x2 kernel with Sherman-Morrison and update splitting combines the low-level Woodbury 3x3 kernel, - the Woobury 2x2 kernel and Sherman-Morrison with update splitting. It works the almost the same as Woodbury 3x3 with - Sherman-Morrison and update splitting, except that when there is a remainder of two rank-1 updates, it is first tried - with Woodbury 2x2 instead of sending them all to Sherman-Morrison with update splitting. For example, in the case of - 5 updates the updates are applied in 1 block of 3 updates end 1 block of 2 updates. - - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. - - #+NAME: qmckl_sherman_morrison_smw32s_args - | qmckl_context | context | in | Global state | - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | uint64_t | N_updates | in | Number of rank-1 updates to be applied to Slater_inv | - | double | Updates[N_updates*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[N_updates] | in | Array containing the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse of a Slater-matrix | - | double* | determinant | inout | Determinant of the Slater-matrix | - - -*** Requirements - - * ~context~ is not ~QMCKL_NULL_CONTEXT~ - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements - -*** C header - - #+CALL: generate_c_header(table=qmckl_sherman_morrison_smw32s_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_sherman_morrison_smw32s( - const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant); - #+end_src - -*** C source - - #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_sherman_morrison_smw32s(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { - - if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_smw32s", - NULL); - } - - double __attribute__((aligned(8))) later_updates[LDS * N_updates]; - uint64_t later_index[N_updates]; - uint64_t later = 0; - - // Special case for 4 rank-1 updates: 2+2 - if (N_updates == 4) { - qmckl_exit_code rc = - qmckl_woodbury_2x2(context, LDS, Dim, Updates, Updates_index, - breakdown, Slater_inv, determinant); - if (rc != QMCKL_SUCCESS) { // Send the entire block to slagel_splitting - uint64_t l = 0; - rc = qmckl_slagel_splitting(LDS, Dim, 2, Updates, Updates_index, - breakdown, Slater_inv, - later_updates + (LDS * later), - later_index + later, &l, determinant); - later += l; - } - rc = qmckl_woodbury_2x2(context, LDS, Dim, &Updates[2 * LDS], - &Updates_index[2], breakdown, Slater_inv, - determinant); - if (rc != QMCKL_SUCCESS) { // Send the entire block to slagel_splitting - uint64_t l = 0; - rc = qmckl_slagel_splitting( - LDS, Dim, 2, &Updates[2 * LDS], &Updates_index[2], breakdown, - Slater_inv, later_updates + (LDS * later), later_index + later, - &l, determinant); - later += l; - } - if (later > 0) { - rc = qmckl_sherman_morrison_splitting( - context, LDS, Dim, later, later_updates, later_index, breakdown, - Slater_inv, determinant); - } - return QMCKL_SUCCESS; - } - - // And for the other cases != 4 - // Apply first 3*n_of_3blocks updates in n_of_3blocks blocks of 3 updates - // with Woodbury 3x3 kernel - uint64_t n_of_3blocks = N_updates / 3; - uint64_t remainder = N_updates % 3; - uint64_t length_3block = 3 * LDS; - - if (n_of_3blocks > 0) { - for (uint64_t i = 0; i < n_of_3blocks; i++) { - const double* Updates_3block = &Updates[i * length_3block]; - const uint64_t* Updates_index_3block = &Updates_index[i * 3]; - qmckl_exit_code rc = qmckl_woodbury_3x3( - context, LDS, Dim, Updates_3block, Updates_index_3block, - breakdown, Slater_inv, determinant); - if (rc != QMCKL_SUCCESS) { // Send the entire block to slagel_splitting - uint64_t l = 0; - rc = qmckl_slagel_splitting( - LDS, Dim, 3, Updates_3block, Updates_index_3block, - breakdown, Slater_inv, later_updates + (LDS * later), - later_index + later, &l, determinant); - later += l; - } - } - } - - // Apply last remaining block of 2 updates with Woodbury 2x2 kernel - if (remainder == 2) { - const double* Updates_2block = &Updates[n_of_3blocks * length_3block]; - const uint64_t* Updates_index_2block = &Updates_index[3 * n_of_3blocks]; - qmckl_exit_code rc = qmckl_woodbury_2x2( - context, LDS, Dim, Updates_2block, Updates_index_2block, - breakdown, Slater_inv, determinant); - if (rc != QMCKL_SUCCESS) { // Send the entire block to slagel_splitting - uint64_t l = 0; - rc = qmckl_slagel_splitting( - LDS, Dim, 2, Updates_2block, Updates_index_2block, breakdown, - Slater_inv, later_updates + (LDS * later), later_index + later, - &l, determinant); - later += l; - } - } - - // Apply last remaining update with slagel_splitting - if (remainder == 1) { - const double* Updates_1block = &Updates[n_of_3blocks * length_3block]; - const uint64_t* Updates_index_1block = &Updates_index[3 * n_of_3blocks]; - uint64_t l = 0; - qmckl_exit_code rc = qmckl_slagel_splitting( - LDS, Dim, 1, Updates_1block, Updates_index_1block, breakdown, - Slater_inv, later_updates + (LDS * later), later_index + later, &l, - determinant); - if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; - later += l; - } - - if (later > 0) { - qmckl_exit_code rc = qmckl_sherman_morrison_splitting( - context, LDS, Dim, later, later_updates, later_index, breakdown, - Slater_inv, determinant); - if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; - } - - return QMCKL_SUCCESS; -} - - #+end_src - -*** Performance... - - This kernel performs best for update cycles with 2 or more rank-1 updates and the fail-rate is low. - - ** Fortran interface :noexport: - :PROPERTIES: - :Name: qmckl_sherman_morrison_smw32s - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - #+CALL: generate_f_interface(table=qmckl_sherman_morrison_smw32s_args,rettyp=get_value("FRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src f90 :tangle (eval fh_func) :comments org :exports none - interface - integer(c_int32_t) function qmckl_sherman_morrison_smw32s & - (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*Dim) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(LDS*Dim) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_sherman_morrison_smw32s - end interface - #+end_src - -*** Test :noexport: - - #+begin_src c :tangle (eval c_test) -assert(Updates5 != NULL); -assert(Updates_index5 != NULL); -assert(Slater_inv5 != NULL); -det = -3.186005284713128e-10; -rc = qmckl_sherman_morrison_smw32s(context, LDS, Dim, N_updates5, Updates5, Updates_index5, breakdown, Slater_inv5, &det); -assert(fabs(det + 5.260200118412903e-10) < 1e-15); - -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - res[i * Dim + j] = 0; - for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater5[i * Dim + k] * Slater_inv5[k * LDS + j]; - } - } -} -rc = QMCKL_SUCCESS; -for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { - rc = QMCKL_FAILURE; - } - if (i != j && fabs(res[i * Dim + j]) > tolerance) { - rc = QMCKL_FAILURE; - } - } -} -assert(rc == QMCKL_SUCCESS); - #+end_src - -* Helper Functions - -Private helper-functions that are used by the Sherman-Morrison-Woodbury kernels. -These functions can only be used internally by the kernels in this module. - -** ~qmckl_slagel_splitting~ - :PROPERTIES: - :Name: qmckl_slagel_splitting - :CRetType: double - :FRetType: double precision - :END: - - ~qmckl_slagel_splitting~ is the non-recursive, inner part of the 'Sherman-Morrison with update splitting'-kernel. - It is used internally to apply a collection of $N$ rank-1 updates to the inverse Slater-matrix $S^{-1}$ and - splitting an update in two equal pieces if necessary. In case of a split, it applies the first half of the update, - while putting the second half in a waiting queue to be applied at the end. - - Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, the update is applied as usual. Otherwise, $u_j$ will be redefined - as $\frac{1}{2}u_j$. One half is applied immediately, the other half will be applied at the end of the algorithm, using vectors - $u_{j'}=\frac{1}{2}u_j$ and $v_{j'}^T=v_{j}^T$, which are stored in the array \texttt{later_updates}. - - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. - - #+NAME: qmckl_slagel_splitting_args - | uint64_t | LDS | in | Leading dimension of Slater_inv | - | uint64_t | Dim | in | Dimension of Slater_inv | - | uint64_t | N_updates | in | Number of rank-1 updates to be applied to Slater_inv | - | double | Updates[N_updates*Dim] | in | Array containing the rank-1 updates | - | uint64_t | Updates_index[N_updates] | in | Array containing positions of the rank-1 updates | - | double | breakdown | in | Break-down parameter on which to fail or not | - | double | Slater_inv[LDS*Dim] | inout | Array containing the inverse Slater-matrix | - | double | later_updates[Dim * N_updates] | inout | Array containing the split updates for later | - | uint64_t | later_index[N_updates] | inout | Array containing the positions of the split updates for later | - | uint64_t | later | inout | Number of split updates for later | - | double* | determinant | inout | Determinant of the Slater-matrix | - - -*** Requirements - - - ~LDS >= 2~ - - ~Dim >= 2~ - - ~N_updates >= 1~ - - ~Updates~ is allocated with $N_updates \times Dim$ elements - - ~Updates_index~ is allocated with $N_updates$ elements - - ~breakdown~ is a small number such that $0 < breakdown << 1$ - - ~Slater_inv~ is allocated with $Dim \times Dim$ elements - - ~later_updates~ is allocated with $later \times Dim$ elements - - ~later_index~ is allocated with $N_updates$ elements - - ~later >= 0~ - -*** C header - - #+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - - #+RESULTS: - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code qmckl_slagel_splitting ( - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* later_updates, - uint64_t* later_index, - uint64_t* later, - double* determinant); - #+end_src - -*** C source - - #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_slagel_splitting_hpc( - uint64_t LDS, - uint64_t Dim, - uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict later_updates, - uint64_t* __restrict later_index, - uint64_t* __restrict later, - double* __restrict determinant) { - - double __attribute__((aligned(8))) C[LDS]; - double __attribute__((aligned(8))) D[LDS]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = S^{-1} x U_l - for (uint64_t i = 0; i < Dim; i++) { - C[i] = 0.0f; - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; - } - } - - // Denominator - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; - if (fabs(den) < breakdown) { - // U_l = U_l / 2: split the update in 2 equal halves and save the - // second halve in later_updates - IVDEP - ALIGNED - for (uint64_t i = 0; i < LDS; i++) { - later_updates[*later * LDS + i] = Updates[l * LDS + i] * 0.5f; - C[i] *= 0.5f; - } - later_index[*later] = Updates_index[l]; - (*later)++; - - den = 1.0f + C[cui]; - } // From here onwards we continue with applying the first halve of the - // update to Slater_inv - double iden = 1.0f / den; - - if (determinant) - *determinant *= den; - - // D = v^T x S^{-1} : 1 x LDS - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - D[j] = Slater_inv[cui * LDS + j]; - } - - // S^{-1} = S^{-1} - C x D / den - for (uint64_t i = 0; i < Dim; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - const double update = C[i] * D[j] * iden; - Slater_inv[i * LDS + j] -= update; - } - } - l += 1; - } - - return QMCKL_SUCCESS; -} - #+end_src - - - #+NAME:slagel_splitting_template_code - #+begin_src c -static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( - uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict later_updates, - uint64_t* __restrict later_index, - uint64_t* __restrict later, - double* __restrict determinant) { - - double __attribute__((aligned(8))) C[D{Dim}_P]; - double __attribute__((aligned(8))) D[D{Dim}_P]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = S^{-1} x U_l - for (uint64_t i = 0; i < {Dim}; i++) { - C[i] = 0.0f; - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; - } - } - - // Denominator - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; - if (fabs(den) < breakdown) { - // U_l = U_l / 2: split the update in 2 equal halves and save the - // second halve in later_updates - IVDEP - ALIGNED - for (uint64_t i = 0; i < D{Dim}_P; i++) { - later_updates[*later * D{Dim}_P + i] = Updates[l * D{Dim}_P + i] * 0.5f; - C[i] *= 0.5f; - } - later_index[*later] = Updates_index[l]; - (*later)++; - - den = 1.0f + C[cui]; - } // From here onwards we continue with applying the first halve of the - // update to Slater_inv - double iden = 1.0f / den; - - if (determinant) - *determinant *= den; - - // D = v^T x S^{-1} : 1 x D{Dim}_P - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - D[j] = Slater_inv[cui * D{Dim}_P + j]; - } - - // S^{-1} = S^{-1} - C x D / den - for (uint64_t i = 0; i < {Dim}; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - const double update = C[i] * D[j] * iden; - Slater_inv[i * D{Dim}_P + j] -= update; - } - } - l += 1; - } - - return QMCKL_SUCCESS; -} - #+end_src - - - #+NAME:slagel_splitting_kernel_generator - #+begin_src python :noweb yes :exports none -text=""" -<> -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) - #+end_src - - - #+NAME:slagel_splitting_switch-case_generator - #+begin_src python :noweb yes :exports none -text=""" -case {Dim}: - return qmckl_slagel_splitting_{Dim}( - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - later_updates, - later_index, - later, - determinant); -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) - #+end_src - - - #+begin_src c :tangle (eval c) :comments org :noweb yes -<> - -qmckl_exit_code qmckl_slagel_splitting( - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* later_updates, - uint64_t* later_index, - uint64_t* later, - double* determinant) { - - if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases - switch (Dim) { - <> - } - } - else { // When SIMD_LENGTH > 1, called with LDS == Dim AND Dim != (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) - return qmckl_slagel_splitting_hpc( - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - later_updates, - later_index, - later, - determinant); - } - - return QMCKL_FAILURE; -} - #+end_src - - -*** Performance - -This function cannot be used by itself and is used in Sherman-Morrison with update splitting and Woodbury 3x3 and 2x2 -with Sherman-Morrison and update splitting. Please look at the performance reccomendations for those two kernels. * End of files From 6ad4aabdfa6d70df61342e84c0f88a10db529f0d Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Fri, 10 Feb 2023 17:16:08 +0100 Subject: [PATCH 06/30] Still working --- org/qmckl_sherman_morrison_woodbury.org | 80 ++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 7d2b32d..dbe1880 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -33,39 +33,39 @@ range(2, 22) * Naïve Sherman-Morrison - :PROPERTIES: - :Name: qmckl_sherman_morrison_naive - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: - - This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in - the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to - zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. +:PROPERTIES: +:Name: qmckl_sherman_morrison_naive +:CRetType: qmckl_exit_code +:FRetType: qmckl_exit_code +:END: - The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is - \[ - (S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u} - \] +This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in +the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to +zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. - where - $S$ is the Slater-matrix, - $u$ and $v^T$ are the column and row vectors containing the updates, - $S^{-1}$ is the inverse of the Slater-matrix. +The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is +\[ +(S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u} +\] - Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying - updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse - matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to - evaluate each individual update $u_j$ when it is applied. +where +$S$ is the Slater-matrix, +$u$ and $v^T$ are the column and row vectors containing the updates, +$S^{-1}$ is the inverse of the Slater-matrix. - This value sets the lower bound for which the - denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular matrix - $S$, or at least in an inverse of $S$ of very poor numerical quality. Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, - the update is applied as usual and the kernel exits with return code \texttt{QMCKL_SUCCESS}. - If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits with return code \texttt{QMCKL_FAILURE}. +Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying +updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse +matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to +evaluate each individual update $u_j$ when it is applied. - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. +This value sets the lower bound for which the +denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular matrix +$S$, or at least in an inverse of $S$ of very poor numerical quality. Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, +the update is applied as usual and the kernel exits with return code \texttt{QMCKL_SUCCESS}. +If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits with return code \texttt{QMCKL_FAILURE}. + +If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting +from applying the updates to the original matrix. #+NAME: qmckl_sherman_morrison_naive_args | Variable | Type | In/Out | Description | @@ -149,15 +149,15 @@ end function qmckl_sherman_morrison_naive_doc ** Requirements - * ~context~ is not ~QMCKL_NULL_CONTEXT~ - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements - * ~determinant > 0~ + * ~context~ is not ~QMCKL_NULL_CONTEXT~ + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~determinant > 0~ ** C headers (exposed in qmckl.h) @@ -612,9 +612,9 @@ end interface * End of files - #+begin_src c :comments link :tangle (eval c_test) - assert (qmckl_context_destroy(context) == QMCKL_SUCCESS); - return 0; +#+begin_src c :comments link :tangle (eval c_test) +assert (qmckl_context_destroy(context) == QMCKL_SUCCESS); +return 0; } #+end_src From c0d4f766b176e78b110991824be135e1f98daf83 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 13 Feb 2023 15:08:37 +0100 Subject: [PATCH 07/30] Reorganising ORG file. --- org/qmckl_sherman_morrison_woodbury.org | 102 ++++++++++++------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index dbe1880..2bab526 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -465,7 +465,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, } #+end_src -** Fortran interface +** Fortran interfaces (exposed in qmckl_f.F90) :PROPERTIES: :Name: qmckl_sherman_morrison_naive :CRetType: qmckl_exit_code @@ -550,64 +550,64 @@ interface end interface #+end_src -** Test - The tests for the kernels are executed on datasets that are extracted from a run of - QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. - The tests are run such that the kernels reject the computed inverse whenever the computed - intermediate determinants or denominators are smaller than 1e-3. This is the default value in - QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix - $R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return - QMCKL_FAILURE if the values are larger than this tolerance value. +** Tests +The tests for the kernels are executed on datasets that are extracted from a run of +QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. +The tests are run such that the kernels reject the computed inverse whenever the computed +intermediate determinants or denominators are smaller than 1e-3. This is the default value in +QMC=Chem. The tests will return QMCKL_SUCCESS whenever all the elements of the final matrix +$R=S.S^-1 - 1$ are smaller than the given tolerance value of 1e-3, and will return +QMCKL_FAILURE if the values are larger than this tolerance value. - #+begin_src c :tangle (eval c_test) - const uint64_t Dim = 21; - const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH; - const double breakdown = 1e-3; - const double tolerance = 1e-3; - double res[441]; +#+begin_src c :tangle (eval c_test) +const uint64_t Dim = 21; +const uint64_t LDS = (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH; +const double breakdown = 1e-3; +const double tolerance = 1e-3; +double res[441]; - #include "sm_test.h" +#include "sm_test.h" - assert(Updates1 != NULL); - assert(Updates_index1 != NULL); - assert(Slater_inv1 != NULL); +assert(Updates1 != NULL); +assert(Updates_index1 != NULL); +assert(Slater_inv1 != NULL); - // original determinant of Slater1 (before applying updates) - double det = 3.407025646103221e-10; - rc = qmckl_sherman_morrison_naive(context, - LDS, - Dim, - N_updates1, - Updates1, - Updates_index1, - breakdown, - Slater_inv1, - &det); +// original determinant of Slater1 (before applying updates) +double det = 3.407025646103221e-10; +rc = qmckl_sherman_morrison_naive(context, + LDS, + Dim, + N_updates1, + Updates1, + Updates_index1, + breakdown, + Slater_inv1, + &det); - // Check that the determinant is updated properly - assert(fabs(det + 4.120398385068217e-10) < 1e-15); +// Check that the determinant is updated properly +assert(fabs(det + 4.120398385068217e-10) < 1e-15); - for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - res[i * Dim + j] = 0; - for (unsigned int k = 0; k < Dim; k++) { - res[i * Dim + j] += Slater1[i * Dim + k] * Slater_inv1[k * LDS + j]; - } - } +for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + res[i * Dim + j] = 0; + for (unsigned int k = 0; k < Dim; k++) { + res[i * Dim + j] += Slater1[i * Dim + k] * Slater_inv1[k * LDS + j]; } - rc = QMCKL_SUCCESS; - for (unsigned int i = 0; i < Dim; i++) { - for (unsigned int j = 0; j < Dim; j++) { - if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { - rc = QMCKL_FAILURE; - } - if (i != j && fabs(res[i * Dim + j]) > tolerance) { - rc = QMCKL_FAILURE; - } - } + } +} +rc = QMCKL_SUCCESS; +for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { + rc = QMCKL_FAILURE; } - assert(rc == QMCKL_SUCCESS); - #+end_src + if (i != j && fabs(res[i * Dim + j]) > tolerance) { + rc = QMCKL_FAILURE; + } + } +} +assert(rc == QMCKL_SUCCESS); +#+end_src * End of files From 707fa17e09ff05e38dc97a0b07792585ced09177 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 13 Feb 2023 17:44:11 +0100 Subject: [PATCH 08/30] Adding documentation to ORG file. --- org/qmckl_sherman_morrison_woodbury.org | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 2bab526..525c114 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -81,6 +81,9 @@ from applying the updates to the original matrix. | ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | ** Pedagogical kernel source (in Fortran) +The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is +able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore +not be used in real workloads. #+begin_src f90 :tangle (eval f) integer function qmckl_sherman_morrison_naive_doc_f(context, & @@ -118,6 +121,8 @@ end function qmckl_sherman_morrison_naive_doc_f #+end_src *** C interface to the pedagogical kernel +The following interface block in Fortran makes sure that the pedagogical kernel, +written in Fortran, can be called from C using the ~ISO_C_BINDING~. #+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") @@ -210,7 +215,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_doc ( #+end_src ** C sources - +Common includes and macros used by all the Sherman-Morrison-Woodbury kernels. #+begin_src c :tangle (eval c) :comments org #include #include @@ -235,6 +240,15 @@ qmckl_exit_code qmckl_sherman_morrison_naive_doc ( #endif #+end_src +~qmckl_sherman_morrison_naive_hpc~ is a high performance variation of +~qmckl_sherman_morrison_naive~ written in C. It is used in cases when ~Dim~ is +smaller than the leading dimension ~LDS~, irrespective of whetether ~LDS~ +includes zero padding to benefit from SIMD instructions or not. Cases like this +include situations where one wants to apply updates to a square submatrix of the +full matrix. +It takes advantage of memory aligned data and assumes no data dependencies +inside the loops. The loops are fully vectorised whenever ~Dim~ is an integer +multiple of ~SIMD_LEGTH~. #+begin_src c :tangle (eval c) :comments org qmckl_exit_code qmckl_sherman_morrison_naive_hpc( const qmckl_context context, @@ -265,7 +279,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( C[i] = 0.0f; IVDEP ALIGNED - for (uint64_t j = 0; j < LDS; j++) { + for (uint64_t j = 0; j < Dim; j++) { C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; } } @@ -286,7 +300,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( // selecting column: v_l^T * S_inv IVDEP ALIGNED - for (uint64_t j = 0; j < LDS; j++) { + for (uint64_t j = 0; j < Dim; j++) { D[j] = Slater_inv[cui * LDS + j]; } @@ -294,7 +308,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( for (uint64_t i = 0; i < Dim; i++) { IVDEP ALIGNED - for (uint64_t j = 0; j < LDS; j++) { + for (uint64_t j = 0; j < Dim; j++) { const double update = C[i] * D[j] * iden; Slater_inv[i * LDS + j] -= update; } From 3482c832ac7c812e1545214c25e6e2281697d65c Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 13 Feb 2023 17:48:31 +0100 Subject: [PATCH 09/30] Adding documentation to ORG file. --- org/qmckl_sherman_morrison_woodbury.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 525c114..70d8bb0 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -127,7 +127,7 @@ written in Fortran, can be called from C using the ~ISO_C_BINDING~. #+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") #+RESULTS: -#+begin_src f90 :tangle (eval f) :comments org :exports none +#+begin_src f90 :tangle (eval f) :comments org integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) result(info) From 42f4556fa3f0ab0d7162cdb0f9d676a9ca9717c3 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 13 Feb 2023 17:49:18 +0100 Subject: [PATCH 10/30] Adding documentation to ORG file. --- org/qmckl_sherman_morrison_woodbury.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 70d8bb0..e78c68f 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -127,7 +127,7 @@ written in Fortran, can be called from C using the ~ISO_C_BINDING~. #+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") #+RESULTS: -#+begin_src f90 :tangle (eval f) :comments org +#+begin_src f90 :tangle (eval f) integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) result(info) From 87d6acb49abda6c217c354943a0135f902c02275 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 13 Feb 2023 17:50:20 +0100 Subject: [PATCH 11/30] Adding documentation to ORG file. --- org/qmckl_sherman_morrison_woodbury.org | 1 - 1 file changed, 1 deletion(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index e78c68f..858da0f 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -126,7 +126,6 @@ written in Fortran, can be called from C using the ~ISO_C_BINDING~. #+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") -#+RESULTS: #+begin_src f90 :tangle (eval f) integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & From eb8d8bf34e23f5958d517eaa4e75af2fbfd5a57c Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 14 Feb 2023 11:04:04 +0100 Subject: [PATCH 12/30] bash -> sh --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 018116f..a7923f2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh export srcdir="." python3 ${srcdir}/tools/build_makefile.py From 13f208165c94a08deb2cbc5803c9d83afc0979be Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 14 Feb 2023 11:18:51 +0100 Subject: [PATCH 13/30] Use encoding in open Python's open is locale dependent, LC_ALL=C may open it in ascii mode and fail --- tools/build_makefile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build_makefile.py b/tools/build_makefile.py index 11ec684..6a62254 100755 --- a/tools/build_makefile.py +++ b/tools/build_makefile.py @@ -73,7 +73,7 @@ def main(): TEXT[org] = text HTML[org] = html - grep = open(org, "r").read() + grep = open(org, "r", encoding="utf-8").read() if "(eval c)" in grep: C_FILES += [c] From c07553480cd96cdf80b8fce771780082ea1cbb39 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Wed, 15 Feb 2023 11:46:48 +0100 Subject: [PATCH 14/30] Pedagogical Naive kernel works. --- org/qmckl_sherman_morrison_woodbury.org | 139 +++++++++++++++++++++--- 1 file changed, 122 insertions(+), 17 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 858da0f..b81128b 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -26,6 +26,7 @@ int main() { qmckl_exit_code rc; #+end_src +This is the range that determines the how many high performance kernel instantces will be generated, using the C-function templates defined in the sections below. If the name of the C-function template is called ~qmckl_kernel_{Dim}~, then ~range(K, L+1)~ will results in kernel instances from ~qmckl_kernel_K~ to ~qmckl_kernel_L~. #+NAME:kernel_generator_range #+begin_src python :noweb yes :exports none range(2, 22) @@ -43,6 +44,10 @@ This is the simplest of the available Sherman-Morrison-Woodbury kernels. It appl the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. +#+TODO +Change the math notation so that the update vectors appear as row in the math +so that it is consistent with the representation in C (memory) + The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is \[ (S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u} @@ -85,48 +90,143 @@ The following source code written in Fortran is inteded to illustrate how the ke able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore not be used in real workloads. +#+begin_src f90 :tangle (eval f) :comment org :export none +subroutine convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) + implicit none + integer*8 , intent(in) :: lds, dim, nupdates + real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: s_inv(dim * lds) + real*8 , intent(out) , dimension(lds, nupdates) :: Updates + real*8 , intent(out) , dimension(dim, lds) :: Inverse + + integer*8 :: i, j + + ! Construct Updates: lds x nupdates + do i = 1, nupdates + do j = 1, lds + Updates(j, i) = upds((i - 1) * lds + j) + end do + end do + + ! Construct Inverse: dim x lds + do i = 1, dim + do j = 1, lds + Inverse(i, j) = s_inv((i - 1) * lds + j) + end do + end do +end subroutine convert +#+end_src + +#+begin_src f90 :tangle (eval f) :comment org :export none +subroutine copy_back(Inverse, s_inv, lds, dim) + implicit none + integer*8 , intent(in) :: lds, dim + real*8 , intent(in) , dimension(dim, lds) :: Inverse + real*8 , intent(out) :: s_inv(dim * lds) + + integer*8 :: i, j + + ! Copy updated inverse back to s_inv + do i = 1, dim + do j = 1, lds + s_inv((i - 1) * lds + j) = Inverse(i, j) + end do + end do +end subroutine copy_back +#+end_src + #+begin_src f90 :tangle (eval f) integer function qmckl_sherman_morrison_naive_doc_f(context, & - LDS, Dim, & - N_updates, & - Updates, & - Updates_index, & + lds, dim, & + nupdates, & + upds, & + updates_index, & breakdown, & - Slater_inv, & + s_inv, & determinant) result(info) use qmckl implicit none integer*8 , intent(in) :: context - integer*8 , intent(in) :: LDS, Dim - integer*8 , intent(in) :: N_updates - integer*8 , intent(in) :: Updates_index(N_updates) - real*8 , intent(in) :: Updates(N_updates*LDS) + integer*8 , intent(in) :: lds, dim + integer*8 , intent(in) :: nupdates + integer*8 , intent(in) :: updates_index(nupdates) + real*8 , intent(in) :: upds(nupdates * lds) real*8 , intent(in) :: breakdown - real*8 , intent(inout) :: Slater_inv(Dim*LDS) + real*8 , intent(inout) :: s_inv(dim * lds) real*8 , intent(inout) :: determinant - info = 0 + real*8 , dimension(lds, nupdates) :: Updates + real*8 , dimension(dim, lds) :: Inverse + real*8 , dimension(dim) :: C + real*8 , dimension(lds) :: D + real*8 :: denominator, idenominator, update + integer*8 :: i, j, l, row + + info = QMCKL_FAILURE if (context == QMCKL_NULL_CONTEXT) then info = QMCKL_INVALID_CONTEXT return endif - write(*,*) "Function 'qmckl_sherman_morrison_naive_doc_f' does nothing for now..." + call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) + + l = 1; + ! For each update do... + do while (l < nupdates + 1) + + ! Compute C = S^{-1}U(l) + do i = 1, dim + C(i) = 0 + do j = 1, dim + C(i) = C(i) + Inverse(i, j) * Updates(j, l) + end do + end do + + ! Compute denominator = 1 + V(l)^TC + row = updates_index(l) + denominator = 1 + C(row) + + ! Return early if denominator is too small + if (abs(denominator) < breakdown) return + idenominator = 1 / denominator + + ! Update det(S) + determinant = determinant * denominator + + ! selecting column: v_l^T * S_inv + D = Inverse(row, :) + + ! A^{-1} = A^{-1} - C x D / denominator + do i = 1, dim + do j = 1, dim + update = C(i) * D(j) * idenominator + Inverse(i, j) = Inverse(i, j) - update + end do + end do + + l = l + 1 + end do + + ! Copy updated inverse back to s_inv + call copy_back(Inverse, s_inv, lds, dim) info = QMCKL_SUCCESS end function qmckl_sherman_morrison_naive_doc_f #+end_src -*** C interface to the pedagogical kernel -The following interface block in Fortran makes sure that the pedagogical kernel, -written in Fortran, can be called from C using the ~ISO_C_BINDING~. +*** C interface to the pedagogical kernel (not directly exposed) +The following Fortran function ~qmckl_sherman_morrison_naive_doc~ makes sure +that the pedagogical kernel ~qmckl_sherman_morrison_naive_doc_f~, written in +Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function ~qmckl_sherman_morrison_naive_doc~ will be exposed in the header file 'qmckl.h' +for C users and in the module file 'qmckl_f.F90' for Fortran users. #+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") -#+begin_src f90 :tangle (eval f) +#+RESULTS: +#+begin_src f90 :tangle (eval f) :comments org :exports none integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) result(info) @@ -151,6 +251,7 @@ integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & end function qmckl_sherman_morrison_naive_doc #+end_src + ** Requirements * ~context~ is not ~QMCKL_NULL_CONTEXT~ @@ -318,6 +419,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( } #+end_src +~qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}~ is a C function-template that is used to genereate instances of C fucntions based on the range given above. The advantage of this method is that for each of these instances all the dimensions and loop-bounds are known at compile time, allowing the compiler to optimize more aggressively. #+NAME:naive_template_code #+begin_src c static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}( @@ -391,6 +493,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( } #+end_src +This is the kernel generator written in Python. It uses the kernel generator range and templates defined above to generate the C kernel instances. #+NAME:naive_kernel_generator #+begin_src python :noweb yes :exports none text=""" @@ -404,6 +507,7 @@ for Dim in <>: return '\n'.join(result) #+end_src +Python script that generated C switch cases that call individual kernel instances. #+NAME:naive_switch-case_generator #+begin_src python :noweb yes :exports none text=""" @@ -419,11 +523,12 @@ case {Dim}: result = [] for Dim in <>: Dim=str(Dim) -result.append(text.replace("{Dim}",Dim) ) + result.append(text.replace("{Dim}",Dim) ) return '\n'.join(result) #+end_src +~qmckl_sherman_morrison_naive~ is the general function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~. #+begin_src c :tangle (eval c) :comments org :noweb yes <> From 54a51b6eccf6d1ba17e503bceb466dace3539057 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Wed, 15 Feb 2023 18:41:53 +0100 Subject: [PATCH 15/30] Added Slagel splitting back + pedagogical skeleton function and interface. --- org/qmckl_sherman_morrison_woodbury.org | 449 +++++++++++++++++++++++- 1 file changed, 436 insertions(+), 13 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index b81128b..cd226d1 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -34,12 +34,14 @@ range(2, 22) * Naïve Sherman-Morrison +** ~qmckl_sherman_morrison_naive~ :PROPERTIES: :Name: qmckl_sherman_morrison_naive :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: +*** Introduction This is the simplest of the available Sherman-Morrison-Woodbury kernels. It applies rank-1 updates one by one in the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero. @@ -72,6 +74,7 @@ If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting from applying the updates to the original matrix. +*** API #+NAME: qmckl_sherman_morrison_naive_args | Variable | Type | In/Out | Description | |-----------------+-------------------------+--------+------------------------------------------------------| @@ -85,12 +88,12 @@ from applying the updates to the original matrix. | ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse of a Slater-matrix | | ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | -** Pedagogical kernel source (in Fortran) +*** Pedagogical kernel source (in Fortran) The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore not be used in real workloads. -#+begin_src f90 :tangle (eval f) :comment org :export none +#+begin_src f90 :tangle (eval f) :comment org :exports none subroutine convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) implicit none integer*8 , intent(in) :: lds, dim, nupdates @@ -117,7 +120,7 @@ subroutine convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) end subroutine convert #+end_src -#+begin_src f90 :tangle (eval f) :comment org :export none +#+begin_src f90 :tangle (eval f) :comment org :exports none subroutine copy_back(Inverse, s_inv, lds, dim) implicit none integer*8 , intent(in) :: lds, dim @@ -170,6 +173,8 @@ integer function qmckl_sherman_morrison_naive_doc_f(context, & return endif + ! Convert 'upds' and 's_inv' into the more easily readable Fortran + ! matrices 'Updates' and 'Inverse'. call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) l = 1; @@ -217,7 +222,7 @@ integer function qmckl_sherman_morrison_naive_doc_f(context, & end function qmckl_sherman_morrison_naive_doc_f #+end_src -*** C interface to the pedagogical kernel (not directly exposed) +**** C interface to the pedagogical kernel (not directly exposed) The following Fortran function ~qmckl_sherman_morrison_naive_doc~ makes sure that the pedagogical kernel ~qmckl_sherman_morrison_naive_doc_f~, written in Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function ~qmckl_sherman_morrison_naive_doc~ will be exposed in the header file 'qmckl.h' @@ -251,8 +256,7 @@ integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & end function qmckl_sherman_morrison_naive_doc #+end_src - -** Requirements +*** Requirements * ~context~ is not ~QMCKL_NULL_CONTEXT~ * ~LDS >= 2~ @@ -264,7 +268,7 @@ end function qmckl_sherman_morrison_naive_doc * ~Slater_inv~ is allocated with $Dim \times Dim$ elements * ~determinant > 0~ -** C headers (exposed in qmckl.h) +*** C headers (exposed in qmckl.h) #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) @@ -314,7 +318,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_doc ( double* determinant ); #+end_src -** C sources +*** C sources Common includes and macros used by all the Sherman-Morrison-Woodbury kernels. #+begin_src c :tangle (eval c) :comments org #include @@ -495,7 +499,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( This is the kernel generator written in Python. It uses the kernel generator range and templates defined above to generate the C kernel instances. #+NAME:naive_kernel_generator -#+begin_src python :noweb yes :exports none +#+begin_src python :noweb yes text=""" <> """ @@ -509,7 +513,7 @@ return '\n'.join(result) Python script that generated C switch cases that call individual kernel instances. #+NAME:naive_switch-case_generator -#+begin_src python :noweb yes :exports none +#+begin_src python :noweb yes text=""" case {Dim}: return qmckl_sherman_morrison_naive_{Dim}(context, @@ -528,10 +532,12 @@ for Dim in <>: return '\n'.join(result) #+end_src -~qmckl_sherman_morrison_naive~ is the general function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~. #+begin_src c :tangle (eval c) :comments org :noweb yes <> +#+end_src +~qmckl_sherman_morrison_naive~ is a generic function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~. +#+begin_src c :tangle (eval c) :comments org :noweb yes qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -583,7 +589,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, } #+end_src -** Fortran interfaces (exposed in qmckl_f.F90) +*** Fortran interfaces (exposed in qmckl_f.F90) :PROPERTIES: :Name: qmckl_sherman_morrison_naive :CRetType: qmckl_exit_code @@ -668,7 +674,11 @@ interface end interface #+end_src -** Tests +*** Performance +This function performs best when there is only 1 rank-1 update in the update cycle. It is +not useful to use Sherman-Morrison with update splitting for these cycles since splitting +can never resolve a situation where applying the update causes singular behaviour. +*** Tests The tests for the kernels are executed on datasets that are extracted from a run of QMC=Chem on Benzene (21 spin-up/21 spin down electrons) using 329 unique alpha determinants. The tests are run such that the kernels reject the computed inverse whenever the computed @@ -728,6 +738,419 @@ assert(rc == QMCKL_SUCCESS); #+end_src +* Helper Functions +Private helper-functions that are used by the Sherman-Morrison-Woodbury kernels. +These functions can only be used internally by the kernels in this module. + +** ~qmckl_slagel_splitting~ + :PROPERTIES: + :Name: qmckl_slagel_splitting + :CRetType: qmckl_exit_code + :FRetType: qmckl_exit_code + :END: + +*** Introduction + ~qmckl_slagel_splitting~ is the non-recursive, inner part of the 'Sherman-Morrison with update splitting'-kernel. + It is used internally to apply a collection of $N$ rank-1 updates to the inverse Slater-matrix $S^{-1}$ and + splitting an update in two equal pieces if necessary. In case of a split, it applies the first half of the update, + while putting the second half in a waiting queue to be applied at the end. + + Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, the update is applied as usual. Otherwise, $u_j$ will be redefined + as $\frac{1}{2}u_j$. One half is applied immediately, the other half will be applied at the end of the algorithm, using vectors + $u_{j'}=\frac{1}{2}u_j$ and $v_{j'}^T=v_{j}^T$, which are stored in the array \texttt{later_updates}. + + If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting + from applying the updates to the original matrix. + +*** API +#+NAME: qmckl_slagel_splitting_args +| Variable | Type | In/Out | Description | +|-----------------+-------------------------+--------+---------------------------------------------------------------| +| ~LDS~ | ~uint64_t~ | in | Leading dimension of Slater_inv | +| ~Dim~ | ~uint64_t~ | in | Dimension of Slater_inv | +| ~N_updates~ | ~uint64_t~ | in | Number of rank-1 updates to be applied to Slater_inv | +| ~Updates~ | ~double[N_updates*LDS]~ | in | Array containing the rank-1 updates | +| ~Updates_index~ | ~uint64_t[N_updates]~ | in | Array containing positions of the rank-1 updates | +| ~breakdown~ | ~double~ | in | Break-down parameter on which to fail or not | +| ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse Slater-matrix | +| ~later_updates~ | ~double[N_updates*LDS]~ | inout | Array containing the split updates for later | +| ~later_index~ | ~uint64_t[N_updates]~ | inout | Array containing the positions of the split updates for later | +| ~later~ | ~uint64_t~ | inout | Number of split updates for later | +| ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | + +*** Pedagogical kernel source (in Fortran) +The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is +able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore +not be used in real workloads. + +#+begin_src f90 :tangle (eval f) +integer function qmckl_slagel_splitting_doc_f( & + lds, dim, & + nupdates, & + upds, & + updates_index, & + breakdown, & + s_inv, & + later_updates, & + later_index, & + later, & + determinant) result(info) + + use qmckl + implicit none + integer*8 , intent(in) :: lds, dim + integer*8 , intent(in) :: nupdates + integer*8 , intent(in) :: updates_index(nupdates) + real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: breakdown + real*8 , intent(inout) :: s_inv(dim * lds) + real*8 , intent(inout) :: later_updates(nupdates * lds) + integer*8 , intent(inout) :: later_index(nupdates) + integer*8 , intent(inout) :: later + real*8 , intent(inout) :: determinant + + real*8 , dimension(lds, nupdates) :: Updates + real*8 , dimension(dim, lds) :: Inverse + + info = QMCKL_FAILURE + + ! Convert 'upds' and 's_inv' into the more easily readable Fortran + ! matrices 'Updates' and 'Inverse'. + call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) + + ! YET TO BE IMPLEMENTED + + ! Copy updated inverse back to s_inv + call copy_back(Inverse, s_inv, lds, dim) + + info = QMCKL_SUCCESS + +end function qmckl_slagel_splitting_doc_f +#+end_src + +**** C interface to the pedagogical kernel (not directly exposed) +The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure +that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in +Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function +~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h' +for C users and in the module file 'qmckl_f.F90' for Fortran users. + +#+CALL: generate_c_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval f) :comments org :exports none +integer(c_int32_t) function qmckl_slagel_splitting_doc & + (LDS, & + Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + later_updates, & + later_index, & + later, & + determinant) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + integer(c_int32_t), external :: qmckl_slagel_splitting_doc_f + info = qmckl_slagel_splitting_doc_f & + (LDS, & + Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + later_updates, & + later_index, & + later, & + determinant) + +end function qmckl_slagel_splitting_doc +#+end_src + +*** Requirements + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~later_updates~ is allocated with $later \times Dim$ elements + * ~later_index~ is allocated with $N_updates$ elements + * ~later >= 0~ + +*** C headers (exposed in qmckl.h) + +#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) + +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_slagel_splitting ( + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* later_updates, + uint64_t* later_index, + uint64_t* later, + double* determinant ); +#+end_src + +*** C source +#+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_slagel_splitting_hpc( + uint64_t LDS, + uint64_t Dim, + uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict later_updates, + uint64_t* __restrict later_index, + uint64_t* __restrict later, + double* __restrict determinant) { + + double __attribute__((aligned(8))) C[LDS]; + double __attribute__((aligned(8))) D[LDS]; + + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = S^{-1} x U_l + for (uint64_t i = 0; i < Dim; i++) { + C[i] = 0.0f; + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; + } + } + + // Denominator + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; + if (fabs(den) < breakdown) { + // U_l = U_l / 2: split the update in 2 equal halves and save the + // second halve in later_updates + IVDEP + ALIGNED + for (uint64_t i = 0; i < LDS; i++) { + later_updates[*later * LDS + i] = Updates[l * LDS + i] * 0.5f; + C[i] *= 0.5f; + } + later_index[*later] = Updates_index[l]; + (*later)++; + + den = 1.0f + C[cui]; + } // From here onwards we continue with applying the first halve of the + // update to Slater_inv + double iden = 1.0f / den; + + if (determinant) + *determinant *= den; + + // D = v^T x S^{-1} : 1 x LDS + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + D[j] = Slater_inv[cui * LDS + j]; + } + + // S^{-1} = S^{-1} - C x D / den + for (uint64_t i = 0; i < Dim; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + const double update = C[i] * D[j] * iden; + Slater_inv[i * LDS + j] -= update; + } + } + l += 1; + } + + return QMCKL_SUCCESS; +} + #+end_src + +#+NAME:slagel_splitting_template_code +#+begin_src c +static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( + uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict later_updates, + uint64_t* __restrict later_index, + uint64_t* __restrict later, + double* __restrict determinant) { + + double __attribute__((aligned(8))) C[D{Dim}_P]; + double __attribute__((aligned(8))) D[D{Dim}_P]; + + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = S^{-1} x U_l + for (uint64_t i = 0; i < {Dim}; i++) { + C[i] = 0.0f; + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; + } + } + + // Denominator + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; + if (fabs(den) < breakdown) { + // U_l = U_l / 2: split the update in 2 equal halves and save the + // second halve in later_updates + IVDEP + ALIGNED + for (uint64_t i = 0; i < D{Dim}_P; i++) { + later_updates[*later * D{Dim}_P + i] = Updates[l * D{Dim}_P + i] * 0.5f; + C[i] *= 0.5f; + } + later_index[*later] = Updates_index[l]; + (*later)++; + + den = 1.0f + C[cui]; + } // From here onwards we continue with applying the first halve of the + // update to Slater_inv + double iden = 1.0f / den; + + if (determinant) + *determinant *= den; + + // D = v^T x S^{-1} : 1 x D{Dim}_P + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + D[j] = Slater_inv[cui * D{Dim}_P + j]; + } + + // S^{-1} = S^{-1} - C x D / den + for (uint64_t i = 0; i < {Dim}; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + const double update = C[i] * D[j] * iden; + Slater_inv[i * D{Dim}_P + j] -= update; + } + } + l += 1; + } + + return QMCKL_SUCCESS; +} +#+end_src + +#+NAME:slagel_splitting_kernel_generator +#+begin_src python :noweb yes :exports none +text=""" +<> +""" +result = [] +for Dim in <>: + Dim=str(Dim) + result.append(text.replace("{Dim}",Dim) ) + +return '\n'.join(result) +#+end_src + +#+NAME:slagel_splitting_switch-case_generator +#+begin_src python :noweb yes :exports none +text=""" +case {Dim}: + return qmckl_slagel_splitting_{Dim}( + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, + later, + determinant); +""" +result = [] +for Dim in <>: + Dim=str(Dim) + result.append(text.replace("{Dim}",Dim) ) + +return '\n'.join(result) +#+end_src + +#+begin_src c :tangle (eval c) :comments org :noweb yes +<> +#+end_src + +#+begin_src c :tangle (eval c) :comments org :noweb yes +qmckl_exit_code qmckl_slagel_splitting( + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* later_updates, + uint64_t* later_index, + uint64_t* later, + double* determinant) { + + if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases + switch (Dim) { + <> + } + } + else { // When SIMD_LENGTH > 1, called with LDS == Dim AND Dim != (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) + return qmckl_slagel_splitting_hpc( + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, + later, + determinant); + } + + return QMCKL_FAILURE; +} +#+end_src + +*** Performance +This function cannot be used by itself and is used in Sherman-Morrison with update splitting and Woodbury 3x3 and 2x2 +with Sherman-Morrison and update splitting. Please look at the performance reccomendations for those two kernels. + * End of files #+begin_src c :comments link :tangle (eval c_test) From 4f0bdda4ff8e3721fcdf1137f14856c0168a6d76 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Wed, 15 Feb 2023 18:49:12 +0100 Subject: [PATCH 16/30] ...and the Fortran interfaces to the C-functions. --- org/qmckl_sherman_morrison_woodbury.org | 94 ++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index cd226d1..3813d04 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -917,7 +917,7 @@ qmckl_exit_code qmckl_slagel_splitting ( double* determinant ); #+end_src -*** C source +*** C sources #+begin_src c :tangle (eval c) :comments org qmckl_exit_code qmckl_slagel_splitting_hpc( uint64_t LDS, @@ -1147,10 +1147,102 @@ qmckl_exit_code qmckl_slagel_splitting( } #+end_src +*** Fortran interfaces (exposed in qmckl_f.F90) + :PROPERTIES: + :Name: qmckl_slagel_splitting + :CRetType: qmckl_exit_code + :FRetType: qmckl_exit_code + :END: + +#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_hpc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_slagel_splitting_hpc & + (LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, later, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + end function qmckl_slagel_splitting_hpc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_slagel_splitting_doc & + (LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, later, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + end function qmckl_slagel_splitting_doc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_slagel_splitting & + (LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, later, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + end function qmckl_slagel_splitting +end interface +#+end_src + *** Performance This function cannot be used by itself and is used in Sherman-Morrison with update splitting and Woodbury 3x3 and 2x2 with Sherman-Morrison and update splitting. Please look at the performance reccomendations for those two kernels. + * End of files #+begin_src c :comments link :tangle (eval c_test) From 181f662c6891b83abbce94f2f183a8ef801127a7 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Wed, 15 Feb 2023 19:03:11 +0100 Subject: [PATCH 17/30] Added macro HPC/DOC switch --- org/qmckl_sherman_morrison_woodbury.org | 37 +++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 3813d04..261df07 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -561,7 +561,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, <> } } - else { // When SIMD_LENGTH > 1, called with LDS == Dim AND Dim != (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) + else { // Updating smaller sub-matrix return qmckl_sherman_morrison_naive_hpc(context, LDS, Dim, @@ -1070,7 +1070,7 @@ static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( #+end_src #+NAME:slagel_splitting_kernel_generator -#+begin_src python :noweb yes :exports none +#+begin_src python :noweb yes text=""" <> """ @@ -1083,7 +1083,7 @@ return '\n'.join(result) #+end_src #+NAME:slagel_splitting_switch-case_generator -#+begin_src python :noweb yes :exports none +#+begin_src python :noweb yes text=""" case {Dim}: return qmckl_slagel_splitting_{Dim}( @@ -1123,12 +1123,13 @@ qmckl_exit_code qmckl_slagel_splitting( uint64_t* later, double* determinant) { + #ifdef HAVE_HPC if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases switch (Dim) { <> } } - else { // When SIMD_LENGTH > 1, called with LDS == Dim AND Dim != (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) + else { // Updating smaller sub-matrix return qmckl_slagel_splitting_hpc( LDS, Dim, @@ -1142,7 +1143,33 @@ qmckl_exit_code qmckl_slagel_splitting( later, determinant); } - + #else + // return qmckl_slagel_splitting_doc( + // LDS, + // Dim, + // N_updates, + // Updates, + // Updates_index, + // breakdown, + // Slater_inv, + // later_updates, + // later_index, + // later, + // determinant); + return qmckl_slagel_splitting_hpc( + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, + later, + determinant); + #endif + return QMCKL_FAILURE; } #+end_src From 1ee9635590f48962d778daa9071ec0c949ea0ad4 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 16 Feb 2023 14:54:59 +0100 Subject: [PATCH 18/30] Added SM Splitting with doc version in Fortran skelleton plus Fortran/C interface. --- org/qmckl_sherman_morrison_woodbury.org | 500 +++++++++++++++++++++--- 1 file changed, 441 insertions(+), 59 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 261df07..98193cc 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -88,6 +88,17 @@ from applying the updates to the original matrix. | ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse of a Slater-matrix | | ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | +*** Requirements + * ~context~ is not ~QMCKL_NULL_CONTEXT~ + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~determinant > 0~ + *** Pedagogical kernel source (in Fortran) The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore @@ -256,18 +267,6 @@ integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & end function qmckl_sherman_morrison_naive_doc #+end_src -*** Requirements - - * ~context~ is not ~QMCKL_NULL_CONTEXT~ - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements - * ~determinant > 0~ - *** C headers (exposed in qmckl.h) #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) @@ -565,24 +564,23 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, return qmckl_sherman_morrison_naive_hpc(context, LDS, Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); - + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); } #else return qmckl_sherman_morrison_naive_doc(context, - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); #endif return QMCKL_FAILURE; @@ -738,29 +736,414 @@ assert(rc == QMCKL_SUCCESS); #+end_src -* Helper Functions -Private helper-functions that are used by the Sherman-Morrison-Woodbury kernels. -These functions can only be used internally by the kernels in this module. +* Sherman-Morrison with update splitting +** ~qmckl_sherman_morrison_splitting~ +:PROPERTIES: +:Name: qmckl_sherman_morrison_splitting +:CRetType: qmckl_exit_code +:FRetType: qmckl_exit_code +:END: -** ~qmckl_slagel_splitting~ +*** Introduction +This is a variation on the 'Naive' Sherman-Morrison kernel. Whenever the denominator $1+v_j^T S^{-1} u_j$ in +the Sherman-Morrison formula is deemed to be too close to zero, the update $u_j$ is split in half: +$u_j \rightarrow \frac{1}{2} u_j$. One half is applied immediately --necessarily increasing the value of the +denominator because of the split-- while the other halve is put in a queue that will be applied when all the +remaining updates have been treated. + +The kernel is executed recursively until the queue is eiter empty and all +updates are applied successfully, or the size of the queue equals the number of initial updates. In the last +case the Slater-matrix that would have resulted from applying the updates is singular and therefore the +kernel exits with an exit code. + +If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting +from applying the updates to the original matrix. + +*** API +#+NAME: qmckl_sherman_morrison_splitting_args +| Variable | Type | In/Out | Description | +|---------------+-----------------------+--------+------------------------------------------------------| +| context | qmckl_context | in | Global state | +| LDS | uint64_t | in | Leading dimension of Slater_inv | +| Dim | uint64_t | in | Dimension of Slater_inv | +| N_updates | uint64_t | in | Number of rank-1 updates to be applied to Slater_inv | +| Updates | double[N_updates*LDS] | in | Array containing the updates | +| Updates_index | uint64_t[N_updates] | in | Array containing the rank-1 updates | +| breakdown | double | in | Break-down parameter on which to fail or not | +| Slater_inv | double[Dim*LDS] | inout | Array containing the inverse of a Slater-matrix | +| determinant | double | inout | Determinant of the Slater-matrix | + +*** Requirements + * ~context~ is not ~QMCKL_NULL_CONTEXT~ + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + +*** Pedagogical kernel source (in Fortran) +The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is +able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore +not be used in real workloads. + +#+begin_src f90 :tangle (eval f) +integer function qmckl_sherman_morrison_splitting_doc_f(context, & + lds, dim, & + nupdates, & + upds, & + updates_index, & + breakdown, & + s_inv, & + determinant) result(info) + + use qmckl + implicit none + integer*8 , intent(in) :: context + integer*8 , intent(in) :: lds, dim + integer*8 , intent(in) :: nupdates + integer*8 , intent(in) :: updates_index(nupdates) + real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: breakdown + real*8 , intent(inout) :: s_inv(dim * lds) + real*8 , intent(inout) :: determinant + + real*8 , dimension(lds, nupdates) :: Updates + real*8 , dimension(dim, lds) :: Inverse + + info = QMCKL_FAILURE + + ! Convert 'upds' and 's_inv' into the more easily readable Fortran + ! matrices 'Updates' and 'Inverse'. + call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) + + ! YET TO BE IMPLEMENTED + + ! Copy updated inverse back to s_inv + call copy_back(Inverse, s_inv, lds, dim) + + info = QMCKL_SUCCESS + +end function qmckl_sherman_morrison_splitting_doc_f +#+end_src + +**** C interface to the pedagogical kernel (not directly exposed) +The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure +that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in +Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function +~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h' +for C users and in the module file 'qmckl_f.F90' for Fortran users. + +#+CALL: generate_c_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval f) :comments org :exports none +integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + integer(c_int32_t), external :: qmckl_sherman_morrison_splitting_doc_f + info = qmckl_sherman_morrison_splitting_doc_f & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) + +end function qmckl_sherman_morrison_splitting_doc +#+end_src + +*** C headers (exposed in qmckl.h) + +#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) + +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_sherman_morrison_splitting ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant ); +#+end_src + +#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_hpc") + +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_sherman_morrison_splitting_hpc ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant ); +#+end_src + +#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_doc") + +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_sherman_morrison_splitting_doc ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant ); +#+end_src + +*** C source +#+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant) { + + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith(context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_splitting", + NULL); + } + + double __attribute__((aligned(8))) later_updates[LDS * N_updates]; + uint64_t later_index[N_updates]; + uint64_t later = 0; + + qmckl_exit_code rc = qmckl_slagel_splitting( + LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, + later_updates, later_index, &later, determinant); + if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; + + if (later > 0) { + qmckl_exit_code rc = qmckl_sherman_morrison_splitting( + context, LDS, Dim, later, later_updates, later_index, breakdown, + Slater_inv, determinant); + if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; + } + + return QMCKL_SUCCESS; +} +#+end_src + +#+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_sherman_morrison_splitting(const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant) { + + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith(context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_splitting", + NULL); + } + + #ifdef HAS_HPC + return qmckl_sherman_morrison_splitting_hpc(context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); + #else + // return qmckl_sherman_morrison_splitting_doc(context, + // LDS, + // Dim, + // N_updates, + // Updates, + // Updates_index, + // breakdown, + // Slater_inv, + // determinant); + return qmckl_sherman_morrison_splitting_hpc(context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); + #endif + + return QMCKL_SUCCESS; +} +#+end_src + +*** Fortran interfaces (exposed in qmckl_f.F90) :PROPERTIES: - :Name: qmckl_slagel_splitting + :Name: qmckl_sherman_morrison_naive :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: +#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting_hpc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sherman_morrison_splitting_hpc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sherman_morrison_splitting_hpc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sherman_morrison_splitting_doc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sherman_morrison_splitting & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sherman_morrison_splitting +end interface +#+end_src + +*** Performance... +This kernel performs best when there are 2 or more rank-1 update cycles and fail-rate is high. + +*** Test +#+begin_src c :tangle (eval c_test) +assert(Updates3 != NULL); +assert(Updates_index3 != NULL); +assert(Slater_inv3_2 != NULL); +det = -1.23743195512859e-09; +rc = qmckl_sherman_morrison_splitting(context, LDS, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2, &det); +assert(fabs(det - 1.602708950725074e-10) < 1e-15); +for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + res[i * Dim + j] = 0; + for (unsigned int k = 0; k < Dim; k++) { + res[i * Dim + j] += Slater3[i * Dim + k] * Slater_inv3_2[k * LDS + j]; + } + } +} +rc = QMCKL_SUCCESS; +for (unsigned int i = 0; i < Dim; i++) { + for (unsigned int j = 0; j < Dim; j++) { + if (i == j && fabs(res[i * Dim + j] - 1) > tolerance) { + rc = QMCKL_FAILURE; + } + if (i != j && fabs(res[i * Dim + j]) > tolerance) { + rc = QMCKL_FAILURE; + } + } +} +assert(rc == QMCKL_SUCCESS); +#+end_src + + +* Slagel Splitting +** ~qmckl_slagel_splitting~ +:PROPERTIES: +:Name: qmckl_slagel_splitting +:CRetType: qmckl_exit_code +:FRetType: qmckl_exit_code +:END: + *** Introduction - ~qmckl_slagel_splitting~ is the non-recursive, inner part of the 'Sherman-Morrison with update splitting'-kernel. - It is used internally to apply a collection of $N$ rank-1 updates to the inverse Slater-matrix $S^{-1}$ and - splitting an update in two equal pieces if necessary. In case of a split, it applies the first half of the update, - while putting the second half in a waiting queue to be applied at the end. +~qmckl_slagel_splitting~ is the non-recursive, inner part of the 'Sherman-Morrison with update splitting'-kernel. +It is used internally to apply a collection of $N$ rank-1 updates to the inverse Slater-matrix $S^{-1}$ and +splitting an update in two equal pieces if necessary. In case of a split, it applies the first half of the update, +while putting the second half in a waiting queue to be applied at the end. - Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, the update is applied as usual. Otherwise, $u_j$ will be redefined - as $\frac{1}{2}u_j$. One half is applied immediately, the other half will be applied at the end of the algorithm, using vectors - $u_{j'}=\frac{1}{2}u_j$ and $v_{j'}^T=v_{j}^T$, which are stored in the array \texttt{later_updates}. +Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, the update is applied as usual. Otherwise, $u_j$ will be redefined +as $\frac{1}{2}u_j$. One half is applied immediately, the other half will be applied at the end of the algorithm, using vectors +$u_{j'}=\frac{1}{2}u_j$ and $v_{j'}^T=v_{j}^T$, which are stored in the array \texttt{later_updates}. - If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting - from applying the updates to the original matrix. +If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting +from applying the updates to the original matrix. *** API #+NAME: qmckl_slagel_splitting_args @@ -778,6 +1161,18 @@ These functions can only be used internally by the kernels in this module. | ~later~ | ~uint64_t~ | inout | Number of split updates for later | | ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | +*** Requirements + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~later_updates~ is allocated with $later \times Dim$ elements + * ~later_index~ is allocated with $N_updates$ elements + * ~later >= 0~ + *** Pedagogical kernel source (in Fortran) The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore @@ -885,20 +1280,7 @@ integer(c_int32_t) function qmckl_slagel_splitting_doc & end function qmckl_slagel_splitting_doc #+end_src -*** Requirements - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements - * ~later_updates~ is allocated with $later \times Dim$ elements - * ~later_index~ is allocated with $N_updates$ elements - * ~later >= 0~ - *** C headers (exposed in qmckl.h) - #+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: @@ -1175,11 +1557,11 @@ qmckl_exit_code qmckl_slagel_splitting( #+end_src *** Fortran interfaces (exposed in qmckl_f.F90) - :PROPERTIES: - :Name: qmckl_slagel_splitting - :CRetType: qmckl_exit_code - :FRetType: qmckl_exit_code - :END: +:PROPERTIES: +:Name: qmckl_slagel_splitting +:CRetType: qmckl_exit_code +:FRetType: qmckl_exit_code +:END: #+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_hpc") From b0f05b7c250a64dbaa2b1892991d4158e2edb1ca Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 16 Feb 2023 15:58:57 +0100 Subject: [PATCH 19/30] Commented out unused testdata. --- share/qmckl/test_data/sm_test.h | 60 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/share/qmckl/test_data/sm_test.h b/share/qmckl/test_data/sm_test.h index 13b3e9c..8a7ce54 100644 --- a/share/qmckl/test_data/sm_test.h +++ b/share/qmckl/test_data/sm_test.h @@ -5,25 +5,25 @@ const double Slater1[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, 0.0065372241660952603, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, 0.061368178576231003, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0186148826032877, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, -0.00068585784174501896, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, 0.10071966797113401, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017144737765192999, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, 0.028169330209493599, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.0189813487231731, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, -0.023023990914225599, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.0581490993499756, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, 0.12407322973012901, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, -0.0192963760346174, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, -0.067969180643558502, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.134273305535316, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.16332066059112499, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, 0.13097538053989399, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.0025253379717469198, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.088090680539608002, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.015691248700022701, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0069939070381224199, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, 0.070078171789646093}; double Slater_inv1[504] = {-0.0525082963130096, -192.960477122746, -167.343357271998, 1.69063377058866, -1378.4882402189, 239.360652372684, 874.40192183061697, -513.31846478968203, 807.35483045933495, -19.026422090297299, -17.824591748935202, 165.6645926386, -332.909289060628, -18.6107453916377, -11.6439930601979, 317.18559450822198, 214.12532640356201, -430.80943299473, -344.65005510575799, 740.81014093255203, -84.923325284754696, 0.0, 0.0, 0.0, 0.064335245989650805, 234.71397330210399, 205.1186636226, -3.4153770027768502, 1680.13890084581, -293.40065007215702, -1065.8419078679401, 624.86259814866003, -989.76729197131897, 23.298249286417001, 21.573213707404399, -202.41174445438401, 405.86421806904502, 22.922945938042901, 14.236362125535999, -386.65825218682801, -261.06337565261498, 528.20337075570103, 421.94063881187702, -902.75507799084596, 105.03985525163, 0.0, 0.0, 0.0, 0.044200668381308601, -138.85152101714399, -121.27002019292, 2.0061662585667599, -992.69022926063894, 173.24384564131401, 629.63518796071799, -369.68832373377103, 582.99742710801104, -13.474468953452901, -12.4187314531643, 119.002229516372, -239.76386110607999, -13.4968690647037, -8.1499663302329708, 228.499936475189, 154.09732894897101, -311.21651724011002, -248.26815844269399, 533.37480106787098, -61.991136485706697, 0.0, 0.0, 0.0, -0.0765497914729725, 240.772681546397, 209.115172008988, -2.12401058528051, 1722.15420882834, -299.07379390801702, -1092.4670851015201, 641.09661184520598, -1007.44097957056, 23.333413806919001, 21.9897514440317, -206.53257016044699, 415.81861108697302, 23.3743606050752, 14.107639254523001, -396.52477956346598, -267.77854087146301, 537.68662188870303, 429.83533323670702, -925.65731644586003, 106.070284414301, 0.0, 0.0, 0.0, -0.037109975520249097, -136.738457148886, -118.917063549582, 1.19704609156923, -977.22998951029899, 169.63000196416201, 620.01253859081601, -364.02043006288699, 570.85982682561803, -13.451266756380299, -12.146454471873501, 117.435790064483, -235.687342903548, -13.183975346097, -8.2288378293500593, 224.66974233421601, 151.73703725446899, -304.613662218336, -243.40661913323399, 525.55077671846004, -60.142862384234697, 0.0, 0.0, 0.0, -0.062476778936209301, 195.74640208908301, 170.54051550313201, -2.8328765312753998, 1399.12576024585, -244.28628529648901, -887.63077081451104, 520.884480704167, -823.92607500410702, 19.0479002693959, 18.195743596123101, -168.030291787452, 337.586201042798, 18.991146825575299, 11.5224539224244, -321.78784999564101, -217.23371709456501, 439.82292557372398, 351.28300986264401, -752.091241883468, 87.457548717202599, 0.0, 0.0, 0.0, 4.3572379528639997e-05, -23.790404094575401, -19.504220922406098, 0.26595531593048999, -161.34910319146201, 30.163156787264001, 102.337776116854, -58.672051676794297, 103.227708063905, -0.22802366652163999, -2.2306129106953398, 21.778747237132102, -40.783330246607299, -1.38732280869919, -0.75357165711863805, 39.269880423319599, 26.312297182321299, -55.061514171221297, -43.569942636118199, 85.973367077774896, -10.016061028885201, 0.0, 0.0, 0.0, 4.0427159001010801e-05, 28.392374743152502, 26.373254860492299, -0.36980926031100297, 209.22398819265001, -37.9473984838014, -132.76472733653301, 77.720615205630693, -127.924723556082, 0.29745864731730998, 2.7793514223195599, -29.019189334306802, 53.826499495808498, 4.2582570650914597, 0.51526747227423098, -50.914050124737102, -31.724328055085401, 68.0683646567051, 55.266627392249198, -110.63482872154501, 14.1152956761065, 0.0, 0.0, 0.0, 0.00055720168222872903, -2.6345228739497299, -3.4087974363069198, 0.048641237778327802, -18.3623844122964, 3.8195276251277801, 11.6411523542838, -5.8812824661877396, 15.735088038012799, -0.058858662594294599, -0.23845780430312999, 6.5124119812799099, -6.1494099868393697, 0.340564236694477, -0.880332042883611, 5.7252222161672197, 2.8545094725865199, -8.3447036743893506, -8.0497901808946395, 9.3503553819376606, -1.76541796469797, 0.0, 0.0, 0.0, 0.00098753020434672305, -4.6360828892267198, -4.7638931470942598, 0.052453544062221497, -34.4916331053766, 7.7511206271403301, 21.997597399118899, -10.6934789694381, 32.345600850876203, -0.10706305963427901, -0.54284354835464799, 12.037079682564, -12.6961140374279, -1.7388931639227301, -1.8407110220006899, 10.3197626100112, 5.2986332905796001, -16.735105713526099, -14.146077371772099, 15.8344011098352, -1.6714914906603899, 0.0, 0.0, 0.0, -4.8622590537520702e-05, 21.991930004831101, 18.4929481874854, -0.23309077760739899, 151.30678790823001, -25.711826077506299, -96.044580982176896, 55.801793853982701, -88.373121372798394, 0.202838254384864, 1.86718437434255, -20.278044655055201, 40.151563308198597, 1.3977678891012399, 0.324629892441265, -37.6766500842932, -24.340233848932201, 47.6840523743628, 38.2032083073968, -79.164159949210401, 8.7548536140586801, 0.0, 0.0, 0.0, -0.00061993571816668601, -0.395895385274183, -1.4644468265008701, -0.0046318612148825598, -4.9913109472233304, 1.48540197873744, 3.26672618350988, -0.95752411931703396, 8.9569370743490193, -0.062041348029879102, -0.080157437015122804, 8.0102582504767295, -5.9688675669055504, 0.67530938859376199, 1.27437097858607, 5.0084164430027203, 0.35632315612076498, -3.3504197552733501, -4.6662276852701501, -0.607157596121083, 0.48644342530280699, 0.0, 0.0, 0.0, -0.00097211385626449695, 4.8383102174293198, 5.4067550135312503, -0.10295717451613901, 29.4184191533957, -9.4450875338250793, -18.800441303291901, 8.5840933132932609, -37.118301659976296, 0.106267952523929, 0.66461896188866798, -11.4398182377096, 13.0631130369628, -0.68992479801260798, 1.9745973431694701, -10.3210596342876, -5.2304303953711804, 18.385374172705902, 17.020178998151501, -12.315621520081001, 3.7778248703987298, 0.0, 0.0, 0.0, -0.00031338187670125201, 12.870239622711001, 12.0022872209785, -0.16605346741786001, 96.046941246958397, -16.9389614709639, -60.935799758442698, 35.1352737141356, -61.591085318216102, 0.111297136966112, 1.23095348877198, -10.067914675180299, 24.0397569908422, 1.55026659084186, 0.71351574089035996, -23.902604464805101, -14.335678342218401, 32.573495764200203, 25.978026199263301, -50.506323253986302, 6.2999821545807402, 0.0, 0.0, 0.0, 0.00078010309855064104, -5.4500389454791298, -2.8881970061941198, 0.034137151949219097, -36.693158530832299, 5.3229408635849698, 23.065511761726999, -18.654750377009499, 16.655427409154399, 0.0120347437456702, -0.40190064848770302, -4.3952667136196499, -3.2283315530947299, 0.535114819933451, -1.6695636399303999, 4.8387109899640901, 5.9387464984757097, -9.2525260067921593, -7.0534068376986703, 24.6079478080533, -1.24249543569277, 0.0, 0.0, 0.0, -0.00048592251459139902, 2.8352295963632699, 2.97576788056818, -0.061903426111554402, 15.662499828725799, -6.3594611155842697, -10.0297611955082, 4.4512302388898801, -22.9014624835775, 0.0522795583755256, 0.46237084970893699, -5.9599628993498204, 6.3134697655201197, -0.35523986461548501, 1.1938822885348901, -6.1222818696018599, -3.0697099757554498, 13.1385066502153, 10.0165667609847, -5.6534055293581504, 2.2982459946613698, 0.0, 0.0, 0.0, 5.71641932114923e-05, -1.95937881355126, -3.1686710464991501, 0.0078900256254279908, -20.7802266137845, 1.9052049215289899, 13.243728372567, -7.2010122960325198, -1.78569599703996, -0.0023099999984344298, -0.181452511231602, 1.49235850994062, -3.4781928086271598, -0.25097197027097001, 0.034267435208927201, 2.9589361689912899, 2.1880246525605398, 0.40946783452396801, 1.85119165819145, 10.9769363093921, -0.49737197226351498, 0.0, 0.0, 0.0, 0.00057014015696656801, -11.992703942957201, -9.1707599397024797, 0.13131957021746299, -80.913738884742898, 12.2802670275716, 51.275110674413497, -30.8846663544597, 40.768216707846101, -0.056350552707040001, -0.906909874969271, 4.5662724440002496, -16.493313057723601, -1.3954832548549501, -1.1309540462973, 17.671878079289101, 13.348292143643, -21.057182826114602, -17.2839203520208, 44.417018731905799, -5.1700529859646398, 0.0, 0.0, 0.0, 0.00070585484241785499, -3.84393110623766, -3.8217546887026601, 0.042692631956155899, -33.103657623136797, 7.29987823117549, 21.1351246026951, -8.9046379168685696, 25.840620537279499, -0.077726091155589205, -0.51813471867742, 9.6014602253082906, -12.721891663249099, -1.51539376366047, -1.54216689848713, 11.448584843886, 4.4017938077693604, -13.490798207962101, -12.3088359993453, 13.904387711973399, -1.27899798343336, 0.0, 0.0, 0.0, -4.8529590100271397e-05, 1.5144453784960501, 2.3396824932439499, -0.0087660084169081508, 9.4873136503254205, -1.65331055509645, -5.9367044032646401, 5.0146643904078898, -0.269092370588084, 0.0089905796176170498, 0.14805840549764701, -0.89101366694270501, 3.0317998491567302, 0.22142707740346401, 0.0064304970181167601, -3.4235077646052301, -1.69328028781498, 0.48844632252065601, -0.57157344288643996, -5.8659323559885497, 0.45402791645044299, 0.0, 0.0, 0.0, 3.1177001030445297e-05, -2.4386266852651501, -0.31040563209251798, 0.0039504037521311498, -21.849203607580201, -0.45787097219896, 13.8161508224212, -9.4311122174081508, -5.4786114733527702, -0.0069717560537701602, 0.0049075772339915403, 1.65968311111433, -4.9313027452898597, -0.39825841496395797, 0.056303363068839998, 4.9803632483141103, 2.7343202713150898, 2.3452757571679799, 3.3498732374241098, 12.4790131924658, -0.41615992378439798, 0.0, 0.0, 0.0}; - const uint64_t Updates_index2[2] = {20, 21}; - const double Updates2[48] = {-0.012056605890393198, 0.072118259966373, -0.14986032247543299, -0.023892195895314251, 0.2306191368843431, 0.070976656861603302, 0.059228850266663378, -0.0081594046205282003, 0.03775668889284136, -0.32248186320066397, -0.30175055470317586, -0.048578753136098399, -0.050512738234829151, 0.074964269995690003, 0.022375471889972701, 0.20063611492514641, -0.013817949220538101, 0.034675425849854905, 0.14269321411848099, 0.16303040878847203, 0.20520395040512121, 0.0, 0.0, 0.0, 0.027209745720028898, -0.019752152264117806, 0.24686626344919221, 0.021544795483350802, 0.0053255971870385145, -0.074287162162363515, 0.0020896954229101539, -0.0015901625156403004, 0.045653678011149175, -0.095019596163183437, 0.015724316006526361, 0.057632524985820083, 0.0043175870669074383, -0.075611688196659296, -0.2787729352712634, 0.071667610667645931, -0.0016040895134210986, -0.018613442778587338, 0.16365851461887351, 0.018654582090675831, -0.43227782845497098, 0.0, 0.0, 0.0}; - const double Slater2[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.028107110410928698, 0.013431881554424799, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.174509197473526, 0.085864908993244199, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.044309988617896999, 0.215069741010666, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, -0.015649655833840401, 0.011034868657589, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.00089795450912788499, 0.0060455044731497799, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.0114687560126185, -0.066873423755168901, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.000334969052346423, 0.0023343940265476699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.020809086039662399, -0.039619617164135, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, 0.0072047915309667596, 0.043619588017463698, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, -0.21170908212661699, 0.0024762949906289599, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.00210775528103113, 0.0140155302360654, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, -0.012914831750094899, 0.058629415929317502, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, -0.00059447408420965097, 0.00458275340497494, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.204596728086472, 0.091698803007602706, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.096327632665634197, -0.084247380495071397, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.0109922774136066, 0.077829994261264801, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.0301918238401413, -0.017013777047395699, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.0024164030328393, -0.017579320818185799, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, 0.030398890376091, 0.14741712808609, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.0045813838951289697, 0.024331344291567799, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, 0.13371524214744601, -0.19178953766822801}; - double Slater_inv2[504] = {-0.064091478343647895, 713.06177859755496, -52.018444001735702, 0.22294142549212401, 6739.1399551272798, 409.47332011602299, -4258.7085329747897, 2990.6198857571399, 2842.82174111627, -16.4362076124787, -19.6479024764561, -450.95698589104001, 1499.21617070053, 129.354086480939, -32.5623649949015, -1533.16729952379, -801.75588044433505, -1302.1490458327801, -1589.22747455529, -3895.5139631694801, 69.692448899038894, 0.0, 0.0, 0.0, 0.078717515330272506, -890.24945003874404, 61.925371835460197, -1.59301536151858, -8399.1221177311709, -504.62121099099301, 5307.6897279898503, -3725.8058949477299, -3517.1067799943698, 20.0821069369808, 23.8371292623433, 563.21704392130198, -1868.99615781019, -160.79773282728499, 40.209679175758602, 1910.8342353503599, 1000.30652221449, 1610.10305651065, 1967.2714135880001, 4853.9412977750599, -86.938972564264105, 0.0, 0.0, 0.0, 0.035772543187836597, 520.38606836760005, -37.3576026553948, 0.93824771966655895, 4913.8375731575898, 297.02078853525001, -3105.3054726097698, 2179.8383098375198, 2064.03863882426, -11.5897837400758, -13.7454041271756, -329.662381563542, 1093.32256576446, 94.164922311323394, -23.370538453071202, -1117.8490893585799, -585.07554862150903, -945.21841098621996, -1153.8443875258399, -2840.0954494666398, 50.509996472385303, 0.0, 0.0, 0.0, -0.062171023850398299, -883.91684171449401, 65.956744158981707, -0.30209264289181997, -8354.6527651622891, -510.24292797392201, 5279.5127573481996, -3708.5126037463401, -3534.1651244869099, 20.118054506627601, 24.253115792914802, 558.90980701110504, -1858.4878939499599, -160.30158683160701, 40.074632460370502, 1900.40832678587, 993.28424539653497, 1619.3228924922901, 1974.7898591375399, 4829.6374496633298, -85.861801422967005, 0.0, 0.0, 0.0, -0.045296585245108302, 503.608089249118, -37.409231418514402, 0.15972971393766999, 4760.0409737735199, 289.86000580815897, -3007.9000554557201, 2112.4472365954498, 2009.46047743586, -11.620588884143499, -13.435110153350299, -318.37193513541001, 1059.1982996055399, 91.392671066014998, -23.013250839168599, -1083.0984474979, -566.25418012298701, -920.44766441625598, -1123.03275109381, -2751.24966532286, 49.134449946833101, 0.0, 0.0, 0.0, -0.050574070850706303, -735.268788752521, 52.034324888924203, -1.3246973887217, -6942.4299970826296, -419.091569409214, 4387.0782989889804, -3079.7112127626101, -2915.54203952635, 16.3862338355292, 20.069350976326799, 465.60100478088498, -1545.0790688177201, -133.05534575663401, 33.017866331913801, 1579.60766417078, 826.67092177544703, 1335.1987409164999, 1630.19252491066, 4012.1274550981102, -71.423354704319806, 0.0, 0.0, 0.0, -0.00110547248442243, 66.086472294581398, -8.0640571635796796, 0.120361096092389, 643.91485283159295, 47.038233657028698, -406.863770451839, 288.91657765213398, 305.14483180816802, 0.028924090527909001, -2.4114842655012301, -39.3897517070086, 140.96244082771301, 13.290701732299899, -2.82866188450281, -144.284041440354, -74.462522726873601, -141.49789272768501, -167.03129270601499, -373.94726486427999, 5.3217330886365399, 0.0, 0.0, 0.0, 0.00169058806401361, -100.681182204012, 9.9438606966790992, -0.16071917417936801, -947.22789644116904, -62.1819544991477, 598.507402482923, -421.456732120239, -417.90099350750501, -0.071547956877298299, 3.03910354158063, 58.825827638175099, -207.18138234350499, -16.8210784946065, 3.4953362885853601, 212.690544720802, 112.99993227712, 192.20097004017899, 232.57136070342199, 549.86422579734096, -7.9115450643297303, 0.0, 0.0, 0.0, 0.00031167490112610501, 16.5702800434129, -0.96427444933400797, 0.017530807484877599, 153.70562899881901, 7.4253775224466096, -97.164535381519997, 68.391115404813903, 58.880541272935403, -0.00395431753418613, -0.27710621824447701, -6.5580129619132999, 32.685848366303901, 3.4769501442949502, -1.3237352902339601, -33.496400026660503, -18.678955342199799, -26.814344384641199, -34.430890540207301, -88.9250347843996, 1.51194685980572, 0.0, 0.0, 0.0, 0.00045214452900354401, 37.241126324245002, 0.56653388165982099, -0.0153845901652373, 340.71285233348101, 15.613889705904301, -215.25964333041301, 151.26187968817001, 126.42681477968, 0.012659113756634199, -0.62711870198964903, -16.4637553538752, 71.986464894089806, 5.1001819045344803, -2.8075780414188398, -75.205305646206597, -41.656360989756003, -57.009250230864701, -71.671627817787495, -198.46090263475699, 5.47499644859007, 0.0, 0.0, 0.0, 0.00085034576532286798, -48.324269416315303, 9.5426055788579802, -0.11918347900064399, -478.70065330731398, -38.914234951661598, 302.33505716911202, -216.13813506153201, -246.345286296176, 0.0018122457897085001, 2.0086911418790101, 27.577828210674401, -102.039313769876, -10.0857520350279, 1.94810040129421, 105.928854388454, 54.502095992205597, 115.30853907215899, 134.79460379303401, 280.65999252254602, -3.2448445639062502, 0.0, 0.0, 0.0, -0.00017551641849241999, -35.157826546458601, -5.8891909991296698, 0.051680022896045397, -316.44550618039898, -5.0414187570711899, 200.212034255265, -135.39535162931199, -69.139114300097802, -0.16142175154882901, -0.0102013166269541, 31.668569875843001, -76.263188383823703, -5.0017512656630601, 2.0769594366589001, 76.002080804042095, 39.333282449810902, 30.0808204248134, 43.085264407243301, 177.27763312527699, -5.4457981556032404, 0.0, 0.0, 0.0, -0.000306806291909659, -47.201229402180303, -1.2172052207398101, -0.0186567796198484, -436.83683166616999, -19.215912540534301, 276.031946309869, -192.67292600019499, -154.03017691774701, -0.042507166509503203, 0.76934514300024204, 23.977306301563999, -92.169363151535805, -9.1886362611435199, 3.1760937062011898, 95.958352522850603, 53.119118943843198, 68.432833843960694, 88.505438350444805, 253.98266241440601, -5.1028992571309599, 0.0, 0.0, 0.0, 0.00043306496689241199, -45.515914649852498, 4.5704850382447297, -0.071472003061512898, -427.071656721686, -27.901412337784699, 269.85362292975498, -190.66655819995299, -192.761246218769, -0.0556222307934695, 1.3484518181471401, 29.668595531405, -94.026613967410796, -7.9849268838018501, 2.0615436543321501, 95.338384205774105, 51.130038963438999, 88.724620902414898, 106.181452502913, 248.269046435468, -3.6638133123307002, 0.0, 0.0, 0.0, 0.00067386198047795695, 2.86001067576094, -1.83043518435104, 0.020675455904269301, 37.761848158240802, 6.8832167853114203, -24.015453768006701, 13.4834243521102, 35.324760224278002, 0.035792229507666501, -0.41862408163183901, -10.0509290141389, 13.5759504464113, 1.8922504612450599, -1.8614272588155001, -12.132753308102799, -3.3789310584400698, -17.244465911049499, -18.4686894621614, -17.916485915275999, 0.17564274753793899, 0.0, 0.0, 0.0, -4.5499005275636101e-05, -31.614155756215101, -1.4091932535724401, -0.0060978442331452703, -292.99139921717801, -12.827598964788001, 185.144804328112, -128.77786179229901, -100.295349372036, -0.046207312260184701, 0.53169799203163903, 17.4856359712815, -63.3488322133691, -5.98125785658572, 1.9892546441005501, 64.233075829740997, 35.5568060355128, 46.269165313517597, 57.338723422189801, 170.63201646028199, -3.5806585828097099, 0.0, 0.0, 0.0, 8.4039919523263399e-05, -4.0615650791823299, -3.4362521652092002, 0.011295419555382699, -39.6150470544694, 1.5105032334831401, 25.1537606371501, -15.330979335618601, -6.5084614221869197, -0.0083199111964546105, -0.17722199841012101, 2.9230666468463902, -7.7291578970740504, -0.59428543237974696, 0.082803013560185101, 7.2521932229389696, 4.54510970987024, 2.43118215251519, 4.7389061057811901, 21.734306554021401, -0.85611719611089199, 0.0, 0.0, 0.0, -0.00025843236821193301, 52.817220161181702, -0.92129495231099501, 0.0263320504370466, 499.75948842769702, 24.448830234480202, -315.90847327586999, 219.760367065808, 186.369999846479, 0.12893364165019799, -1.03733562237538, -39.542133782410801, 114.562973083925, 9.1887926425616406, -2.6272948799917999, -114.688259732943, -59.320103692053301, -83.386175100226296, -106.311499516864, -287.23025749328701, 5.8899806135276798, 0.0, 0.0, 0.0, 0.00029561730769906699, 28.2443444301325, 0.262667708054178, -0.0092881180472059802, 254.39556062397901, 13.3246994983259, -160.662465459228, 115.19312959924299, 97.930045120340793, 0.0140106353296333, -0.58271028141190895, -12.237212046379099, 52.1658593813167, 3.7250252932039301, -2.2830256115872798, -54.084720909199703, -31.577318042678201, -44.3507306279147, -56.3876021769941, -150.29869271905301, 4.1969751871532797, 0.0, 0.0, 0.0, -3.5190977196700897e-05, 0.47111547837818402, 2.2068800929897598, -0.0070758873430103201, 0.13945915693743799, -1.8492037922933, -0.025671220257021801, 0.97970429288930505, -2.6130342276240199, 0.0060078182170399397, 0.15015803890865601, -0.18094310755408499, 0.92201583351316796, 0.051038179907958503, 0.030519047562509002, -1.2927339475995701, -0.52344231597663404, 1.4918374263167999, 0.861619645390301, -0.52697347953005502, 0.27598012654535198, 0.0, 0.0, 0.0, -0.00073600321123188305, 57.569266190747499, 7.3278228968032701, -0.093258163105288297, 515.79957938656798, 10.8090738278263, -326.16130596512397, 222.642609875217, 129.33494256044199, 0.16458397773696601, -0.115854395362115, -39.1805516577625, 116.41448940344399, 9.4017853746533593, -1.32916748411286, -117.572672890536, -64.549778160481395, -55.365507632190301, -79.081290004649304, -294.59516563799099, 9.8243907421444003, 0.0, 0.0, 0.0}; + // const uint64_t Updates_index2[2] = {20, 21}; + // const double Updates2[48] = {-0.012056605890393198, 0.072118259966373, -0.14986032247543299, -0.023892195895314251, 0.2306191368843431, 0.070976656861603302, 0.059228850266663378, -0.0081594046205282003, 0.03775668889284136, -0.32248186320066397, -0.30175055470317586, -0.048578753136098399, -0.050512738234829151, 0.074964269995690003, 0.022375471889972701, 0.20063611492514641, -0.013817949220538101, 0.034675425849854905, 0.14269321411848099, 0.16303040878847203, 0.20520395040512121, 0.0, 0.0, 0.0, 0.027209745720028898, -0.019752152264117806, 0.24686626344919221, 0.021544795483350802, 0.0053255971870385145, -0.074287162162363515, 0.0020896954229101539, -0.0015901625156403004, 0.045653678011149175, -0.095019596163183437, 0.015724316006526361, 0.057632524985820083, 0.0043175870669074383, -0.075611688196659296, -0.2787729352712634, 0.071667610667645931, -0.0016040895134210986, -0.018613442778587338, 0.16365851461887351, 0.018654582090675831, -0.43227782845497098, 0.0, 0.0, 0.0}; + // const double Slater2[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.028107110410928698, 0.013431881554424799, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.174509197473526, 0.085864908993244199, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.044309988617896999, 0.215069741010666, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, -0.015649655833840401, 0.011034868657589, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.00089795450912788499, 0.0060455044731497799, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.0114687560126185, -0.066873423755168901, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.000334969052346423, 0.0023343940265476699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.020809086039662399, -0.039619617164135, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, 0.0072047915309667596, 0.043619588017463698, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, -0.21170908212661699, 0.0024762949906289599, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.00210775528103113, 0.0140155302360654, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, -0.012914831750094899, 0.058629415929317502, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, -0.00059447408420965097, 0.00458275340497494, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.204596728086472, 0.091698803007602706, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.096327632665634197, -0.084247380495071397, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.0109922774136066, 0.077829994261264801, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.0301918238401413, -0.017013777047395699, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.0024164030328393, -0.017579320818185799, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, 0.030398890376091, 0.14741712808609, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.0045813838951289697, 0.024331344291567799, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, 0.13371524214744601, -0.19178953766822801}; + // double Slater_inv2[504] = {-0.064091478343647895, 713.06177859755496, -52.018444001735702, 0.22294142549212401, 6739.1399551272798, 409.47332011602299, -4258.7085329747897, 2990.6198857571399, 2842.82174111627, -16.4362076124787, -19.6479024764561, -450.95698589104001, 1499.21617070053, 129.354086480939, -32.5623649949015, -1533.16729952379, -801.75588044433505, -1302.1490458327801, -1589.22747455529, -3895.5139631694801, 69.692448899038894, 0.0, 0.0, 0.0, 0.078717515330272506, -890.24945003874404, 61.925371835460197, -1.59301536151858, -8399.1221177311709, -504.62121099099301, 5307.6897279898503, -3725.8058949477299, -3517.1067799943698, 20.0821069369808, 23.8371292623433, 563.21704392130198, -1868.99615781019, -160.79773282728499, 40.209679175758602, 1910.8342353503599, 1000.30652221449, 1610.10305651065, 1967.2714135880001, 4853.9412977750599, -86.938972564264105, 0.0, 0.0, 0.0, 0.035772543187836597, 520.38606836760005, -37.3576026553948, 0.93824771966655895, 4913.8375731575898, 297.02078853525001, -3105.3054726097698, 2179.8383098375198, 2064.03863882426, -11.5897837400758, -13.7454041271756, -329.662381563542, 1093.32256576446, 94.164922311323394, -23.370538453071202, -1117.8490893585799, -585.07554862150903, -945.21841098621996, -1153.8443875258399, -2840.0954494666398, 50.509996472385303, 0.0, 0.0, 0.0, -0.062171023850398299, -883.91684171449401, 65.956744158981707, -0.30209264289181997, -8354.6527651622891, -510.24292797392201, 5279.5127573481996, -3708.5126037463401, -3534.1651244869099, 20.118054506627601, 24.253115792914802, 558.90980701110504, -1858.4878939499599, -160.30158683160701, 40.074632460370502, 1900.40832678587, 993.28424539653497, 1619.3228924922901, 1974.7898591375399, 4829.6374496633298, -85.861801422967005, 0.0, 0.0, 0.0, -0.045296585245108302, 503.608089249118, -37.409231418514402, 0.15972971393766999, 4760.0409737735199, 289.86000580815897, -3007.9000554557201, 2112.4472365954498, 2009.46047743586, -11.620588884143499, -13.435110153350299, -318.37193513541001, 1059.1982996055399, 91.392671066014998, -23.013250839168599, -1083.0984474979, -566.25418012298701, -920.44766441625598, -1123.03275109381, -2751.24966532286, 49.134449946833101, 0.0, 0.0, 0.0, -0.050574070850706303, -735.268788752521, 52.034324888924203, -1.3246973887217, -6942.4299970826296, -419.091569409214, 4387.0782989889804, -3079.7112127626101, -2915.54203952635, 16.3862338355292, 20.069350976326799, 465.60100478088498, -1545.0790688177201, -133.05534575663401, 33.017866331913801, 1579.60766417078, 826.67092177544703, 1335.1987409164999, 1630.19252491066, 4012.1274550981102, -71.423354704319806, 0.0, 0.0, 0.0, -0.00110547248442243, 66.086472294581398, -8.0640571635796796, 0.120361096092389, 643.91485283159295, 47.038233657028698, -406.863770451839, 288.91657765213398, 305.14483180816802, 0.028924090527909001, -2.4114842655012301, -39.3897517070086, 140.96244082771301, 13.290701732299899, -2.82866188450281, -144.284041440354, -74.462522726873601, -141.49789272768501, -167.03129270601499, -373.94726486427999, 5.3217330886365399, 0.0, 0.0, 0.0, 0.00169058806401361, -100.681182204012, 9.9438606966790992, -0.16071917417936801, -947.22789644116904, -62.1819544991477, 598.507402482923, -421.456732120239, -417.90099350750501, -0.071547956877298299, 3.03910354158063, 58.825827638175099, -207.18138234350499, -16.8210784946065, 3.4953362885853601, 212.690544720802, 112.99993227712, 192.20097004017899, 232.57136070342199, 549.86422579734096, -7.9115450643297303, 0.0, 0.0, 0.0, 0.00031167490112610501, 16.5702800434129, -0.96427444933400797, 0.017530807484877599, 153.70562899881901, 7.4253775224466096, -97.164535381519997, 68.391115404813903, 58.880541272935403, -0.00395431753418613, -0.27710621824447701, -6.5580129619132999, 32.685848366303901, 3.4769501442949502, -1.3237352902339601, -33.496400026660503, -18.678955342199799, -26.814344384641199, -34.430890540207301, -88.9250347843996, 1.51194685980572, 0.0, 0.0, 0.0, 0.00045214452900354401, 37.241126324245002, 0.56653388165982099, -0.0153845901652373, 340.71285233348101, 15.613889705904301, -215.25964333041301, 151.26187968817001, 126.42681477968, 0.012659113756634199, -0.62711870198964903, -16.4637553538752, 71.986464894089806, 5.1001819045344803, -2.8075780414188398, -75.205305646206597, -41.656360989756003, -57.009250230864701, -71.671627817787495, -198.46090263475699, 5.47499644859007, 0.0, 0.0, 0.0, 0.00085034576532286798, -48.324269416315303, 9.5426055788579802, -0.11918347900064399, -478.70065330731398, -38.914234951661598, 302.33505716911202, -216.13813506153201, -246.345286296176, 0.0018122457897085001, 2.0086911418790101, 27.577828210674401, -102.039313769876, -10.0857520350279, 1.94810040129421, 105.928854388454, 54.502095992205597, 115.30853907215899, 134.79460379303401, 280.65999252254602, -3.2448445639062502, 0.0, 0.0, 0.0, -0.00017551641849241999, -35.157826546458601, -5.8891909991296698, 0.051680022896045397, -316.44550618039898, -5.0414187570711899, 200.212034255265, -135.39535162931199, -69.139114300097802, -0.16142175154882901, -0.0102013166269541, 31.668569875843001, -76.263188383823703, -5.0017512656630601, 2.0769594366589001, 76.002080804042095, 39.333282449810902, 30.0808204248134, 43.085264407243301, 177.27763312527699, -5.4457981556032404, 0.0, 0.0, 0.0, -0.000306806291909659, -47.201229402180303, -1.2172052207398101, -0.0186567796198484, -436.83683166616999, -19.215912540534301, 276.031946309869, -192.67292600019499, -154.03017691774701, -0.042507166509503203, 0.76934514300024204, 23.977306301563999, -92.169363151535805, -9.1886362611435199, 3.1760937062011898, 95.958352522850603, 53.119118943843198, 68.432833843960694, 88.505438350444805, 253.98266241440601, -5.1028992571309599, 0.0, 0.0, 0.0, 0.00043306496689241199, -45.515914649852498, 4.5704850382447297, -0.071472003061512898, -427.071656721686, -27.901412337784699, 269.85362292975498, -190.66655819995299, -192.761246218769, -0.0556222307934695, 1.3484518181471401, 29.668595531405, -94.026613967410796, -7.9849268838018501, 2.0615436543321501, 95.338384205774105, 51.130038963438999, 88.724620902414898, 106.181452502913, 248.269046435468, -3.6638133123307002, 0.0, 0.0, 0.0, 0.00067386198047795695, 2.86001067576094, -1.83043518435104, 0.020675455904269301, 37.761848158240802, 6.8832167853114203, -24.015453768006701, 13.4834243521102, 35.324760224278002, 0.035792229507666501, -0.41862408163183901, -10.0509290141389, 13.5759504464113, 1.8922504612450599, -1.8614272588155001, -12.132753308102799, -3.3789310584400698, -17.244465911049499, -18.4686894621614, -17.916485915275999, 0.17564274753793899, 0.0, 0.0, 0.0, -4.5499005275636101e-05, -31.614155756215101, -1.4091932535724401, -0.0060978442331452703, -292.99139921717801, -12.827598964788001, 185.144804328112, -128.77786179229901, -100.295349372036, -0.046207312260184701, 0.53169799203163903, 17.4856359712815, -63.3488322133691, -5.98125785658572, 1.9892546441005501, 64.233075829740997, 35.5568060355128, 46.269165313517597, 57.338723422189801, 170.63201646028199, -3.5806585828097099, 0.0, 0.0, 0.0, 8.4039919523263399e-05, -4.0615650791823299, -3.4362521652092002, 0.011295419555382699, -39.6150470544694, 1.5105032334831401, 25.1537606371501, -15.330979335618601, -6.5084614221869197, -0.0083199111964546105, -0.17722199841012101, 2.9230666468463902, -7.7291578970740504, -0.59428543237974696, 0.082803013560185101, 7.2521932229389696, 4.54510970987024, 2.43118215251519, 4.7389061057811901, 21.734306554021401, -0.85611719611089199, 0.0, 0.0, 0.0, -0.00025843236821193301, 52.817220161181702, -0.92129495231099501, 0.0263320504370466, 499.75948842769702, 24.448830234480202, -315.90847327586999, 219.760367065808, 186.369999846479, 0.12893364165019799, -1.03733562237538, -39.542133782410801, 114.562973083925, 9.1887926425616406, -2.6272948799917999, -114.688259732943, -59.320103692053301, -83.386175100226296, -106.311499516864, -287.23025749328701, 5.8899806135276798, 0.0, 0.0, 0.0, 0.00029561730769906699, 28.2443444301325, 0.262667708054178, -0.0092881180472059802, 254.39556062397901, 13.3246994983259, -160.662465459228, 115.19312959924299, 97.930045120340793, 0.0140106353296333, -0.58271028141190895, -12.237212046379099, 52.1658593813167, 3.7250252932039301, -2.2830256115872798, -54.084720909199703, -31.577318042678201, -44.3507306279147, -56.3876021769941, -150.29869271905301, 4.1969751871532797, 0.0, 0.0, 0.0, -3.5190977196700897e-05, 0.47111547837818402, 2.2068800929897598, -0.0070758873430103201, 0.13945915693743799, -1.8492037922933, -0.025671220257021801, 0.97970429288930505, -2.6130342276240199, 0.0060078182170399397, 0.15015803890865601, -0.18094310755408499, 0.92201583351316796, 0.051038179907958503, 0.030519047562509002, -1.2927339475995701, -0.52344231597663404, 1.4918374263167999, 0.861619645390301, -0.52697347953005502, 0.27598012654535198, 0.0, 0.0, 0.0, -0.00073600321123188305, 57.569266190747499, 7.3278228968032701, -0.093258163105288297, 515.79957938656798, 10.8090738278263, -326.16130596512397, 222.642609875217, 129.33494256044199, 0.16458397773696601, -0.115854395362115, -39.1805516577625, 116.41448940344399, 9.4017853746533593, -1.32916748411286, -117.572672890536, -64.549778160481395, -55.365507632190301, -79.081290004649304, -294.59516563799099, 9.8243907421444003, 0.0, 0.0, 0.0}; const uint64_t N_updates3 = 3; const uint64_t Updates_index3[3] = {12, 13, 21}; const double Updates3[72] = {-0.32320992089807998, -0.1768221333622936, -0.044189138920046375, -0.0083658993244170032, -0.13345118239521958, -0.088903807103633908, -0.25946535170078289, 0.14435659933042233, -0.21090563386678701, 0.019084170460701003, 0.073579406365752206, -0.013528384268283893, 0.031103432178496981, -0.25866857916116798, 0.022464506328106093, 0.032419085502625011, -0.083496315404772786, -0.392626002430916, -0.057606873102486092, 0.1326765250414613, 0.034384071826935009, 0.0, 0.0, 0.0, 0.25532682985067379, -0.025051936507225009, 0.17769842967391061, 0.080573752522469011, 0.11870069429278349, 0.35069981217384349, 0.127604305744171, -0.081144510089870836, -0.04023376852273898, 0.0045312587171792984, 0.017237693071365301, 0.0386847481131554, -0.21935135498642899, 0.040930040180683996, -0.057743255048990395, -0.289656192064286, 0.26965582184493592, 0.257760990411043, -0.1886596158146856, -0.036238497123122194, -0.1386065091937782, 0.0, 0.0, 0.0, 0.0015524076297879202, -0.1212832294404507, 0.028310360386967659, -0.005844349274411801, 0.0046449899673459971, 0.044258039444684996, 0.0025386139750480999, 0.0354412645101548, 0.064816890284419101, 0.1017611473798752, -0.25162110477685901, -0.0285851191729307, -0.024413086473941803, -0.22420015186071351, 0.059393912553786996, 0.04153373837471, 0.01215143408626318, 0.203658737242222, -0.0020150262862444011, -0.037645858246833121, 0.0714646056294439, 0.0, 0.0, 0.0}; const double Slater3[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.028107110410928698, 0.0080896317958831804, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, 0.174509197473526, -0.0599150508642197, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, 0.044309988617896999, 0.0096954777836799604, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, -0.015649655833840401, -0.00653020711615682, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.00089795450912788499, 0.10536465793848, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.0114687560126185, 0.027113301679492, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.000334969052346423, 0.030707944184541699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.020809086039662399, 0.0544226132333279, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.0072047915309667596, 0.041792899370193502, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.21170908212661699, 0.043612048029899597, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, 0.00210775528103113, -0.12754787504673001, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, -0.012914831750094899, -0.0478814952075481, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, -0.00059447408420965097, -0.092382267117500305, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.204596728086472, -0.089926846325397505, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, 0.096327632665634197, -0.10392674803733799, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.0109922774136066, 0.17250911891460399, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.0301918238401413, 0.00962609611451626, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.0024164030328393, 0.115568056702614, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.030398890376091, 0.0136762224137783, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, -0.0045813838951289697, -0.030651951208710702, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, 0.13371524214744601, 0.14154277741908999}; // WB3 - double Slater_inv3_1[504] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.0, 0.0, 0.0, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.0, 0.0, 0.0, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, 0.0, 0.0, 0.0, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, 0.0, 0.0, 0.0, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, 0.0, 0.0, 0.0, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, 0.0, 0.0, 0.0, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.0, 0.0, 0.0, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.0, 0.0, 0.0, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.0, 0.0, 0.0, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.0, 0.0, 0.0, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, 0.0, 0.0, 0.0, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, 0.0, 0.0, 0.0, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.0, 0.0, 0.0, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, 0.0, 0.0, 0.0, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 0.0, 0.0, 0.0, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.0, 0.0, 0.0, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.0, 0.0, 0.0, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, 0.0, 0.0, 0.0, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, 0.0, 0.0, 0.0, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 0.0, 0.0, 0.0, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604, 0.0, 0.0, 0.0}; + // double Slater_inv3_1[504] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.0, 0.0, 0.0, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.0, 0.0, 0.0, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, 0.0, 0.0, 0.0, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, 0.0, 0.0, 0.0, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, 0.0, 0.0, 0.0, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, 0.0, 0.0, 0.0, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.0, 0.0, 0.0, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.0, 0.0, 0.0, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.0, 0.0, 0.0, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.0, 0.0, 0.0, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, 0.0, 0.0, 0.0, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, 0.0, 0.0, 0.0, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.0, 0.0, 0.0, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, 0.0, 0.0, 0.0, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 0.0, 0.0, 0.0, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.0, 0.0, 0.0, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.0, 0.0, 0.0, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, 0.0, 0.0, 0.0, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, 0.0, 0.0, 0.0, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 0.0, 0.0, 0.0, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604, 0.0, 0.0, 0.0}; // SM+spl double Slater_inv3_2[504] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.0, 0.0, 0.0, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.0, 0.0, 0.0, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, 0.0, 0.0, 0.0, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, 0.0, 0.0, 0.0, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, 0.0, 0.0, 0.0, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, 0.0, 0.0, 0.0, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.0, 0.0, 0.0, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.0, 0.0, 0.0, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.0, 0.0, 0.0, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.0, 0.0, 0.0, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, 0.0, 0.0, 0.0, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, 0.0, 0.0, 0.0, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.0, 0.0, 0.0, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, 0.0, 0.0, 0.0, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 0.0, 0.0, 0.0, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.0, 0.0, 0.0, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.0, 0.0, 0.0, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, 0.0, 0.0, 0.0, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, 0.0, 0.0, 0.0, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 0.0, 0.0, 0.0, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604, 0.0, 0.0, 0.0}; - const uint64_t N_updates5 = 5; - const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; - const double Updates5[120] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.0, 0.0, 0.0, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, 0.0, 0.0, 0.0, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, 0.0, 0.0, 0.0, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, 0.0, 0.0, 0.0, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121, 0.0, 0.0, 0.0}; - const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; - double Slater_inv5[504] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.0, 0.0, 0.0, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.0, 0.0, 0.0, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, 0.0, 0.0, 0.0, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, 0.0, 0.0, 0.0, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, 0.0, 0.0, 0.0, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, 0.0, 0.0, 0.0, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.0, 0.0, 0.0, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.0, 0.0, 0.0, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.0, 0.0, 0.0, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.0, 0.0, 0.0, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, 0.0, 0.0, 0.0, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, 0.0, 0.0, 0.0, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, 0.0, 0.0, 0.0, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.0, 0.0, 0.0, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, 0.0, 0.0, 0.0, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.0, 0.0, 0.0, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.0, 0.0, 0.0, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, 0.0, 0.0, 0.0, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, 0.0, 0.0, 0.0, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, 0.0, 0.0, 0.0, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799, 0.0, 0.0, 0.0}; + // const uint64_t N_updates5 = 5; + // const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; + // const double Updates5[120] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.0, 0.0, 0.0, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, 0.0, 0.0, 0.0, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, 0.0, 0.0, 0.0, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, 0.0, 0.0, 0.0, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121, 0.0, 0.0, 0.0}; + // const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; + // double Slater_inv5[504] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.0, 0.0, 0.0, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.0, 0.0, 0.0, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, 0.0, 0.0, 0.0, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, 0.0, 0.0, 0.0, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, 0.0, 0.0, 0.0, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, 0.0, 0.0, 0.0, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.0, 0.0, 0.0, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.0, 0.0, 0.0, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.0, 0.0, 0.0, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.0, 0.0, 0.0, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, 0.0, 0.0, 0.0, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, 0.0, 0.0, 0.0, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, 0.0, 0.0, 0.0, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.0, 0.0, 0.0, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, 0.0, 0.0, 0.0, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.0, 0.0, 0.0, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.0, 0.0, 0.0, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, 0.0, 0.0, 0.0, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, 0.0, 0.0, 0.0, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, 0.0, 0.0, 0.0, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799, 0.0, 0.0, 0.0}; #elif (SIMD_LENGTH == 2) const uint64_t N_updates1 = 1; const uint64_t Updates_index1[1] = {21}; @@ -31,25 +31,25 @@ const double Slater1[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, 0.0065372241660952603, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, 0.061368178576231003, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0186148826032877, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, -0.00068585784174501896, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, 0.10071966797113401, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017144737765192999, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, 0.028169330209493599, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.0189813487231731, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, -0.023023990914225599, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.0581490993499756, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, 0.12407322973012901, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, -0.0192963760346174, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, -0.067969180643558502, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.134273305535316, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.16332066059112499, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, 0.13097538053989399, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.0025253379717469198, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.088090680539608002, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.015691248700022701, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0069939070381224199, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, 0.070078171789646093}; double Slater_inv1[462] = {-0.0525082963130096, -192.960477122746, -167.343357271998, 1.69063377058866, -1378.4882402189, 239.360652372684, 874.40192183061697, -513.31846478968203, 807.35483045933495, -19.026422090297299, -17.824591748935202, 165.6645926386, -332.909289060628, -18.6107453916377, -11.6439930601979, 317.18559450822198, 214.12532640356201, -430.80943299473, -344.65005510575799, 740.81014093255203, -84.923325284754696, 0.0, 0.064335245989650805, 234.71397330210399, 205.1186636226, -3.4153770027768502, 1680.13890084581, -293.40065007215702, -1065.8419078679401, 624.86259814866003, -989.76729197131897, 23.298249286417001, 21.573213707404399, -202.41174445438401, 405.86421806904502, 22.922945938042901, 14.236362125535999, -386.65825218682801, -261.06337565261498, 528.20337075570103, 421.94063881187702, -902.75507799084596, 105.03985525163, 0.0, 0.044200668381308601, -138.85152101714399, -121.27002019292, 2.0061662585667599, -992.69022926063894, 173.24384564131401, 629.63518796071799, -369.68832373377103, 582.99742710801104, -13.474468953452901, -12.4187314531643, 119.002229516372, -239.76386110607999, -13.4968690647037, -8.1499663302329708, 228.499936475189, 154.09732894897101, -311.21651724011002, -248.26815844269399, 533.37480106787098, -61.991136485706697, 0.0, -0.0765497914729725, 240.772681546397, 209.115172008988, -2.12401058528051, 1722.15420882834, -299.07379390801702, -1092.4670851015201, 641.09661184520598, -1007.44097957056, 23.333413806919001, 21.9897514440317, -206.53257016044699, 415.81861108697302, 23.3743606050752, 14.107639254523001, -396.52477956346598, -267.77854087146301, 537.68662188870303, 429.83533323670702, -925.65731644586003, 106.070284414301, 0.0, -0.037109975520249097, -136.738457148886, -118.917063549582, 1.19704609156923, -977.22998951029899, 169.63000196416201, 620.01253859081601, -364.02043006288699, 570.85982682561803, -13.451266756380299, -12.146454471873501, 117.435790064483, -235.687342903548, -13.183975346097, -8.2288378293500593, 224.66974233421601, 151.73703725446899, -304.613662218336, -243.40661913323399, 525.55077671846004, -60.142862384234697, 0.0, -0.062476778936209301, 195.74640208908301, 170.54051550313201, -2.8328765312753998, 1399.12576024585, -244.28628529648901, -887.63077081451104, 520.884480704167, -823.92607500410702, 19.0479002693959, 18.195743596123101, -168.030291787452, 337.586201042798, 18.991146825575299, 11.5224539224244, -321.78784999564101, -217.23371709456501, 439.82292557372398, 351.28300986264401, -752.091241883468, 87.457548717202599, 0.0, 4.3572379528639997e-05, -23.790404094575401, -19.504220922406098, 0.26595531593048999, -161.34910319146201, 30.163156787264001, 102.337776116854, -58.672051676794297, 103.227708063905, -0.22802366652163999, -2.2306129106953398, 21.778747237132102, -40.783330246607299, -1.38732280869919, -0.75357165711863805, 39.269880423319599, 26.312297182321299, -55.061514171221297, -43.569942636118199, 85.973367077774896, -10.016061028885201, 0.0, 4.0427159001010801e-05, 28.392374743152502, 26.373254860492299, -0.36980926031100297, 209.22398819265001, -37.9473984838014, -132.76472733653301, 77.720615205630693, -127.924723556082, 0.29745864731730998, 2.7793514223195599, -29.019189334306802, 53.826499495808498, 4.2582570650914597, 0.51526747227423098, -50.914050124737102, -31.724328055085401, 68.0683646567051, 55.266627392249198, -110.63482872154501, 14.1152956761065, 0.0, 0.00055720168222872903, -2.6345228739497299, -3.4087974363069198, 0.048641237778327802, -18.3623844122964, 3.8195276251277801, 11.6411523542838, -5.8812824661877396, 15.735088038012799, -0.058858662594294599, -0.23845780430312999, 6.5124119812799099, -6.1494099868393697, 0.340564236694477, -0.880332042883611, 5.7252222161672197, 2.8545094725865199, -8.3447036743893506, -8.0497901808946395, 9.3503553819376606, -1.76541796469797, 0.0, 0.00098753020434672305, -4.6360828892267198, -4.7638931470942598, 0.052453544062221497, -34.4916331053766, 7.7511206271403301, 21.997597399118899, -10.6934789694381, 32.345600850876203, -0.10706305963427901, -0.54284354835464799, 12.037079682564, -12.6961140374279, -1.7388931639227301, -1.8407110220006899, 10.3197626100112, 5.2986332905796001, -16.735105713526099, -14.146077371772099, 15.8344011098352, -1.6714914906603899, 0.0, -4.8622590537520702e-05, 21.991930004831101, 18.4929481874854, -0.23309077760739899, 151.30678790823001, -25.711826077506299, -96.044580982176896, 55.801793853982701, -88.373121372798394, 0.202838254384864, 1.86718437434255, -20.278044655055201, 40.151563308198597, 1.3977678891012399, 0.324629892441265, -37.6766500842932, -24.340233848932201, 47.6840523743628, 38.2032083073968, -79.164159949210401, 8.7548536140586801, 0.0, -0.00061993571816668601, -0.395895385274183, -1.4644468265008701, -0.0046318612148825598, -4.9913109472233304, 1.48540197873744, 3.26672618350988, -0.95752411931703396, 8.9569370743490193, -0.062041348029879102, -0.080157437015122804, 8.0102582504767295, -5.9688675669055504, 0.67530938859376199, 1.27437097858607, 5.0084164430027203, 0.35632315612076498, -3.3504197552733501, -4.6662276852701501, -0.607157596121083, 0.48644342530280699, 0.0, -0.00097211385626449695, 4.8383102174293198, 5.4067550135312503, -0.10295717451613901, 29.4184191533957, -9.4450875338250793, -18.800441303291901, 8.5840933132932609, -37.118301659976296, 0.106267952523929, 0.66461896188866798, -11.4398182377096, 13.0631130369628, -0.68992479801260798, 1.9745973431694701, -10.3210596342876, -5.2304303953711804, 18.385374172705902, 17.020178998151501, -12.315621520081001, 3.7778248703987298, 0.0, -0.00031338187670125201, 12.870239622711001, 12.0022872209785, -0.16605346741786001, 96.046941246958397, -16.9389614709639, -60.935799758442698, 35.1352737141356, -61.591085318216102, 0.111297136966112, 1.23095348877198, -10.067914675180299, 24.0397569908422, 1.55026659084186, 0.71351574089035996, -23.902604464805101, -14.335678342218401, 32.573495764200203, 25.978026199263301, -50.506323253986302, 6.2999821545807402, 0.0, 0.00078010309855064104, -5.4500389454791298, -2.8881970061941198, 0.034137151949219097, -36.693158530832299, 5.3229408635849698, 23.065511761726999, -18.654750377009499, 16.655427409154399, 0.0120347437456702, -0.40190064848770302, -4.3952667136196499, -3.2283315530947299, 0.535114819933451, -1.6695636399303999, 4.8387109899640901, 5.9387464984757097, -9.2525260067921593, -7.0534068376986703, 24.6079478080533, -1.24249543569277, 0.0, -0.00048592251459139902, 2.8352295963632699, 2.97576788056818, -0.061903426111554402, 15.662499828725799, -6.3594611155842697, -10.0297611955082, 4.4512302388898801, -22.9014624835775, 0.0522795583755256, 0.46237084970893699, -5.9599628993498204, 6.3134697655201197, -0.35523986461548501, 1.1938822885348901, -6.1222818696018599, -3.0697099757554498, 13.1385066502153, 10.0165667609847, -5.6534055293581504, 2.2982459946613698, 0.0, 5.71641932114923e-05, -1.95937881355126, -3.1686710464991501, 0.0078900256254279908, -20.7802266137845, 1.9052049215289899, 13.243728372567, -7.2010122960325198, -1.78569599703996, -0.0023099999984344298, -0.181452511231602, 1.49235850994062, -3.4781928086271598, -0.25097197027097001, 0.034267435208927201, 2.9589361689912899, 2.1880246525605398, 0.40946783452396801, 1.85119165819145, 10.9769363093921, -0.49737197226351498, 0.0, 0.00057014015696656801, -11.992703942957201, -9.1707599397024797, 0.13131957021746299, -80.913738884742898, 12.2802670275716, 51.275110674413497, -30.8846663544597, 40.768216707846101, -0.056350552707040001, -0.906909874969271, 4.5662724440002496, -16.493313057723601, -1.3954832548549501, -1.1309540462973, 17.671878079289101, 13.348292143643, -21.057182826114602, -17.2839203520208, 44.417018731905799, -5.1700529859646398, 0.0, 0.00070585484241785499, -3.84393110623766, -3.8217546887026601, 0.042692631956155899, -33.103657623136797, 7.29987823117549, 21.1351246026951, -8.9046379168685696, 25.840620537279499, -0.077726091155589205, -0.51813471867742, 9.6014602253082906, -12.721891663249099, -1.51539376366047, -1.54216689848713, 11.448584843886, 4.4017938077693604, -13.490798207962101, -12.3088359993453, 13.904387711973399, -1.27899798343336, 0.0, -4.8529590100271397e-05, 1.5144453784960501, 2.3396824932439499, -0.0087660084169081508, 9.4873136503254205, -1.65331055509645, -5.9367044032646401, 5.0146643904078898, -0.269092370588084, 0.0089905796176170498, 0.14805840549764701, -0.89101366694270501, 3.0317998491567302, 0.22142707740346401, 0.0064304970181167601, -3.4235077646052301, -1.69328028781498, 0.48844632252065601, -0.57157344288643996, -5.8659323559885497, 0.45402791645044299, 0.0, 3.1177001030445297e-05, -2.4386266852651501, -0.31040563209251798, 0.0039504037521311498, -21.849203607580201, -0.45787097219896, 13.8161508224212, -9.4311122174081508, -5.4786114733527702, -0.0069717560537701602, 0.0049075772339915403, 1.65968311111433, -4.9313027452898597, -0.39825841496395797, 0.056303363068839998, 4.9803632483141103, 2.7343202713150898, 2.3452757571679799, 3.3498732374241098, 12.4790131924658, -0.41615992378439798, 0.0}; - const uint64_t Updates_index2[2] = {20, 21}; - const double Updates2[44] = {-0.012056605890393198, 0.072118259966373, -0.14986032247543299, -0.023892195895314251, 0.2306191368843431, 0.070976656861603302, 0.059228850266663378, -0.0081594046205282003, 0.03775668889284136, -0.32248186320066397, -0.30175055470317586, -0.048578753136098399, -0.050512738234829151, 0.074964269995690003, 0.022375471889972701, 0.20063611492514641, -0.013817949220538101, 0.034675425849854905, 0.14269321411848099, 0.16303040878847203, 0.20520395040512121, 0.0, 0.027209745720028898, -0.019752152264117806, 0.24686626344919221, 0.021544795483350802, 0.0053255971870385145, -0.074287162162363515, 0.0020896954229101539, -0.0015901625156403004, 0.045653678011149175, -0.095019596163183437, 0.015724316006526361, 0.057632524985820083, 0.0043175870669074383, -0.075611688196659296, -0.2787729352712634, 0.071667610667645931, -0.0016040895134210986, -0.018613442778587338, 0.16365851461887351, 0.018654582090675831, -0.43227782845497098, 0.0}; - const double Slater2[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.028107110410928698, 0.013431881554424799, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.174509197473526, 0.085864908993244199, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.044309988617896999, 0.215069741010666, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, -0.015649655833840401, 0.011034868657589, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.00089795450912788499, 0.0060455044731497799, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.0114687560126185, -0.066873423755168901, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.000334969052346423, 0.0023343940265476699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.020809086039662399, -0.039619617164135, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, 0.0072047915309667596, 0.043619588017463698, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, -0.21170908212661699, 0.0024762949906289599, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.00210775528103113, 0.0140155302360654, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, -0.012914831750094899, 0.058629415929317502, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, -0.00059447408420965097, 0.00458275340497494, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.204596728086472, 0.091698803007602706, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.096327632665634197, -0.084247380495071397, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.0109922774136066, 0.077829994261264801, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.0301918238401413, -0.017013777047395699, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.0024164030328393, -0.017579320818185799, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, 0.030398890376091, 0.14741712808609, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.0045813838951289697, 0.024331344291567799, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, 0.13371524214744601, -0.19178953766822801}; - double Slater_inv2[462] = {-0.064091478343647895, 713.06177859755496, -52.018444001735702, 0.22294142549212401, 6739.1399551272798, 409.47332011602299, -4258.7085329747897, 2990.6198857571399, 2842.82174111627, -16.4362076124787, -19.6479024764561, -450.95698589104001, 1499.21617070053, 129.354086480939, -32.5623649949015, -1533.16729952379, -801.75588044433505, -1302.1490458327801, -1589.22747455529, -3895.5139631694801, 69.692448899038894, 0.0, 0.078717515330272506, -890.24945003874404, 61.925371835460197, -1.59301536151858, -8399.1221177311709, -504.62121099099301, 5307.6897279898503, -3725.8058949477299, -3517.1067799943698, 20.0821069369808, 23.8371292623433, 563.21704392130198, -1868.99615781019, -160.79773282728499, 40.209679175758602, 1910.8342353503599, 1000.30652221449, 1610.10305651065, 1967.2714135880001, 4853.9412977750599, -86.938972564264105, 0.0, 0.035772543187836597, 520.38606836760005, -37.3576026553948, 0.93824771966655895, 4913.8375731575898, 297.02078853525001, -3105.3054726097698, 2179.8383098375198, 2064.03863882426, -11.5897837400758, -13.7454041271756, -329.662381563542, 1093.32256576446, 94.164922311323394, -23.370538453071202, -1117.8490893585799, -585.07554862150903, -945.21841098621996, -1153.8443875258399, -2840.0954494666398, 50.509996472385303, 0.0, -0.062171023850398299, -883.91684171449401, 65.956744158981707, -0.30209264289181997, -8354.6527651622891, -510.24292797392201, 5279.5127573481996, -3708.5126037463401, -3534.1651244869099, 20.118054506627601, 24.253115792914802, 558.90980701110504, -1858.4878939499599, -160.30158683160701, 40.074632460370502, 1900.40832678587, 993.28424539653497, 1619.3228924922901, 1974.7898591375399, 4829.6374496633298, -85.861801422967005, 0.0, -0.045296585245108302, 503.608089249118, -37.409231418514402, 0.15972971393766999, 4760.0409737735199, 289.86000580815897, -3007.9000554557201, 2112.4472365954498, 2009.46047743586, -11.620588884143499, -13.435110153350299, -318.37193513541001, 1059.1982996055399, 91.392671066014998, -23.013250839168599, -1083.0984474979, -566.25418012298701, -920.44766441625598, -1123.03275109381, -2751.24966532286, 49.134449946833101, 0.0, -0.050574070850706303, -735.268788752521, 52.034324888924203, -1.3246973887217, -6942.4299970826296, -419.091569409214, 4387.0782989889804, -3079.7112127626101, -2915.54203952635, 16.3862338355292, 20.069350976326799, 465.60100478088498, -1545.0790688177201, -133.05534575663401, 33.017866331913801, 1579.60766417078, 826.67092177544703, 1335.1987409164999, 1630.19252491066, 4012.1274550981102, -71.423354704319806, 0.0, -0.00110547248442243, 66.086472294581398, -8.0640571635796796, 0.120361096092389, 643.91485283159295, 47.038233657028698, -406.863770451839, 288.91657765213398, 305.14483180816802, 0.028924090527909001, -2.4114842655012301, -39.3897517070086, 140.96244082771301, 13.290701732299899, -2.82866188450281, -144.284041440354, -74.462522726873601, -141.49789272768501, -167.03129270601499, -373.94726486427999, 5.3217330886365399, 0.0, 0.00169058806401361, -100.681182204012, 9.9438606966790992, -0.16071917417936801, -947.22789644116904, -62.1819544991477, 598.507402482923, -421.456732120239, -417.90099350750501, -0.071547956877298299, 3.03910354158063, 58.825827638175099, -207.18138234350499, -16.8210784946065, 3.4953362885853601, 212.690544720802, 112.99993227712, 192.20097004017899, 232.57136070342199, 549.86422579734096, -7.9115450643297303, 0.0, 0.00031167490112610501, 16.5702800434129, -0.96427444933400797, 0.017530807484877599, 153.70562899881901, 7.4253775224466096, -97.164535381519997, 68.391115404813903, 58.880541272935403, -0.00395431753418613, -0.27710621824447701, -6.5580129619132999, 32.685848366303901, 3.4769501442949502, -1.3237352902339601, -33.496400026660503, -18.678955342199799, -26.814344384641199, -34.430890540207301, -88.9250347843996, 1.51194685980572, 0.0, 0.00045214452900354401, 37.241126324245002, 0.56653388165982099, -0.0153845901652373, 340.71285233348101, 15.613889705904301, -215.25964333041301, 151.26187968817001, 126.42681477968, 0.012659113756634199, -0.62711870198964903, -16.4637553538752, 71.986464894089806, 5.1001819045344803, -2.8075780414188398, -75.205305646206597, -41.656360989756003, -57.009250230864701, -71.671627817787495, -198.46090263475699, 5.47499644859007, 0.0, 0.00085034576532286798, -48.324269416315303, 9.5426055788579802, -0.11918347900064399, -478.70065330731398, -38.914234951661598, 302.33505716911202, -216.13813506153201, -246.345286296176, 0.0018122457897085001, 2.0086911418790101, 27.577828210674401, -102.039313769876, -10.0857520350279, 1.94810040129421, 105.928854388454, 54.502095992205597, 115.30853907215899, 134.79460379303401, 280.65999252254602, -3.2448445639062502, 0.0, -0.00017551641849241999, -35.157826546458601, -5.8891909991296698, 0.051680022896045397, -316.44550618039898, -5.0414187570711899, 200.212034255265, -135.39535162931199, -69.139114300097802, -0.16142175154882901, -0.0102013166269541, 31.668569875843001, -76.263188383823703, -5.0017512656630601, 2.0769594366589001, 76.002080804042095, 39.333282449810902, 30.0808204248134, 43.085264407243301, 177.27763312527699, -5.4457981556032404, 0.0, -0.000306806291909659, -47.201229402180303, -1.2172052207398101, -0.0186567796198484, -436.83683166616999, -19.215912540534301, 276.031946309869, -192.67292600019499, -154.03017691774701, -0.042507166509503203, 0.76934514300024204, 23.977306301563999, -92.169363151535805, -9.1886362611435199, 3.1760937062011898, 95.958352522850603, 53.119118943843198, 68.432833843960694, 88.505438350444805, 253.98266241440601, -5.1028992571309599, 0.0, 0.00043306496689241199, -45.515914649852498, 4.5704850382447297, -0.071472003061512898, -427.071656721686, -27.901412337784699, 269.85362292975498, -190.66655819995299, -192.761246218769, -0.0556222307934695, 1.3484518181471401, 29.668595531405, -94.026613967410796, -7.9849268838018501, 2.0615436543321501, 95.338384205774105, 51.130038963438999, 88.724620902414898, 106.181452502913, 248.269046435468, -3.6638133123307002, 0.0, 0.00067386198047795695, 2.86001067576094, -1.83043518435104, 0.020675455904269301, 37.761848158240802, 6.8832167853114203, -24.015453768006701, 13.4834243521102, 35.324760224278002, 0.035792229507666501, -0.41862408163183901, -10.0509290141389, 13.5759504464113, 1.8922504612450599, -1.8614272588155001, -12.132753308102799, -3.3789310584400698, -17.244465911049499, -18.4686894621614, -17.916485915275999, 0.17564274753793899, 0.0, -4.5499005275636101e-05, -31.614155756215101, -1.4091932535724401, -0.0060978442331452703, -292.99139921717801, -12.827598964788001, 185.144804328112, -128.77786179229901, -100.295349372036, -0.046207312260184701, 0.53169799203163903, 17.4856359712815, -63.3488322133691, -5.98125785658572, 1.9892546441005501, 64.233075829740997, 35.5568060355128, 46.269165313517597, 57.338723422189801, 170.63201646028199, -3.5806585828097099, 0.0, 8.4039919523263399e-05, -4.0615650791823299, -3.4362521652092002, 0.011295419555382699, -39.6150470544694, 1.5105032334831401, 25.1537606371501, -15.330979335618601, -6.5084614221869197, -0.0083199111964546105, -0.17722199841012101, 2.9230666468463902, -7.7291578970740504, -0.59428543237974696, 0.082803013560185101, 7.2521932229389696, 4.54510970987024, 2.43118215251519, 4.7389061057811901, 21.734306554021401, -0.85611719611089199, 0.0, -0.00025843236821193301, 52.817220161181702, -0.92129495231099501, 0.0263320504370466, 499.75948842769702, 24.448830234480202, -315.90847327586999, 219.760367065808, 186.369999846479, 0.12893364165019799, -1.03733562237538, -39.542133782410801, 114.562973083925, 9.1887926425616406, -2.6272948799917999, -114.688259732943, -59.320103692053301, -83.386175100226296, -106.311499516864, -287.23025749328701, 5.8899806135276798, 0.0, 0.00029561730769906699, 28.2443444301325, 0.262667708054178, -0.0092881180472059802, 254.39556062397901, 13.3246994983259, -160.662465459228, 115.19312959924299, 97.930045120340793, 0.0140106353296333, -0.58271028141190895, -12.237212046379099, 52.1658593813167, 3.7250252932039301, -2.2830256115872798, -54.084720909199703, -31.577318042678201, -44.3507306279147, -56.3876021769941, -150.29869271905301, 4.1969751871532797, 0.0, -3.5190977196700897e-05, 0.47111547837818402, 2.2068800929897598, -0.0070758873430103201, 0.13945915693743799, -1.8492037922933, -0.025671220257021801, 0.97970429288930505, -2.6130342276240199, 0.0060078182170399397, 0.15015803890865601, -0.18094310755408499, 0.92201583351316796, 0.051038179907958503, 0.030519047562509002, -1.2927339475995701, -0.52344231597663404, 1.4918374263167999, 0.861619645390301, -0.52697347953005502, 0.27598012654535198, 0.0, -0.00073600321123188305, 57.569266190747499, 7.3278228968032701, -0.093258163105288297, 515.79957938656798, 10.8090738278263, -326.16130596512397, 222.642609875217, 129.33494256044199, 0.16458397773696601, -0.115854395362115, -39.1805516577625, 116.41448940344399, 9.4017853746533593, -1.32916748411286, -117.572672890536, -64.549778160481395, -55.365507632190301, -79.081290004649304, -294.59516563799099, 9.8243907421444003, 0.0}; + // const uint64_t Updates_index2[2] = {20, 21}; + // const double Updates2[44] = {-0.012056605890393198, 0.072118259966373, -0.14986032247543299, -0.023892195895314251, 0.2306191368843431, 0.070976656861603302, 0.059228850266663378, -0.0081594046205282003, 0.03775668889284136, -0.32248186320066397, -0.30175055470317586, -0.048578753136098399, -0.050512738234829151, 0.074964269995690003, 0.022375471889972701, 0.20063611492514641, -0.013817949220538101, 0.034675425849854905, 0.14269321411848099, 0.16303040878847203, 0.20520395040512121, 0.0, 0.027209745720028898, -0.019752152264117806, 0.24686626344919221, 0.021544795483350802, 0.0053255971870385145, -0.074287162162363515, 0.0020896954229101539, -0.0015901625156403004, 0.045653678011149175, -0.095019596163183437, 0.015724316006526361, 0.057632524985820083, 0.0043175870669074383, -0.075611688196659296, -0.2787729352712634, 0.071667610667645931, -0.0016040895134210986, -0.018613442778587338, 0.16365851461887351, 0.018654582090675831, -0.43227782845497098, 0.0}; + // const double Slater2[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.028107110410928698, 0.013431881554424799, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.174509197473526, 0.085864908993244199, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.044309988617896999, 0.215069741010666, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, -0.015649655833840401, 0.011034868657589, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.00089795450912788499, 0.0060455044731497799, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.0114687560126185, -0.066873423755168901, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.000334969052346423, 0.0023343940265476699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.020809086039662399, -0.039619617164135, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, 0.0072047915309667596, 0.043619588017463698, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, -0.21170908212661699, 0.0024762949906289599, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.00210775528103113, 0.0140155302360654, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, -0.012914831750094899, 0.058629415929317502, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, -0.00059447408420965097, 0.00458275340497494, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.204596728086472, 0.091698803007602706, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.096327632665634197, -0.084247380495071397, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.0109922774136066, 0.077829994261264801, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.0301918238401413, -0.017013777047395699, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.0024164030328393, -0.017579320818185799, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, 0.030398890376091, 0.14741712808609, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.0045813838951289697, 0.024331344291567799, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, 0.13371524214744601, -0.19178953766822801}; + // double Slater_inv2[462] = {-0.064091478343647895, 713.06177859755496, -52.018444001735702, 0.22294142549212401, 6739.1399551272798, 409.47332011602299, -4258.7085329747897, 2990.6198857571399, 2842.82174111627, -16.4362076124787, -19.6479024764561, -450.95698589104001, 1499.21617070053, 129.354086480939, -32.5623649949015, -1533.16729952379, -801.75588044433505, -1302.1490458327801, -1589.22747455529, -3895.5139631694801, 69.692448899038894, 0.0, 0.078717515330272506, -890.24945003874404, 61.925371835460197, -1.59301536151858, -8399.1221177311709, -504.62121099099301, 5307.6897279898503, -3725.8058949477299, -3517.1067799943698, 20.0821069369808, 23.8371292623433, 563.21704392130198, -1868.99615781019, -160.79773282728499, 40.209679175758602, 1910.8342353503599, 1000.30652221449, 1610.10305651065, 1967.2714135880001, 4853.9412977750599, -86.938972564264105, 0.0, 0.035772543187836597, 520.38606836760005, -37.3576026553948, 0.93824771966655895, 4913.8375731575898, 297.02078853525001, -3105.3054726097698, 2179.8383098375198, 2064.03863882426, -11.5897837400758, -13.7454041271756, -329.662381563542, 1093.32256576446, 94.164922311323394, -23.370538453071202, -1117.8490893585799, -585.07554862150903, -945.21841098621996, -1153.8443875258399, -2840.0954494666398, 50.509996472385303, 0.0, -0.062171023850398299, -883.91684171449401, 65.956744158981707, -0.30209264289181997, -8354.6527651622891, -510.24292797392201, 5279.5127573481996, -3708.5126037463401, -3534.1651244869099, 20.118054506627601, 24.253115792914802, 558.90980701110504, -1858.4878939499599, -160.30158683160701, 40.074632460370502, 1900.40832678587, 993.28424539653497, 1619.3228924922901, 1974.7898591375399, 4829.6374496633298, -85.861801422967005, 0.0, -0.045296585245108302, 503.608089249118, -37.409231418514402, 0.15972971393766999, 4760.0409737735199, 289.86000580815897, -3007.9000554557201, 2112.4472365954498, 2009.46047743586, -11.620588884143499, -13.435110153350299, -318.37193513541001, 1059.1982996055399, 91.392671066014998, -23.013250839168599, -1083.0984474979, -566.25418012298701, -920.44766441625598, -1123.03275109381, -2751.24966532286, 49.134449946833101, 0.0, -0.050574070850706303, -735.268788752521, 52.034324888924203, -1.3246973887217, -6942.4299970826296, -419.091569409214, 4387.0782989889804, -3079.7112127626101, -2915.54203952635, 16.3862338355292, 20.069350976326799, 465.60100478088498, -1545.0790688177201, -133.05534575663401, 33.017866331913801, 1579.60766417078, 826.67092177544703, 1335.1987409164999, 1630.19252491066, 4012.1274550981102, -71.423354704319806, 0.0, -0.00110547248442243, 66.086472294581398, -8.0640571635796796, 0.120361096092389, 643.91485283159295, 47.038233657028698, -406.863770451839, 288.91657765213398, 305.14483180816802, 0.028924090527909001, -2.4114842655012301, -39.3897517070086, 140.96244082771301, 13.290701732299899, -2.82866188450281, -144.284041440354, -74.462522726873601, -141.49789272768501, -167.03129270601499, -373.94726486427999, 5.3217330886365399, 0.0, 0.00169058806401361, -100.681182204012, 9.9438606966790992, -0.16071917417936801, -947.22789644116904, -62.1819544991477, 598.507402482923, -421.456732120239, -417.90099350750501, -0.071547956877298299, 3.03910354158063, 58.825827638175099, -207.18138234350499, -16.8210784946065, 3.4953362885853601, 212.690544720802, 112.99993227712, 192.20097004017899, 232.57136070342199, 549.86422579734096, -7.9115450643297303, 0.0, 0.00031167490112610501, 16.5702800434129, -0.96427444933400797, 0.017530807484877599, 153.70562899881901, 7.4253775224466096, -97.164535381519997, 68.391115404813903, 58.880541272935403, -0.00395431753418613, -0.27710621824447701, -6.5580129619132999, 32.685848366303901, 3.4769501442949502, -1.3237352902339601, -33.496400026660503, -18.678955342199799, -26.814344384641199, -34.430890540207301, -88.9250347843996, 1.51194685980572, 0.0, 0.00045214452900354401, 37.241126324245002, 0.56653388165982099, -0.0153845901652373, 340.71285233348101, 15.613889705904301, -215.25964333041301, 151.26187968817001, 126.42681477968, 0.012659113756634199, -0.62711870198964903, -16.4637553538752, 71.986464894089806, 5.1001819045344803, -2.8075780414188398, -75.205305646206597, -41.656360989756003, -57.009250230864701, -71.671627817787495, -198.46090263475699, 5.47499644859007, 0.0, 0.00085034576532286798, -48.324269416315303, 9.5426055788579802, -0.11918347900064399, -478.70065330731398, -38.914234951661598, 302.33505716911202, -216.13813506153201, -246.345286296176, 0.0018122457897085001, 2.0086911418790101, 27.577828210674401, -102.039313769876, -10.0857520350279, 1.94810040129421, 105.928854388454, 54.502095992205597, 115.30853907215899, 134.79460379303401, 280.65999252254602, -3.2448445639062502, 0.0, -0.00017551641849241999, -35.157826546458601, -5.8891909991296698, 0.051680022896045397, -316.44550618039898, -5.0414187570711899, 200.212034255265, -135.39535162931199, -69.139114300097802, -0.16142175154882901, -0.0102013166269541, 31.668569875843001, -76.263188383823703, -5.0017512656630601, 2.0769594366589001, 76.002080804042095, 39.333282449810902, 30.0808204248134, 43.085264407243301, 177.27763312527699, -5.4457981556032404, 0.0, -0.000306806291909659, -47.201229402180303, -1.2172052207398101, -0.0186567796198484, -436.83683166616999, -19.215912540534301, 276.031946309869, -192.67292600019499, -154.03017691774701, -0.042507166509503203, 0.76934514300024204, 23.977306301563999, -92.169363151535805, -9.1886362611435199, 3.1760937062011898, 95.958352522850603, 53.119118943843198, 68.432833843960694, 88.505438350444805, 253.98266241440601, -5.1028992571309599, 0.0, 0.00043306496689241199, -45.515914649852498, 4.5704850382447297, -0.071472003061512898, -427.071656721686, -27.901412337784699, 269.85362292975498, -190.66655819995299, -192.761246218769, -0.0556222307934695, 1.3484518181471401, 29.668595531405, -94.026613967410796, -7.9849268838018501, 2.0615436543321501, 95.338384205774105, 51.130038963438999, 88.724620902414898, 106.181452502913, 248.269046435468, -3.6638133123307002, 0.0, 0.00067386198047795695, 2.86001067576094, -1.83043518435104, 0.020675455904269301, 37.761848158240802, 6.8832167853114203, -24.015453768006701, 13.4834243521102, 35.324760224278002, 0.035792229507666501, -0.41862408163183901, -10.0509290141389, 13.5759504464113, 1.8922504612450599, -1.8614272588155001, -12.132753308102799, -3.3789310584400698, -17.244465911049499, -18.4686894621614, -17.916485915275999, 0.17564274753793899, 0.0, -4.5499005275636101e-05, -31.614155756215101, -1.4091932535724401, -0.0060978442331452703, -292.99139921717801, -12.827598964788001, 185.144804328112, -128.77786179229901, -100.295349372036, -0.046207312260184701, 0.53169799203163903, 17.4856359712815, -63.3488322133691, -5.98125785658572, 1.9892546441005501, 64.233075829740997, 35.5568060355128, 46.269165313517597, 57.338723422189801, 170.63201646028199, -3.5806585828097099, 0.0, 8.4039919523263399e-05, -4.0615650791823299, -3.4362521652092002, 0.011295419555382699, -39.6150470544694, 1.5105032334831401, 25.1537606371501, -15.330979335618601, -6.5084614221869197, -0.0083199111964546105, -0.17722199841012101, 2.9230666468463902, -7.7291578970740504, -0.59428543237974696, 0.082803013560185101, 7.2521932229389696, 4.54510970987024, 2.43118215251519, 4.7389061057811901, 21.734306554021401, -0.85611719611089199, 0.0, -0.00025843236821193301, 52.817220161181702, -0.92129495231099501, 0.0263320504370466, 499.75948842769702, 24.448830234480202, -315.90847327586999, 219.760367065808, 186.369999846479, 0.12893364165019799, -1.03733562237538, -39.542133782410801, 114.562973083925, 9.1887926425616406, -2.6272948799917999, -114.688259732943, -59.320103692053301, -83.386175100226296, -106.311499516864, -287.23025749328701, 5.8899806135276798, 0.0, 0.00029561730769906699, 28.2443444301325, 0.262667708054178, -0.0092881180472059802, 254.39556062397901, 13.3246994983259, -160.662465459228, 115.19312959924299, 97.930045120340793, 0.0140106353296333, -0.58271028141190895, -12.237212046379099, 52.1658593813167, 3.7250252932039301, -2.2830256115872798, -54.084720909199703, -31.577318042678201, -44.3507306279147, -56.3876021769941, -150.29869271905301, 4.1969751871532797, 0.0, -3.5190977196700897e-05, 0.47111547837818402, 2.2068800929897598, -0.0070758873430103201, 0.13945915693743799, -1.8492037922933, -0.025671220257021801, 0.97970429288930505, -2.6130342276240199, 0.0060078182170399397, 0.15015803890865601, -0.18094310755408499, 0.92201583351316796, 0.051038179907958503, 0.030519047562509002, -1.2927339475995701, -0.52344231597663404, 1.4918374263167999, 0.861619645390301, -0.52697347953005502, 0.27598012654535198, 0.0, -0.00073600321123188305, 57.569266190747499, 7.3278228968032701, -0.093258163105288297, 515.79957938656798, 10.8090738278263, -326.16130596512397, 222.642609875217, 129.33494256044199, 0.16458397773696601, -0.115854395362115, -39.1805516577625, 116.41448940344399, 9.4017853746533593, -1.32916748411286, -117.572672890536, -64.549778160481395, -55.365507632190301, -79.081290004649304, -294.59516563799099, 9.8243907421444003, 0.0}; const uint64_t N_updates3 = 3; const uint64_t Updates_index3[3] = {12, 13, 21}; const double Updates3[66] = {-0.32320992089807998, -0.1768221333622936, -0.044189138920046375, -0.0083658993244170032, -0.13345118239521958, -0.088903807103633908, -0.25946535170078289, 0.14435659933042233, -0.21090563386678701, 0.019084170460701003, 0.073579406365752206, -0.013528384268283893, 0.031103432178496981, -0.25866857916116798, 0.022464506328106093, 0.032419085502625011, -0.083496315404772786, -0.392626002430916, -0.057606873102486092, 0.1326765250414613, 0.034384071826935009, 0.0, 0.25532682985067379, -0.025051936507225009, 0.17769842967391061, 0.080573752522469011, 0.11870069429278349, 0.35069981217384349, 0.127604305744171, -0.081144510089870836, -0.04023376852273898, 0.0045312587171792984, 0.017237693071365301, 0.0386847481131554, -0.21935135498642899, 0.040930040180683996, -0.057743255048990395, -0.289656192064286, 0.26965582184493592, 0.257760990411043, -0.1886596158146856, -0.036238497123122194, -0.1386065091937782, 0.0, 0.0015524076297879202, -0.1212832294404507, 0.028310360386967659, -0.005844349274411801, 0.0046449899673459971, 0.044258039444684996, 0.0025386139750480999, 0.0354412645101548, 0.064816890284419101, 0.1017611473798752, -0.25162110477685901, -0.0285851191729307, -0.024413086473941803, -0.22420015186071351, 0.059393912553786996, 0.04153373837471, 0.01215143408626318, 0.203658737242222, -0.0020150262862444011, -0.037645858246833121, 0.0714646056294439, 0.0}; const double Slater3[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.028107110410928698, 0.0080896317958831804, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, 0.174509197473526, -0.0599150508642197, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, 0.044309988617896999, 0.0096954777836799604, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, -0.015649655833840401, -0.00653020711615682, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.00089795450912788499, 0.10536465793848, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.0114687560126185, 0.027113301679492, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.000334969052346423, 0.030707944184541699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.020809086039662399, 0.0544226132333279, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.0072047915309667596, 0.041792899370193502, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.21170908212661699, 0.043612048029899597, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, 0.00210775528103113, -0.12754787504673001, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, -0.012914831750094899, -0.0478814952075481, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, -0.00059447408420965097, -0.092382267117500305, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.204596728086472, -0.089926846325397505, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, 0.096327632665634197, -0.10392674803733799, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.0109922774136066, 0.17250911891460399, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.0301918238401413, 0.00962609611451626, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.0024164030328393, 0.115568056702614, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.030398890376091, 0.0136762224137783, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, -0.0045813838951289697, -0.030651951208710702, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, 0.13371524214744601, 0.14154277741908999}; // WB3 - double Slater_inv3_1[462] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.0, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.0, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, 0.0, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, 0.0, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, 0.0, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, 0.0, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.0, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.0, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.0, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.0, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, 0.0, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, 0.0, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.0, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, 0.0, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 0.0, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.0, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.0, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, 0.0, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, 0.0, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 0.0, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604, 0.0}; + // double Slater_inv3_1[462] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.0, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.0, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, 0.0, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, 0.0, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, 0.0, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, 0.0, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.0, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.0, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.0, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.0, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, 0.0, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, 0.0, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.0, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, 0.0, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 0.0, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.0, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.0, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, 0.0, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, 0.0, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 0.0, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604, 0.0}; // SM+spl double Slater_inv3_2[462] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.0, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.0, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, 0.0, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, 0.0, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, 0.0, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, 0.0, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.0, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.0, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.0, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.0, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, 0.0, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, 0.0, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.0, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, 0.0, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 0.0, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.0, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.0, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, 0.0, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, 0.0, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 0.0, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604, 0.0}; - const uint64_t N_updates5 = 5; - const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; - const double Updates5[110] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.0, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, 0.0, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, 0.0, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, 0.0, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121, 0.0}; - const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; - double Slater_inv5[462] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.0, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.0, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, 0.0, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, 0.0, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, 0.0, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, 0.0, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.0, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.0, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.0, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.0, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, 0.0, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, 0.0, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, 0.0, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.0, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, 0.0, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.0, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.0, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, 0.0, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, 0.0, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, 0.0, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799, 0.0}; + // const uint64_t N_updates5 = 5; + // const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; + // const double Updates5[110] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.0, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, 0.0, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, 0.0, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, 0.0, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121, 0.0}; + // const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; + // double Slater_inv5[462] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.0, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.0, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, 0.0, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, 0.0, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, 0.0, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, 0.0, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.0, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.0, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.0, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.0, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, 0.0, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, 0.0, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, 0.0, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.0, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, 0.0, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.0, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.0, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, 0.0, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, 0.0, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, 0.0, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799, 0.0}; #else const uint64_t N_updates1 = 1; const uint64_t Updates_index1[1] = {21}; @@ -57,23 +57,23 @@ const double Slater1[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, 0.0065372241660952603, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, 0.061368178576231003, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0186148826032877, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, -0.00068585784174501896, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, 0.10071966797113401, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017144737765192999, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, 0.028169330209493599, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.0189813487231731, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, -0.023023990914225599, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.0581490993499756, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, 0.12407322973012901, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, -0.0192963760346174, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, -0.067969180643558502, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.134273305535316, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.16332066059112499, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, 0.13097538053989399, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.0025253379717469198, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.088090680539608002, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.015691248700022701, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0069939070381224199, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, 0.070078171789646093}; double Slater_inv1[441] = {-0.0525082963130096, -192.960477122746, -167.343357271998, 1.69063377058866, -1378.4882402189, 239.360652372684, 874.40192183061697, -513.31846478968203, 807.35483045933495, -19.026422090297299, -17.824591748935202, 165.6645926386, -332.909289060628, -18.6107453916377, -11.6439930601979, 317.18559450822198, 214.12532640356201, -430.80943299473, -344.65005510575799, 740.81014093255203, -84.923325284754696, 0.064335245989650805, 234.71397330210399, 205.1186636226, -3.4153770027768502, 1680.13890084581, -293.40065007215702, -1065.8419078679401, 624.86259814866003, -989.76729197131897, 23.298249286417001, 21.573213707404399, -202.41174445438401, 405.86421806904502, 22.922945938042901, 14.236362125535999, -386.65825218682801, -261.06337565261498, 528.20337075570103, 421.94063881187702, -902.75507799084596, 105.03985525163, 0.044200668381308601, -138.85152101714399, -121.27002019292, 2.0061662585667599, -992.69022926063894, 173.24384564131401, 629.63518796071799, -369.68832373377103, 582.99742710801104, -13.474468953452901, -12.4187314531643, 119.002229516372, -239.76386110607999, -13.4968690647037, -8.1499663302329708, 228.499936475189, 154.09732894897101, -311.21651724011002, -248.26815844269399, 533.37480106787098, -61.991136485706697, -0.0765497914729725, 240.772681546397, 209.115172008988, -2.12401058528051, 1722.15420882834, -299.07379390801702, -1092.4670851015201, 641.09661184520598, -1007.44097957056, 23.333413806919001, 21.9897514440317, -206.53257016044699, 415.81861108697302, 23.3743606050752, 14.107639254523001, -396.52477956346598, -267.77854087146301, 537.68662188870303, 429.83533323670702, -925.65731644586003, 106.070284414301, -0.037109975520249097, -136.738457148886, -118.917063549582, 1.19704609156923, -977.22998951029899, 169.63000196416201, 620.01253859081601, -364.02043006288699, 570.85982682561803, -13.451266756380299, -12.146454471873501, 117.435790064483, -235.687342903548, -13.183975346097, -8.2288378293500593, 224.66974233421601, 151.73703725446899, -304.613662218336, -243.40661913323399, 525.55077671846004, -60.142862384234697, -0.062476778936209301, 195.74640208908301, 170.54051550313201, -2.8328765312753998, 1399.12576024585, -244.28628529648901, -887.63077081451104, 520.884480704167, -823.92607500410702, 19.0479002693959, 18.195743596123101, -168.030291787452, 337.586201042798, 18.991146825575299, 11.5224539224244, -321.78784999564101, -217.23371709456501, 439.82292557372398, 351.28300986264401, -752.091241883468, 87.457548717202599, 4.3572379528639997e-05, -23.790404094575401, -19.504220922406098, 0.26595531593048999, -161.34910319146201, 30.163156787264001, 102.337776116854, -58.672051676794297, 103.227708063905, -0.22802366652163999, -2.2306129106953398, 21.778747237132102, -40.783330246607299, -1.38732280869919, -0.75357165711863805, 39.269880423319599, 26.312297182321299, -55.061514171221297, -43.569942636118199, 85.973367077774896, -10.016061028885201, 4.0427159001010801e-05, 28.392374743152502, 26.373254860492299, -0.36980926031100297, 209.22398819265001, -37.9473984838014, -132.76472733653301, 77.720615205630693, -127.924723556082, 0.29745864731730998, 2.7793514223195599, -29.019189334306802, 53.826499495808498, 4.2582570650914597, 0.51526747227423098, -50.914050124737102, -31.724328055085401, 68.0683646567051, 55.266627392249198, -110.63482872154501, 14.1152956761065, 0.00055720168222872903, -2.6345228739497299, -3.4087974363069198, 0.048641237778327802, -18.3623844122964, 3.8195276251277801, 11.6411523542838, -5.8812824661877396, 15.735088038012799, -0.058858662594294599, -0.23845780430312999, 6.5124119812799099, -6.1494099868393697, 0.340564236694477, -0.880332042883611, 5.7252222161672197, 2.8545094725865199, -8.3447036743893506, -8.0497901808946395, 9.3503553819376606, -1.76541796469797, 0.00098753020434672305, -4.6360828892267198, -4.7638931470942598, 0.052453544062221497, -34.4916331053766, 7.7511206271403301, 21.997597399118899, -10.6934789694381, 32.345600850876203, -0.10706305963427901, -0.54284354835464799, 12.037079682564, -12.6961140374279, -1.7388931639227301, -1.8407110220006899, 10.3197626100112, 5.2986332905796001, -16.735105713526099, -14.146077371772099, 15.8344011098352, -1.6714914906603899, -4.8622590537520702e-05, 21.991930004831101, 18.4929481874854, -0.23309077760739899, 151.30678790823001, -25.711826077506299, -96.044580982176896, 55.801793853982701, -88.373121372798394, 0.202838254384864, 1.86718437434255, -20.278044655055201, 40.151563308198597, 1.3977678891012399, 0.324629892441265, -37.6766500842932, -24.340233848932201, 47.6840523743628, 38.2032083073968, -79.164159949210401, 8.7548536140586801, -0.00061993571816668601, -0.395895385274183, -1.4644468265008701, -0.0046318612148825598, -4.9913109472233304, 1.48540197873744, 3.26672618350988, -0.95752411931703396, 8.9569370743490193, -0.062041348029879102, -0.080157437015122804, 8.0102582504767295, -5.9688675669055504, 0.67530938859376199, 1.27437097858607, 5.0084164430027203, 0.35632315612076498, -3.3504197552733501, -4.6662276852701501, -0.607157596121083, 0.48644342530280699, -0.00097211385626449695, 4.8383102174293198, 5.4067550135312503, -0.10295717451613901, 29.4184191533957, -9.4450875338250793, -18.800441303291901, 8.5840933132932609, -37.118301659976296, 0.106267952523929, 0.66461896188866798, -11.4398182377096, 13.0631130369628, -0.68992479801260798, 1.9745973431694701, -10.3210596342876, -5.2304303953711804, 18.385374172705902, 17.020178998151501, -12.315621520081001, 3.7778248703987298, -0.00031338187670125201, 12.870239622711001, 12.0022872209785, -0.16605346741786001, 96.046941246958397, -16.9389614709639, -60.935799758442698, 35.1352737141356, -61.591085318216102, 0.111297136966112, 1.23095348877198, -10.067914675180299, 24.0397569908422, 1.55026659084186, 0.71351574089035996, -23.902604464805101, -14.335678342218401, 32.573495764200203, 25.978026199263301, -50.506323253986302, 6.2999821545807402, 0.00078010309855064104, -5.4500389454791298, -2.8881970061941198, 0.034137151949219097, -36.693158530832299, 5.3229408635849698, 23.065511761726999, -18.654750377009499, 16.655427409154399, 0.0120347437456702, -0.40190064848770302, -4.3952667136196499, -3.2283315530947299, 0.535114819933451, -1.6695636399303999, 4.8387109899640901, 5.9387464984757097, -9.2525260067921593, -7.0534068376986703, 24.6079478080533, -1.24249543569277, -0.00048592251459139902, 2.8352295963632699, 2.97576788056818, -0.061903426111554402, 15.662499828725799, -6.3594611155842697, -10.0297611955082, 4.4512302388898801, -22.9014624835775, 0.0522795583755256, 0.46237084970893699, -5.9599628993498204, 6.3134697655201197, -0.35523986461548501, 1.1938822885348901, -6.1222818696018599, -3.0697099757554498, 13.1385066502153, 10.0165667609847, -5.6534055293581504, 2.2982459946613698, 5.71641932114923e-05, -1.95937881355126, -3.1686710464991501, 0.0078900256254279908, -20.7802266137845, 1.9052049215289899, 13.243728372567, -7.2010122960325198, -1.78569599703996, -0.0023099999984344298, -0.181452511231602, 1.49235850994062, -3.4781928086271598, -0.25097197027097001, 0.034267435208927201, 2.9589361689912899, 2.1880246525605398, 0.40946783452396801, 1.85119165819145, 10.9769363093921, -0.49737197226351498, 0.00057014015696656801, -11.992703942957201, -9.1707599397024797, 0.13131957021746299, -80.913738884742898, 12.2802670275716, 51.275110674413497, -30.8846663544597, 40.768216707846101, -0.056350552707040001, -0.906909874969271, 4.5662724440002496, -16.493313057723601, -1.3954832548549501, -1.1309540462973, 17.671878079289101, 13.348292143643, -21.057182826114602, -17.2839203520208, 44.417018731905799, -5.1700529859646398, 0.00070585484241785499, -3.84393110623766, -3.8217546887026601, 0.042692631956155899, -33.103657623136797, 7.29987823117549, 21.1351246026951, -8.9046379168685696, 25.840620537279499, -0.077726091155589205, -0.51813471867742, 9.6014602253082906, -12.721891663249099, -1.51539376366047, -1.54216689848713, 11.448584843886, 4.4017938077693604, -13.490798207962101, -12.3088359993453, 13.904387711973399, -1.27899798343336, -4.8529590100271397e-05, 1.5144453784960501, 2.3396824932439499, -0.0087660084169081508, 9.4873136503254205, -1.65331055509645, -5.9367044032646401, 5.0146643904078898, -0.269092370588084, 0.0089905796176170498, 0.14805840549764701, -0.89101366694270501, 3.0317998491567302, 0.22142707740346401, 0.0064304970181167601, -3.4235077646052301, -1.69328028781498, 0.48844632252065601, -0.57157344288643996, -5.8659323559885497, 0.45402791645044299, 3.1177001030445297e-05, -2.4386266852651501, -0.31040563209251798, 0.0039504037521311498, -21.849203607580201, -0.45787097219896, 13.8161508224212, -9.4311122174081508, -5.4786114733527702, -0.0069717560537701602, 0.0049075772339915403, 1.65968311111433, -4.9313027452898597, -0.39825841496395797, 0.056303363068839998, 4.9803632483141103, 2.7343202713150898, 2.3452757571679799, 3.3498732374241098, 12.4790131924658, -0.41615992378439798}; - const uint64_t Updates_index2[2] = {20, 21}; - const double Updates2[42] = {-0.012056605890393198, 0.072118259966373, -0.14986032247543299, -0.023892195895314251, 0.2306191368843431, 0.070976656861603302, 0.059228850266663378, -0.0081594046205282003, 0.03775668889284136, -0.32248186320066397, -0.30175055470317586, -0.048578753136098399, -0.050512738234829151, 0.074964269995690003, 0.022375471889972701, 0.20063611492514641, -0.013817949220538101, 0.034675425849854905, 0.14269321411848099, 0.16303040878847203, 0.20520395040512121, 0.027209745720028898, -0.019752152264117806, 0.24686626344919221, 0.021544795483350802, 0.0053255971870385145, -0.074287162162363515, 0.0020896954229101539, -0.0015901625156403004, 0.045653678011149175, -0.095019596163183437, 0.015724316006526361, 0.057632524985820083, 0.0043175870669074383, -0.075611688196659296, -0.2787729352712634, 0.071667610667645931, -0.0016040895134210986, -0.018613442778587338, 0.16365851461887351, 0.018654582090675831, -0.43227782845497098}; - const double Slater2[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.028107110410928698, 0.013431881554424799, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.174509197473526, 0.085864908993244199, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.044309988617896999, 0.215069741010666, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, -0.015649655833840401, 0.011034868657589, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.00089795450912788499, 0.0060455044731497799, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.0114687560126185, -0.066873423755168901, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.000334969052346423, 0.0023343940265476699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.020809086039662399, -0.039619617164135, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, 0.0072047915309667596, 0.043619588017463698, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, -0.21170908212661699, 0.0024762949906289599, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.00210775528103113, 0.0140155302360654, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, -0.012914831750094899, 0.058629415929317502, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, -0.00059447408420965097, 0.00458275340497494, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.204596728086472, 0.091698803007602706, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.096327632665634197, -0.084247380495071397, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.0109922774136066, 0.077829994261264801, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.0301918238401413, -0.017013777047395699, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.0024164030328393, -0.017579320818185799, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, 0.030398890376091, 0.14741712808609, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.0045813838951289697, 0.024331344291567799, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, 0.13371524214744601, -0.19178953766822801}; - double Slater_inv2[441] = {-0.064091478343647895, 713.06177859755496, -52.018444001735702, 0.22294142549212401, 6739.1399551272798, 409.47332011602299, -4258.7085329747897, 2990.6198857571399, 2842.82174111627, -16.4362076124787, -19.6479024764561, -450.95698589104001, 1499.21617070053, 129.354086480939, -32.5623649949015, -1533.16729952379, -801.75588044433505, -1302.1490458327801, -1589.22747455529, -3895.5139631694801, 69.692448899038894, 0.078717515330272506, -890.24945003874404, 61.925371835460197, -1.59301536151858, -8399.1221177311709, -504.62121099099301, 5307.6897279898503, -3725.8058949477299, -3517.1067799943698, 20.0821069369808, 23.8371292623433, 563.21704392130198, -1868.99615781019, -160.79773282728499, 40.209679175758602, 1910.8342353503599, 1000.30652221449, 1610.10305651065, 1967.2714135880001, 4853.9412977750599, -86.938972564264105, 0.035772543187836597, 520.38606836760005, -37.3576026553948, 0.93824771966655895, 4913.8375731575898, 297.02078853525001, -3105.3054726097698, 2179.8383098375198, 2064.03863882426, -11.5897837400758, -13.7454041271756, -329.662381563542, 1093.32256576446, 94.164922311323394, -23.370538453071202, -1117.8490893585799, -585.07554862150903, -945.21841098621996, -1153.8443875258399, -2840.0954494666398, 50.509996472385303, -0.062171023850398299, -883.91684171449401, 65.956744158981707, -0.30209264289181997, -8354.6527651622891, -510.24292797392201, 5279.5127573481996, -3708.5126037463401, -3534.1651244869099, 20.118054506627601, 24.253115792914802, 558.90980701110504, -1858.4878939499599, -160.30158683160701, 40.074632460370502, 1900.40832678587, 993.28424539653497, 1619.3228924922901, 1974.7898591375399, 4829.6374496633298, -85.861801422967005, -0.045296585245108302, 503.608089249118, -37.409231418514402, 0.15972971393766999, 4760.0409737735199, 289.86000580815897, -3007.9000554557201, 2112.4472365954498, 2009.46047743586, -11.620588884143499, -13.435110153350299, -318.37193513541001, 1059.1982996055399, 91.392671066014998, -23.013250839168599, -1083.0984474979, -566.25418012298701, -920.44766441625598, -1123.03275109381, -2751.24966532286, 49.134449946833101, -0.050574070850706303, -735.268788752521, 52.034324888924203, -1.3246973887217, -6942.4299970826296, -419.091569409214, 4387.0782989889804, -3079.7112127626101, -2915.54203952635, 16.3862338355292, 20.069350976326799, 465.60100478088498, -1545.0790688177201, -133.05534575663401, 33.017866331913801, 1579.60766417078, 826.67092177544703, 1335.1987409164999, 1630.19252491066, 4012.1274550981102, -71.423354704319806, -0.00110547248442243, 66.086472294581398, -8.0640571635796796, 0.120361096092389, 643.91485283159295, 47.038233657028698, -406.863770451839, 288.91657765213398, 305.14483180816802, 0.028924090527909001, -2.4114842655012301, -39.3897517070086, 140.96244082771301, 13.290701732299899, -2.82866188450281, -144.284041440354, -74.462522726873601, -141.49789272768501, -167.03129270601499, -373.94726486427999, 5.3217330886365399, 0.00169058806401361, -100.681182204012, 9.9438606966790992, -0.16071917417936801, -947.22789644116904, -62.1819544991477, 598.507402482923, -421.456732120239, -417.90099350750501, -0.071547956877298299, 3.03910354158063, 58.825827638175099, -207.18138234350499, -16.8210784946065, 3.4953362885853601, 212.690544720802, 112.99993227712, 192.20097004017899, 232.57136070342199, 549.86422579734096, -7.9115450643297303, 0.00031167490112610501, 16.5702800434129, -0.96427444933400797, 0.017530807484877599, 153.70562899881901, 7.4253775224466096, -97.164535381519997, 68.391115404813903, 58.880541272935403, -0.00395431753418613, -0.27710621824447701, -6.5580129619132999, 32.685848366303901, 3.4769501442949502, -1.3237352902339601, -33.496400026660503, -18.678955342199799, -26.814344384641199, -34.430890540207301, -88.9250347843996, 1.51194685980572, 0.00045214452900354401, 37.241126324245002, 0.56653388165982099, -0.0153845901652373, 340.71285233348101, 15.613889705904301, -215.25964333041301, 151.26187968817001, 126.42681477968, 0.012659113756634199, -0.62711870198964903, -16.4637553538752, 71.986464894089806, 5.1001819045344803, -2.8075780414188398, -75.205305646206597, -41.656360989756003, -57.009250230864701, -71.671627817787495, -198.46090263475699, 5.47499644859007, 0.00085034576532286798, -48.324269416315303, 9.5426055788579802, -0.11918347900064399, -478.70065330731398, -38.914234951661598, 302.33505716911202, -216.13813506153201, -246.345286296176, 0.0018122457897085001, 2.0086911418790101, 27.577828210674401, -102.039313769876, -10.0857520350279, 1.94810040129421, 105.928854388454, 54.502095992205597, 115.30853907215899, 134.79460379303401, 280.65999252254602, -3.2448445639062502, -0.00017551641849241999, -35.157826546458601, -5.8891909991296698, 0.051680022896045397, -316.44550618039898, -5.0414187570711899, 200.212034255265, -135.39535162931199, -69.139114300097802, -0.16142175154882901, -0.0102013166269541, 31.668569875843001, -76.263188383823703, -5.0017512656630601, 2.0769594366589001, 76.002080804042095, 39.333282449810902, 30.0808204248134, 43.085264407243301, 177.27763312527699, -5.4457981556032404, -0.000306806291909659, -47.201229402180303, -1.2172052207398101, -0.0186567796198484, -436.83683166616999, -19.215912540534301, 276.031946309869, -192.67292600019499, -154.03017691774701, -0.042507166509503203, 0.76934514300024204, 23.977306301563999, -92.169363151535805, -9.1886362611435199, 3.1760937062011898, 95.958352522850603, 53.119118943843198, 68.432833843960694, 88.505438350444805, 253.98266241440601, -5.1028992571309599, 0.00043306496689241199, -45.515914649852498, 4.5704850382447297, -0.071472003061512898, -427.071656721686, -27.901412337784699, 269.85362292975498, -190.66655819995299, -192.761246218769, -0.0556222307934695, 1.3484518181471401, 29.668595531405, -94.026613967410796, -7.9849268838018501, 2.0615436543321501, 95.338384205774105, 51.130038963438999, 88.724620902414898, 106.181452502913, 248.269046435468, -3.6638133123307002, 0.00067386198047795695, 2.86001067576094, -1.83043518435104, 0.020675455904269301, 37.761848158240802, 6.8832167853114203, -24.015453768006701, 13.4834243521102, 35.324760224278002, 0.035792229507666501, -0.41862408163183901, -10.0509290141389, 13.5759504464113, 1.8922504612450599, -1.8614272588155001, -12.132753308102799, -3.3789310584400698, -17.244465911049499, -18.4686894621614, -17.916485915275999, 0.17564274753793899, -4.5499005275636101e-05, -31.614155756215101, -1.4091932535724401, -0.0060978442331452703, -292.99139921717801, -12.827598964788001, 185.144804328112, -128.77786179229901, -100.295349372036, -0.046207312260184701, 0.53169799203163903, 17.4856359712815, -63.3488322133691, -5.98125785658572, 1.9892546441005501, 64.233075829740997, 35.5568060355128, 46.269165313517597, 57.338723422189801, 170.63201646028199, -3.5806585828097099, 8.4039919523263399e-05, -4.0615650791823299, -3.4362521652092002, 0.011295419555382699, -39.6150470544694, 1.5105032334831401, 25.1537606371501, -15.330979335618601, -6.5084614221869197, -0.0083199111964546105, -0.17722199841012101, 2.9230666468463902, -7.7291578970740504, -0.59428543237974696, 0.082803013560185101, 7.2521932229389696, 4.54510970987024, 2.43118215251519, 4.7389061057811901, 21.734306554021401, -0.85611719611089199, -0.00025843236821193301, 52.817220161181702, -0.92129495231099501, 0.0263320504370466, 499.75948842769702, 24.448830234480202, -315.90847327586999, 219.760367065808, 186.369999846479, 0.12893364165019799, -1.03733562237538, -39.542133782410801, 114.562973083925, 9.1887926425616406, -2.6272948799917999, -114.688259732943, -59.320103692053301, -83.386175100226296, -106.311499516864, -287.23025749328701, 5.8899806135276798, 0.00029561730769906699, 28.2443444301325, 0.262667708054178, -0.0092881180472059802, 254.39556062397901, 13.3246994983259, -160.662465459228, 115.19312959924299, 97.930045120340793, 0.0140106353296333, -0.58271028141190895, -12.237212046379099, 52.1658593813167, 3.7250252932039301, -2.2830256115872798, -54.084720909199703, -31.577318042678201, -44.3507306279147, -56.3876021769941, -150.29869271905301, 4.1969751871532797, -3.5190977196700897e-05, 0.47111547837818402, 2.2068800929897598, -0.0070758873430103201, 0.13945915693743799, -1.8492037922933, -0.025671220257021801, 0.97970429288930505, -2.6130342276240199, 0.0060078182170399397, 0.15015803890865601, -0.18094310755408499, 0.92201583351316796, 0.051038179907958503, 0.030519047562509002, -1.2927339475995701, -0.52344231597663404, 1.4918374263167999, 0.861619645390301, -0.52697347953005502, 0.27598012654535198, -0.00073600321123188305, 57.569266190747499, 7.3278228968032701, -0.093258163105288297, 515.79957938656798, 10.8090738278263, -326.16130596512397, 222.642609875217, 129.33494256044199, 0.16458397773696601, -0.115854395362115, -39.1805516577625, 116.41448940344399, 9.4017853746533593, -1.32916748411286, -117.572672890536, -64.549778160481395, -55.365507632190301, -79.081290004649304, -294.59516563799099, 9.8243907421444003}; + // const uint64_t Updates_index2[2] = {20, 21}; + // const double Updates2[42] = {-0.012056605890393198, 0.072118259966373, -0.14986032247543299, -0.023892195895314251, 0.2306191368843431, 0.070976656861603302, 0.059228850266663378, -0.0081594046205282003, 0.03775668889284136, -0.32248186320066397, -0.30175055470317586, -0.048578753136098399, -0.050512738234829151, 0.074964269995690003, 0.022375471889972701, 0.20063611492514641, -0.013817949220538101, 0.034675425849854905, 0.14269321411848099, 0.16303040878847203, 0.20520395040512121, 0.027209745720028898, -0.019752152264117806, 0.24686626344919221, 0.021544795483350802, 0.0053255971870385145, -0.074287162162363515, 0.0020896954229101539, -0.0015901625156403004, 0.045653678011149175, -0.095019596163183437, 0.015724316006526361, 0.057632524985820083, 0.0043175870669074383, -0.075611688196659296, -0.2787729352712634, 0.071667610667645931, -0.0016040895134210986, -0.018613442778587338, 0.16365851461887351, 0.018654582090675831, -0.43227782845497098}; + // const double Slater2[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.028107110410928698, 0.013431881554424799, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.174509197473526, 0.085864908993244199, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.044309988617896999, 0.215069741010666, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, -0.015649655833840401, 0.011034868657589, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.00089795450912788499, 0.0060455044731497799, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.0114687560126185, -0.066873423755168901, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.000334969052346423, 0.0023343940265476699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.020809086039662399, -0.039619617164135, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, 0.0072047915309667596, 0.043619588017463698, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, -0.21170908212661699, 0.0024762949906289599, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.00210775528103113, 0.0140155302360654, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, -0.012914831750094899, 0.058629415929317502, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, -0.00059447408420965097, 0.00458275340497494, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.204596728086472, 0.091698803007602706, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.096327632665634197, -0.084247380495071397, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.0109922774136066, 0.077829994261264801, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.0301918238401413, -0.017013777047395699, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.0024164030328393, -0.017579320818185799, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, 0.030398890376091, 0.14741712808609, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.0045813838951289697, 0.024331344291567799, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, 0.13371524214744601, -0.19178953766822801}; + // double Slater_inv2[441] = {-0.064091478343647895, 713.06177859755496, -52.018444001735702, 0.22294142549212401, 6739.1399551272798, 409.47332011602299, -4258.7085329747897, 2990.6198857571399, 2842.82174111627, -16.4362076124787, -19.6479024764561, -450.95698589104001, 1499.21617070053, 129.354086480939, -32.5623649949015, -1533.16729952379, -801.75588044433505, -1302.1490458327801, -1589.22747455529, -3895.5139631694801, 69.692448899038894, 0.078717515330272506, -890.24945003874404, 61.925371835460197, -1.59301536151858, -8399.1221177311709, -504.62121099099301, 5307.6897279898503, -3725.8058949477299, -3517.1067799943698, 20.0821069369808, 23.8371292623433, 563.21704392130198, -1868.99615781019, -160.79773282728499, 40.209679175758602, 1910.8342353503599, 1000.30652221449, 1610.10305651065, 1967.2714135880001, 4853.9412977750599, -86.938972564264105, 0.035772543187836597, 520.38606836760005, -37.3576026553948, 0.93824771966655895, 4913.8375731575898, 297.02078853525001, -3105.3054726097698, 2179.8383098375198, 2064.03863882426, -11.5897837400758, -13.7454041271756, -329.662381563542, 1093.32256576446, 94.164922311323394, -23.370538453071202, -1117.8490893585799, -585.07554862150903, -945.21841098621996, -1153.8443875258399, -2840.0954494666398, 50.509996472385303, -0.062171023850398299, -883.91684171449401, 65.956744158981707, -0.30209264289181997, -8354.6527651622891, -510.24292797392201, 5279.5127573481996, -3708.5126037463401, -3534.1651244869099, 20.118054506627601, 24.253115792914802, 558.90980701110504, -1858.4878939499599, -160.30158683160701, 40.074632460370502, 1900.40832678587, 993.28424539653497, 1619.3228924922901, 1974.7898591375399, 4829.6374496633298, -85.861801422967005, -0.045296585245108302, 503.608089249118, -37.409231418514402, 0.15972971393766999, 4760.0409737735199, 289.86000580815897, -3007.9000554557201, 2112.4472365954498, 2009.46047743586, -11.620588884143499, -13.435110153350299, -318.37193513541001, 1059.1982996055399, 91.392671066014998, -23.013250839168599, -1083.0984474979, -566.25418012298701, -920.44766441625598, -1123.03275109381, -2751.24966532286, 49.134449946833101, -0.050574070850706303, -735.268788752521, 52.034324888924203, -1.3246973887217, -6942.4299970826296, -419.091569409214, 4387.0782989889804, -3079.7112127626101, -2915.54203952635, 16.3862338355292, 20.069350976326799, 465.60100478088498, -1545.0790688177201, -133.05534575663401, 33.017866331913801, 1579.60766417078, 826.67092177544703, 1335.1987409164999, 1630.19252491066, 4012.1274550981102, -71.423354704319806, -0.00110547248442243, 66.086472294581398, -8.0640571635796796, 0.120361096092389, 643.91485283159295, 47.038233657028698, -406.863770451839, 288.91657765213398, 305.14483180816802, 0.028924090527909001, -2.4114842655012301, -39.3897517070086, 140.96244082771301, 13.290701732299899, -2.82866188450281, -144.284041440354, -74.462522726873601, -141.49789272768501, -167.03129270601499, -373.94726486427999, 5.3217330886365399, 0.00169058806401361, -100.681182204012, 9.9438606966790992, -0.16071917417936801, -947.22789644116904, -62.1819544991477, 598.507402482923, -421.456732120239, -417.90099350750501, -0.071547956877298299, 3.03910354158063, 58.825827638175099, -207.18138234350499, -16.8210784946065, 3.4953362885853601, 212.690544720802, 112.99993227712, 192.20097004017899, 232.57136070342199, 549.86422579734096, -7.9115450643297303, 0.00031167490112610501, 16.5702800434129, -0.96427444933400797, 0.017530807484877599, 153.70562899881901, 7.4253775224466096, -97.164535381519997, 68.391115404813903, 58.880541272935403, -0.00395431753418613, -0.27710621824447701, -6.5580129619132999, 32.685848366303901, 3.4769501442949502, -1.3237352902339601, -33.496400026660503, -18.678955342199799, -26.814344384641199, -34.430890540207301, -88.9250347843996, 1.51194685980572, 0.00045214452900354401, 37.241126324245002, 0.56653388165982099, -0.0153845901652373, 340.71285233348101, 15.613889705904301, -215.25964333041301, 151.26187968817001, 126.42681477968, 0.012659113756634199, -0.62711870198964903, -16.4637553538752, 71.986464894089806, 5.1001819045344803, -2.8075780414188398, -75.205305646206597, -41.656360989756003, -57.009250230864701, -71.671627817787495, -198.46090263475699, 5.47499644859007, 0.00085034576532286798, -48.324269416315303, 9.5426055788579802, -0.11918347900064399, -478.70065330731398, -38.914234951661598, 302.33505716911202, -216.13813506153201, -246.345286296176, 0.0018122457897085001, 2.0086911418790101, 27.577828210674401, -102.039313769876, -10.0857520350279, 1.94810040129421, 105.928854388454, 54.502095992205597, 115.30853907215899, 134.79460379303401, 280.65999252254602, -3.2448445639062502, -0.00017551641849241999, -35.157826546458601, -5.8891909991296698, 0.051680022896045397, -316.44550618039898, -5.0414187570711899, 200.212034255265, -135.39535162931199, -69.139114300097802, -0.16142175154882901, -0.0102013166269541, 31.668569875843001, -76.263188383823703, -5.0017512656630601, 2.0769594366589001, 76.002080804042095, 39.333282449810902, 30.0808204248134, 43.085264407243301, 177.27763312527699, -5.4457981556032404, -0.000306806291909659, -47.201229402180303, -1.2172052207398101, -0.0186567796198484, -436.83683166616999, -19.215912540534301, 276.031946309869, -192.67292600019499, -154.03017691774701, -0.042507166509503203, 0.76934514300024204, 23.977306301563999, -92.169363151535805, -9.1886362611435199, 3.1760937062011898, 95.958352522850603, 53.119118943843198, 68.432833843960694, 88.505438350444805, 253.98266241440601, -5.1028992571309599, 0.00043306496689241199, -45.515914649852498, 4.5704850382447297, -0.071472003061512898, -427.071656721686, -27.901412337784699, 269.85362292975498, -190.66655819995299, -192.761246218769, -0.0556222307934695, 1.3484518181471401, 29.668595531405, -94.026613967410796, -7.9849268838018501, 2.0615436543321501, 95.338384205774105, 51.130038963438999, 88.724620902414898, 106.181452502913, 248.269046435468, -3.6638133123307002, 0.00067386198047795695, 2.86001067576094, -1.83043518435104, 0.020675455904269301, 37.761848158240802, 6.8832167853114203, -24.015453768006701, 13.4834243521102, 35.324760224278002, 0.035792229507666501, -0.41862408163183901, -10.0509290141389, 13.5759504464113, 1.8922504612450599, -1.8614272588155001, -12.132753308102799, -3.3789310584400698, -17.244465911049499, -18.4686894621614, -17.916485915275999, 0.17564274753793899, -4.5499005275636101e-05, -31.614155756215101, -1.4091932535724401, -0.0060978442331452703, -292.99139921717801, -12.827598964788001, 185.144804328112, -128.77786179229901, -100.295349372036, -0.046207312260184701, 0.53169799203163903, 17.4856359712815, -63.3488322133691, -5.98125785658572, 1.9892546441005501, 64.233075829740997, 35.5568060355128, 46.269165313517597, 57.338723422189801, 170.63201646028199, -3.5806585828097099, 8.4039919523263399e-05, -4.0615650791823299, -3.4362521652092002, 0.011295419555382699, -39.6150470544694, 1.5105032334831401, 25.1537606371501, -15.330979335618601, -6.5084614221869197, -0.0083199111964546105, -0.17722199841012101, 2.9230666468463902, -7.7291578970740504, -0.59428543237974696, 0.082803013560185101, 7.2521932229389696, 4.54510970987024, 2.43118215251519, 4.7389061057811901, 21.734306554021401, -0.85611719611089199, -0.00025843236821193301, 52.817220161181702, -0.92129495231099501, 0.0263320504370466, 499.75948842769702, 24.448830234480202, -315.90847327586999, 219.760367065808, 186.369999846479, 0.12893364165019799, -1.03733562237538, -39.542133782410801, 114.562973083925, 9.1887926425616406, -2.6272948799917999, -114.688259732943, -59.320103692053301, -83.386175100226296, -106.311499516864, -287.23025749328701, 5.8899806135276798, 0.00029561730769906699, 28.2443444301325, 0.262667708054178, -0.0092881180472059802, 254.39556062397901, 13.3246994983259, -160.662465459228, 115.19312959924299, 97.930045120340793, 0.0140106353296333, -0.58271028141190895, -12.237212046379099, 52.1658593813167, 3.7250252932039301, -2.2830256115872798, -54.084720909199703, -31.577318042678201, -44.3507306279147, -56.3876021769941, -150.29869271905301, 4.1969751871532797, -3.5190977196700897e-05, 0.47111547837818402, 2.2068800929897598, -0.0070758873430103201, 0.13945915693743799, -1.8492037922933, -0.025671220257021801, 0.97970429288930505, -2.6130342276240199, 0.0060078182170399397, 0.15015803890865601, -0.18094310755408499, 0.92201583351316796, 0.051038179907958503, 0.030519047562509002, -1.2927339475995701, -0.52344231597663404, 1.4918374263167999, 0.861619645390301, -0.52697347953005502, 0.27598012654535198, -0.00073600321123188305, 57.569266190747499, 7.3278228968032701, -0.093258163105288297, 515.79957938656798, 10.8090738278263, -326.16130596512397, 222.642609875217, 129.33494256044199, 0.16458397773696601, -0.115854395362115, -39.1805516577625, 116.41448940344399, 9.4017853746533593, -1.32916748411286, -117.572672890536, -64.549778160481395, -55.365507632190301, -79.081290004649304, -294.59516563799099, 9.8243907421444003}; const uint64_t N_updates3 = 3; const uint64_t Updates_index3[3] = {12, 13, 21}; const double Updates3[63] = {-0.32320992089807998, -0.1768221333622936, -0.044189138920046375, -0.0083658993244170032, -0.13345118239521958, -0.088903807103633908, -0.25946535170078289, 0.14435659933042233, -0.21090563386678701, 0.019084170460701003, 0.073579406365752206, -0.013528384268283893, 0.031103432178496981, -0.25866857916116798, 0.022464506328106093, 0.032419085502625011, -0.083496315404772786, -0.392626002430916, -0.057606873102486092, 0.1326765250414613, 0.034384071826935009, 0.25532682985067379, -0.025051936507225009, 0.17769842967391061, 0.080573752522469011, 0.11870069429278349, 0.35069981217384349, 0.127604305744171, -0.081144510089870836, -0.04023376852273898, 0.0045312587171792984, 0.017237693071365301, 0.0386847481131554, -0.21935135498642899, 0.040930040180683996, -0.057743255048990395, -0.289656192064286, 0.26965582184493592, 0.257760990411043, -0.1886596158146856, -0.036238497123122194, -0.1386065091937782, 0.0015524076297879202, -0.1212832294404507, 0.028310360386967659, -0.005844349274411801, 0.0046449899673459971, 0.044258039444684996, 0.0025386139750480999, 0.0354412645101548, 0.064816890284419101, 0.1017611473798752, -0.25162110477685901, -0.0285851191729307, -0.024413086473941803, -0.22420015186071351, 0.059393912553786996, 0.04153373837471, 0.01215143408626318, 0.203658737242222, -0.0020150262862444011, -0.037645858246833121, 0.0714646056294439}; const double Slater3[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.028107110410928698, 0.0080896317958831804, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, 0.174509197473526, -0.0599150508642197, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, 0.044309988617896999, 0.0096954777836799604, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, -0.015649655833840401, -0.00653020711615682, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.00089795450912788499, 0.10536465793848, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.0114687560126185, 0.027113301679492, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.000334969052346423, 0.030707944184541699, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.020809086039662399, 0.0544226132333279, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.0072047915309667596, 0.041792899370193502, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.21170908212661699, 0.043612048029899597, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, 0.00210775528103113, -0.12754787504673001, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, -0.012914831750094899, -0.0478814952075481, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, -0.00059447408420965097, -0.092382267117500305, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.204596728086472, -0.089926846325397505, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, 0.096327632665634197, -0.10392674803733799, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.0109922774136066, 0.17250911891460399, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.0301918238401413, 0.00962609611451626, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.0024164030328393, 0.115568056702614, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.030398890376091, 0.0136762224137783, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, -0.0045813838951289697, -0.030651951208710702, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, 0.13371524214744601, 0.14154277741908999}; // WB3 - double Slater_inv3_1[441] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604}; + // double Slater_inv3_1[441] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604}; // SM+spl double Slater_inv3_2[441] = {-0.056658742514349103, -9.5006825962797503, -18.307026635935799, -0.36744251865365501, 31.610841135834299, 39.084671241308698, -19.703711132730799, 18.666497646833299, 121.964198363159, -17.598444551917201, -2.9520245875548698, 24.935160344122199, 13.992695020707, 4.6612706754314903, -3.6234738869455199, -28.604054847833801, 9.5739197944338503, -62.128443913882499, -67.232459151277695, -11.803301377693099, -3.8508731471217099, 0.069411805979426894, 10.8007994955779, 22.458394727678201, -0.89282708659453403, -39.476164388726097, -47.5420201141931, 24.536662733275399, -23.351558477080602, -146.60044409871099, 21.549928185153298, 3.32891560872004, -30.5549979706051, -17.384760133954, -5.4401084934617003, 4.3730845094487396, 35.2040348414587, -11.414817838980399, 74.926509290741393, 80.145978783950099, 14.6842509146363, 5.7893824160342398, 0.041199702875412497, -6.4779318938824302, -13.2989719358296, 0.51508213587065199, 23.9434304832055, 27.923633944040301, -14.994539048994801, 13.545190256632999, 84.658750799602501, -12.440996315879, -1.6347815496642299, 17.4053340515119, 10.4563880132908, 3.2716511123291698, -2.32038524814726, -20.901080430435499, 6.5092932119827198, -43.310144838525801, -46.266317618221201, -9.0209731319320596, -3.3217327746699499, -0.071364036152653701, 11.529909516191401, 22.9175425489932, 0.44722818276140403, -39.897585842875301, -48.876557451246697, 24.801523764393401, -23.690956189203401, -151.28132599138999, 21.549304148995901, 3.4094704881876998, -30.687597458642099, -17.659848105023201, -5.7069215817131997, 4.0886157921745996, 35.564950307785701, -12.1803912964186, 77.135406641174299, 83.318689013925706, 14.819424258558801, 4.7782939163062803, -0.040051226770134098, -6.7134150132482402, -13.312257348225099, -0.26126985985289403, 22.204441530888801, 27.729627986407898, -13.7012421876807, 13.0503428483308, 85.297842345116607, -12.439369240025201, -1.60848061970372, 17.698309764178902, 10.1798985121263, 3.3110252774145601, -2.5466287558690199, -20.410023365852201, 6.7633439222022202, -43.4149505982517, -46.886928763683102, -7.88950712988734, -2.6927901019362199, -0.058248999176268398, 9.0508747193022892, 18.587941141225699, -0.73447131422595202, -35.308936282117699, -39.940782969048001, 21.9119312895712, -20.076960036338601, -123.935102576568, 17.592669318251101, 3.0259816420954402, -24.782453059479, -15.379073099754899, -4.67601503080067, 3.33242427220405, 30.0344780145867, -9.0772191462285008, 63.391820359557002, 67.760837774760006, 13.3701295015636, 4.8413052345891403, -0.00048534604109837199, -1.8238859168577699, 0.56645976558050504, -0.011652978445607001, 3.3511865791586, 2.0262681174419299, -2.14462816857628, 1.8811114733258301, 1.72516289469276, -0.0410444803602956, -0.17992011162600399, 4.6474809764852196, 0.32638302042170703, 1.28068103014527, 0.42381953652975901, -1.62158383882094, 1.84081037263479, -1.2636267813034701, -0.97726719185308597, -0.84319863660797401, 0.57245121780013697, 0.00072965273109526496, -0.74868100456805098, 0.61375144696985096, -0.013670796650539699, -10.880212250529199, -2.2389072194253701, 6.8446360871752603, -3.8338819099152301, -0.83708262317409499, 0.055638693619984997, 0.16395892268443801, -6.4020540512225601, -0.87619791103918299, 0.67273193621704896, -0.96217527481654197, 3.5322304037025498, 0.74780382069687101, 0.457651060635482, 2.4127372990709501, 5.8207812126355103, 0.41153697505715597, 0.00047300381075295099, -0.24273841428794099, 0.62931133864105804, -0.0075433586410305498, -3.8733549821913198, -2.7042122832831499, 2.4066006453807001, -1.90501007795962, -11.4961539239149, -0.025181201641384401, 0.20951155742128399, 4.41315756942062, -2.02827911285326, 0.53245648205106699, -0.57146100385840204, 1.6986603412216601, 0.20698230514139301, 5.5487259477006203, 4.3923373342920504, 2.6422104099671002, 0.12108516249854701, 0.00082691786224778699, 0.113024111733347, 2.7966391201096901, -0.052696331353419397, -4.8718908471754601, -4.3479524721016301, 3.1326652654405498, -2.1520186098021998, -17.7293360378548, -0.043482158450766098, 0.29115918226676102, 7.9265874331542596, -4.4255647905147004, -1.3335239860704799, -1.2720331573702599, 2.2195046250833101, 0.037526349197067099, 8.8672908187991606, 8.6317273115312592, 1.83700699526623, 1.8931859854467199, 0.000439374179950941, 1.8174276372186899, -0.095470042913778502, 0.0240432915091328, 0.33095163979973902, 0.419313643627721, -0.26508090252151401, 0.40758512406775099, 6.2032604963961004, 0.0299978360553445, -0.0350221248964512, -4.5247535085126103, 2.4252753636201798, -1.0443273705703999, -0.77183418222125399, -0.15673357470618601, -1.86654030909075, -2.3976989367798298, -1.56808861204302, 0.340202658594777, -1.0312623606052, -0.00063346566713256398, -0.661487272350328, -0.31969668820761499, -0.0207136433303984, -9.5617277834137209, -0.76548087353469296, 6.1338905273463604, -3.6493438141085299, -1.93160595722129, -0.054328540468196101, 0.063300925950509901, 8.0421985164502203, -6.7317743058458301, 0.56920882928816896, 1.39543139815216, 5.8217064803946901, 0.664937044390989, 2.0166407848672301, 0.66314768899536403, 2.4978865189964501, 0.90776612934725198, -0.00080526074137288, 0.866074714994297, -3.1810443538305599, 0.016712052067642799, 8.8525588583729107, 4.9029982933499703, -5.6387712154483003, 4.6377500718450797, 24.5361964752293, 0.036812637615073897, -0.307516025692601, -7.7158500239832, 6.5793196290456004, -0.90848412347546603, 1.2781649114678699, -4.0662241638244598, -0.85073071123983601, -12.848505169556301, -11.568586481641701, -3.9619743954566902, -0.100174674295188, 0.00069201116604256595, -0.421899716446686, -0.59032673715943695, 0.00276476648616889, 5.2753594946225197, 3.1708842333983198, -3.5051204501630502, -1.5506563388697101, 13.474253171986501, 0.038327175723695497, -0.21097106418518499, -8.0266607832375794, 6.6217101288174902, 1.26803738570163, -1.6239859547120901, -5.0491300215678701, 0.316141906166655, -6.8977435746728997, -6.9768951380000299, 1.3337978430772699, 0.27199695684951902, -0.00038359474997356102, 0.72100151176486804, -2.5365266414467098, 0.014980427848668199, 6.4663011480631196, 3.0354904137032901, -4.11275562441097, 3.6805173953314201, 18.1353313216757, 0.0085443837305102504, -0.16921638348780199, -3.85900106683119, 3.0428583654892001, -0.42146305418508101, 0.73140085261157395, -3.0095115595924198, -0.74724977432843798, -7.5689235578938199, -9.1654977643928905, -2.6018219553374502, -0.138580489522561, 3.1034344981670402e-05, 0.57346844296584099, -3.2816001969233399, 0.0098861018626169896, 2.7223870822496599, 3.19376385336182, -1.6094836478010499, 3.2093742171519399, 7.7061355268378202, 0.00180174673425388, -0.239342015844032, -0.17647999921287399, 1.7270571869450699, 0.18584316968323999, -0.066662651903874603, -2.3139065344532099, -0.65593666316055899, -3.9145254849983999, -3.4618799405385898, -2.6291335069492199, -0.23750024714478199, 0.00031371845096864198, -0.27014711720045598, -0.259122675110673, 0.0083797376871939597, 10.324015180961201, 0.62494833390683702, -6.5624316442850503, 3.9711776808922599, 2.31246521547006, 0.030498354639596902, -0.030734962225840101, -4.3487398562952402, 5.7898821592163596, 0.12407032656822101, -0.67808345005445703, -4.5636059941770499, 0.27242993392548098, -0.151105792955298, -2.1330095124199899, -4.5785158627476203, -0.23182086620430201, 0.00056545552199213298, 0.069522397061161395, 2.96885317382849, -0.051806865055980901, -9.7375846906152006, -3.7168685914889101, 6.2375373511235503, -2.6577205028209501, -20.3171172054412, -0.021304232202155899, 0.23708001500731801, 6.1434851687025596, -6.0140190081509104, -1.2111808932828501, -1.0189029621818799, 4.9024564940572102, 0.071576063751164501, 10.0372849796479, 8.8217235588703602, 3.2002119174291299, 1.88033862253058, -9.2381558436834005e-06, 0.209953576303675, 0.59897227695759403, 0.015408836716403701, 0.72667814261222297, 1.04253074219921, -0.36639952244782897, 2.1938545786385899, 10.5511658202853, -0.0060583673747924196, -0.040276481247202303, 0.19563265784432399, 0.695642528811383, 0.092195243295609006, -0.11700648378234201, -1.12128461392435, -0.24506719194217999, -5.08663676195245, -5.4127332500372898, -1.5233052074208899, -0.39207349407666497, -6.8044267141740398e-05, 1.4457806883519999, 3.6350558224209202, -0.050692260884422198, 6.5385777171092396, -6.1735157165659498, -4.2016623917464404, 0.71692866600594696, -26.888355558432, 0.028941180562419198, 0.41559738160577497, -1.41973334424801, 2.2623160579408399, 0.052440836591797699, 0.30315007284467799, -2.1595166526410599, -1.58941085218909, 13.577357339870201, 12.5510397413387, -2.28593652323275, 1.6131542987429599, 2.4964374967303e-05, 0.93824074473311303, -2.4541545673520901, 0.034536963170488502, 13.190305707504599, 4.9824580626416397, -8.2907707221262701, 7.2636404959165102, 24.581904470708601, -0.0158179845091273, -0.31398696530982101, -0.31358040502335599, 2.3904278510213701, 0.29019959630452602, -0.27262779401736098, -2.5076564852846102, -1.07562902654376, -12.0644593562773, -12.129759160663401, -8.6137752723124397, -0.85889008520979604}; - const uint64_t N_updates5 = 5; - const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; - const double Updates5[105] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121}; - const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; - double Slater_inv5[441] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799}; + // const uint64_t N_updates5 = 5; + // const uint64_t Updates_index5[5] = {17, 18, 19, 20, 21}; + // const double Updates5[105] = {-0.026680206879973502, 0.27298007905483301, -0.099715244024992294, -0.1053539039567112, -0.1449181307107206, 0.086803577840328203, -0.13467331603169441, 0.083233945071697304, -0.050348894670605604, 0.113249283283949, -0.18058512732386639, -0.013084722682833599, -0.2101329043507576, 0.29668186604976698, 0.011996015906333896, -0.25581711530685397, -0.18468007631599939, -0.19795016199350388, 0.13754389435052872, 0.066371031105519007, 0.1506568714976311, 0.1407152302563191, -0.035490237176418013, -0.15555772557854669, -0.13084962218999829, -0.065377140417695004, -0.28165902942419097, -0.0038048550486564081, -0.17355462908744812, 0.1904655769467351, 0.1015159860253334, -0.082969114184379605, 0.1009396240115165, 0.25867408514022822, -0.090622015297412997, -0.0261126160621643, -0.0070611685514450073, 0.34575527906417902, 0.1856994293630127, 0.1505507901310916, -0.24748291820287749, -0.1930690407752986, -0.10824421048164369, -0.2003080397844319, -0.050228431820869016, 0.2341227037832137, -0.1714876033365724, 0.32784904539585158, 0.040038149803876807, 0.12709141941741103, -0.088602993637323102, -0.1617441214621064, -0.237361330538988, -0.029239896684885004, 0.039443209767341697, -0.15546871721744498, -0.0127334967255592, -0.093294814229011994, -0.16617536172270789, 0.081297293305397006, -0.11561803519725759, -0.088157065212726496, 0.043941155076026403, -0.043334499001503005, -0.072291933000086989, 0.25947313755750623, -0.00654759816825385, -0.23022028384730242, -0.0992842186242342, -0.059074921417050084, 0.009816635400056898, -0.018885548226535299, 0.28729220479726802, 0.30690228054299934, 0.058271216228604303, 0.050839929841458791, -0.091462507843971003, 0.21059621125459649, -0.19497598148882408, 0.012118805199861502, -0.040971436537802185, -0.0676504261791709, -0.16150601254776081, 0.076545581221580811, -0.44388696737587502, 0.026131823658942982, -0.11532356310635784, 0.038358195684850299, 0.16635001881513747, 0.035624274984002099, 0.039094586856663179, 0.12423532153479717, 0.13070272840559499, 0.027002811431885002, -0.22131750034168385, 0.1172939799726007, -0.034513717517256695, 0.19796614628285178, 0.087915631011128009, 0.1338309701532128, -0.086308442056179102, -0.014136113226413699, 0.06877816375345, 0.11613245680928279, -0.16100704949349121}; + // const double Slater5[441] = {-2.8945870399475102, 3.5455725193023699, 2.0470812320709202, -3.5464441776275599, -2.0474903583526598, -2.89596366882324, -0.61329728364944502, 0.70991641283035301, 0.45664468407630898, 0.59523195028305098, 0.26079276204109197, -0.027727147564291999, -0.35093706846237199, -0.095610238611698206, -0.130077064037323, 0.10946778208017301, 0.021800471469759899, 0.048480678349733401, -0.092234551906585693, -0.0160505045205355, -0.42026260495185902, -0.78021097183227495, -0.95558542013168302, -0.55174458026885997, -0.95579683780670199, -0.55179446935653698, 0.78044348955154397, -0.115299895405769, -0.11754634231329, -0.0318448171019554, -0.00082233443390577999, 0.064001239836216001, 0.12740932404995001, -0.049412809312343597, -0.074464745819568606, 0.19851659238338501, -0.088878795504569993, 0.135610401630402, -0.13736967742443101, -0.101879440248013, 0.102390937507153, -0.12476679682731601, -0.00527230883017182, 0.00029381641070358499, 0.0072919740341603799, -0.00026352208806201799, 0.0068838247098028703, 0.0047294595278799499, 0.11728889495134399, -0.062190085649490398, -0.15969239175319699, -0.10645916312933, 0.112943567335606, -0.0015487050404772199, -0.045737843960523598, 0.13196058571338701, 0.038660705089569099, -0.050266433507204097, -0.13745591044426, -0.037740666419267703, 0.11781705915927899, 0.19417031109332999, -0.0079971449449658394, -0.30874741077423101, -0.37815779447555498, 0.218254208564758, 0.378139227628708, -0.21839827299118, -0.30879178643226601, 0.025539221242070202, 0.112043909728527, 0.037676706910133403, 0.025347150862216901, -0.19991625845432301, 0.14163509011268599, 0.13326919078826899, 0.213842943310738, 0.131471157073975, 0.14626120030879999, -0.0118067460134625, 0.093547157943248693, 0.22439678013324699, 0.0082425400614738499, 0.0250354297459126, -1.52881526947021, -1.9163775505148799e-05, -2.1623263359069802, -1.5540548702119799e-05, 2.16284847259521, -1.52953028678894, -0.26402890682220498, 0.024944067001342801, -0.37140902876853898, -0.044071510434150703, -0.29843890666961698, -0.043834518641233403, -0.177285701036453, -0.058585006743669503, -0.0183692276477814, -0.026075478643178902, -0.15623773634433699, -0.011319605633616401, 0.054057534784078598, -0.23151709139347099, -0.0016308756312355399, -0.067333526909351293, 0.00043256155913695698, 0.095035225152969402, -0.00043632232700474598, 0.094624765217304202, 0.066768139600753798, 0.14448715746402699, -0.12090456485748299, -0.203432962298393, -0.21472349762916601, 0.154288679361343, 0.017385326325893399, -0.071518480777740506, 0.27918133139610302, 0.080454014241695404, -0.0361245274543762, 0.0566458702087402, -0.030157707631588, 0.25150132179260298, -0.082445412874221802, -0.017600754275918, -2.2779068946838401, -2.3393469746224599e-05, -3.2218937873840301, -1.7939200915861899e-05, 3.22278833389282, -2.2791447639465301, -0.47945570945739702, 0.045197278261184699, -0.64478874206543002, -0.080234304070472703, -0.47389149665832497, 0.024908870458602898, -0.23455648124218001, -0.10695217549800901, -0.033054649829864502, -0.195749551057816, -0.040076982229948002, 0.094596333801746396, 0.098401188850402804, -0.059563819319009802, -0.0045592403039336196, -0.0025739683769643298, -0.0020174346864223502, -0.0024467820767313199, -0.00204527890309691, 0.00013988610589876801, 0.00073755031917244196, 0.17339251935482, 0.099962860345840496, 0.14622049033641801, -0.088966980576515198, 0.040044382214546197, -0.14437201619148299, -1.5416861060657501e-05, -0.081159926950931494, -0.11909016221761699, 0.170753449201584, 0.031124599277973199, -0.052109345793724102, 0.121445283293724, 0.0289684906601906, 0.120766848325729, -0.0043673445470631097, -0.00014539182302542001, 0.0061219600029289696, 0.000189467871678062, 0.0060523007996380303, 0.00425094133242965, 0.0905451029539108, 0.058540407568216303, -0.15191346406936601, 0.11511342227459, 0.15016922354698201, 0.10024280846118901, -0.11066282540559801, -0.15089659392833699, -0.021995550021529201, 0.10021472722291901, 0.019932290539145501, 0.070281185209751101, -0.120184391736984, -0.030551897361874601, 0.10763206332922, -0.0097634727135300602, 0.0119331693276763, -0.0068263513967394803, 0.011701960116624799, -0.0068089049309492103, 0.0095072658732533507, 0.133816182613373, -0.15090283751487699, 0.070243604481220204, 0.077758952975273105, -0.071993313729763003, -0.0526336021721363, -0.033549431711435297, -0.029018172994255999, 0.10475520789623299, 0.047332767397165298, 0.17077720165252699, 0.057527918368577999, -0.043988067656755399, 0.11077278107404701, -0.11803108453750601, -0.71565270423889205, 2.80283820757177e-05, 1.0121610164642301, -2.41986454057042e-05, 1.0123220682144201, 0.71586799621581998, -0.045286595821380601, -0.0269623268395662, 0.0683262273669243, -0.047560662031173699, -0.062597043812274905, -0.0278066452592611, 0.045772761106491103, 0.063010454177856404, 0.0197743345052004, -0.025724532082676901, -0.20542661845684099, -0.0248414911329746, 0.058127623051405002, 0.30385830998420699, -0.0018243347294628601, -0.00073456991231069001, 0.000104061764432117, -0.0010063005611300501, 0.00014142321015242501, 0.00095045292982831597, -0.00064003589795902404, 0.056538689881563201, -0.038196403533220298, 0.095246985554695102, 0.077704243361949907, 0.089713566005229894, 0.071932643651962294, 0.058404259383678402, 0.097089007496833801, -1.8242251826450202e-05, -0.070699930191039997, 0.0231548044830561, 0.036239527165889698, -0.064700096845626803, 0.035663921386003501, 0.140344902873039, -0.0285779368132353, 2.2119384368579599e-07, -0.0404084548354149, 4.62594880445977e-06, 0.040473498404025997, -0.028664523735642398, 0.0818745791912079, -0.0072916029021143896, 0.171691119670868, 0.0142411412671208, 0.227563425898552, 0.20764905214309701, 0.23875248432159399, 0.019401129335165, 0.0041248365305364097, -0.273390233516693, 0.031942136585712398, 0.24207504093647, -0.016599044203758202, 0.0499182641506195, 0.011294623836875, -0.083720728754997295, -0.102523192763329, -0.059237916022539097, -0.10253403335809699, -0.0591498985886574, 0.083691440522670704, 0.093738317489623996, 0.118414394557476, 0.119053602218628, -0.19025875627994501, -0.017257452011108398, 0.111288614571095, -0.14737996459007299, -0.106449924409389, 0.119639433920383, -0.0358475148677826, 0.16083629429340399, -0.135845571756363, -0.045223556458950001, 0.129632458090782, 0.0101170120760798, -0.0016409500967711199, 0.0020083498675376199, 0.0011536112288013101, -0.0019761291332542901, -0.0011378186754882301, -0.0015965295024216199, 0.062009602785110501, -0.085591755807399694, -0.073869466781616197, -0.129948750138283, -0.025633471086621298, 0.092304252088069902, 0.11476875841617599, 0.0570255033671856, -0.098354063928127303, 0.048130486160516697, -0.075562968850135803, -0.087558984756469699, -0.061446368694305399, 0.073952160775661496, -0.030968701466917999, -0.086937576532363905, -5.2227896958356703e-05, -0.12295132130384399, -5.67086790397298e-05, 0.122932203114033, -0.086922481656074496, 0.092386581003665896, 0.0563923679292202, 0.16267444193363201, -0.103307262063026, 0.177027583122253, 0.119934171438217, 0.15235325694084201, -0.13730293512344399, -0.036718469113111503, -0.13380806148052199, -0.14056211709976199, 0.11525499820709199, 0.122316166758537, -0.211628392338753, -0.030221903696656199, -0.71328485012054399, -0.87364697456359897, -0.50431287288665805, -0.87368428707122803, -0.50450080633163497, 0.71341556310653698, -0.0728774294257164, -0.0137394573539495, -0.131415024399757, 0.120499663054943, -0.15048809349536901, 0.067258194088935894, -0.016238121315836899, 0.25341770052909901, 0.061544414609670597, -0.124150305986404, -0.023104058578610399, 0.161576017737389, -0.18417926132678999, -0.016373874619603199, -0.061180751770734801, -0.00358590018004179, -3.1569013572152501e-06, 0.00505110481753945, -1.33700987134944e-05, 0.0050756097771227403, 0.0036168387159705201, 0.076649472117423997, -0.0148532707244158, -0.15424914658069599, -0.031277053058147403, 0.20174449682235701, 0.17827098071575201, -0.21435502171516399, 0.043405968695879003, 0.0060502337291836704, 0.23922684788703899, 0.022777535021305102, 0.22072769701480899, 0.035028267651796299, -0.037091828882694203, -0.054775215685367598, -0.0137155568227172, -0.00072690693195909305, 0.019026592373848, 0.00073597067967057196, 0.018235495314001999, 0.012611641548574, 0.14907942712307001, 0.10721461474895499, -0.205590710043907, 0.18899101018905601, 0.14405034482479101, 0.0080890702083706908, -0.049517802894115399, -0.23817741870880099, -0.062822751700878102, -0.056222390383482, 0.079762905836105305, -0.057780988514423398, -0.208331778645515, -0.11229432374239, 0.0132825700566173, -0.13207408785819999, -0.00012266315752640399, -0.18668732047080999, -0.000116608949610963, 0.18647037446498901, -0.13181127607822399, 0.17992316186428101, 0.0310163982212543, 0.194987177848816, -0.051282022148370701, 0.079243704676628099, -0.16229276359081299, -0.029616238549351699, -0.065854735672473894, -0.025143278762698201, 0.277732163667679, -0.117880158126354, -0.184251189231873, 0.0632317289710045, -0.16761179268360099, 0.0096404440701007808, -0.0068073021247982996, -0.0083365431055426598, 0.0048150913789868398, 0.0083073899149894697, -0.0047997133806347804, -0.0067770029418170504, 0.077614806592464405, 0.12953585386276201, -0.063416801393032102, 0.138088583946228, -0.10224375873804099, 0.130568191409111, 0.164952263236046, 0.026345754042267799, 0.13718618452549, 0.084768116474151597, 0.096043966710567502, -0.054612904787063599, 0.138456135988235, -0.071488708257675199, -0.0153317032381892}; + // double Slater_inv5[441] = {-0.054189244668834902, -105.426713929607, -88.458496476283003, 1.5333775291907901, -306.17152423250297, 211.834723659242, 189.348181800731, -164.85602878397, 1001.02895803198, -19.086531171244101, -14.1862411100869, 93.929906236367501, -177.880045125896, -6.7382862272631598, -14.511503830974201, 198.86948709278099, 116.24375034946701, -509.187787693936, -474.82187536023201, 185.49468275501101, -68.704359475869197, 0.066396729468773799, 128.61396390514599, 107.279152808508, -3.2214077352586501, 377.39638500462598, -258.32727230254102, -233.50899542599601, 202.73053181330999, -1222.6711957145401, 23.374193247961198, 17.0231928902612, -115.31992914359, 218.34781344598201, 8.5868800406738099, 17.706454078785399, -244.13052330624399, -142.42769283244499, 622.15335091370196, 579.15535219316803, -228.72024346964599, 85.262861528059901, 0.042977214694503003, -75.818887039648899, -63.4429496117761, 1.89037149893251, -221.440571714557, 152.54192851849001, 136.92110635753301, -119.073716594494, 720.98982202338402, -13.516656591400601, -9.7291496308540406, 67.372278162472895, -128.19425354399101, -4.9638472213270699, -10.200417492010599, 143.31769471617801, 83.615852083439094, -366.86654819753397, -341.426964056759, 133.98241248588599, -50.230799667840699, -0.074440153582489205, 131.003888225851, 110.340015781723, -1.92534262087524, 381.482058581253, -264.51148724341499, -236.035513173862, 204.43864191351099, -1249.3967405711001, 23.404380739562701, 17.427737318703301, -116.737852869633, 221.189913802663, 8.4677080090305399, 17.684126766935599, -247.44394443997601, -145.031902348194, 635.53348480709997, 592.58164589603302, -230.87850923206801, 85.694308069456397, -0.038299262589364599, -74.702005824131604, -63.171412849899497, 1.0859859506457199, -217.148397050222, 150.25957665606299, 134.431598757773, -117.013550651343, 708.34335491195498, -13.4940069422526, -9.5788103819957797, 66.593490547156307, -125.80391712960601, -4.7671091217963504, -10.2632044954116, 140.809682960885, 82.366527572926103, -360.28206877713399, -335.74815599116999, 131.925760239261, -48.660685665615503, -0.060749768867194, 106.92546569584999, 88.790343162838894, -2.6692288353747702, 312.16097467403699, -214.903931604847, -193.215823966269, 167.781122174079, -1018.10641886182, 19.107519450141002, 14.388719322765001, -95.267373183568594, 180.40857560667001, 6.9728512293157801, 14.4102075774752, -201.83015329787199, -117.917199027973, 518.09179195913805, 482.46342773412402, -189.25708821193001, 70.869624357767506, -0.000187411047696029, -11.9846117540694, -9.5726690972884096, 0.23970985157893901, -31.525734707294099, 26.424001662617101, 19.629541977294, -12.8111861333484, 126.186955595279, -0.21994779537689901, -1.75278408990554, 12.699562562401301, -19.050321348645301, 0.28466729039388, -1.07057307471916, 20.675591706275501, 13.1048598424623, -64.121267975873096, -59.394985304548896, 16.918592992744401, -7.70362909966763, 0.00036065684724530402, 12.9068309168011, 12.002712393435401, -0.33194601220397202, 40.326484701927001, -31.878253347415502, -25.170560077575001, 17.9905011861023, -156.05779622500401, 0.28522581276215098, 2.06069522309385, -17.151275363286, 25.397351917205899, 2.08581286823873, 0.91118057859336898, -26.515090998756101, -14.4035822159035, 78.890023885294596, 75.240667711773398, -20.769502289340899, 10.973365712218101, 0.00054214253230406803, -2.29504518628212, -2.1312244512866698, 0.047562978801466302, -10.6318457557031, 3.0591772010668401, 6.6375862982055702, -4.4363733110097296, 16.291945106274301, -0.062929125223047597, -0.16835581689436099, 6.0820271877694996, -5.8351950377758204, 0.35401259185447298, -0.90070453596893996, 6.0382685793059503, 2.4785619931575602, -8.4908203096171402, -8.6197966065449307, 5.8804527059182696, -1.67757738078734, 0.00096800508899916803, -2.4934502646428101, -4.5195305250493698, 0.052900907147883501, -6.5403147654399101, 8.5375829900159896, 4.1350660479474399, -1.63386715634978, 39.5635438458416, -0.11054656518749099, -0.56905231469759199, 10.2311793759502, -8.8014973731182806, -1.42214511908425, -1.9356586876592501, 7.4277556761303396, 2.8985267278915199, -19.981167223464801, -18.310196540769098, 1.3631485584979499, -1.4104996470922699, 0.000167515045034934, 10.6237721447983, 9.6125946891096099, -0.20829092726741699, 28.481388931713699, -22.584157610136199, -17.8392407006579, 11.6781776869203, -110.705963174229, 0.192721307745398, 1.4471736958685699, -11.629464509211299, 19.0388155304672, -0.23390314175395899, 0.62505732559282601, -19.284349111137399, -11.6199046959709, 56.562315732201498, 53.440734762614099, -13.464260193464, 6.5494922727750904, -0.00064712664753083498, 0.51012013976619996, -0.40601608060218902, -0.010304898323864499, -1.9162384482042301, 0.67040773560745603, 1.4195140953666501, 1.89175006728124, 8.4997123797302105, -0.053837688493721801, -0.0081694468687663092, 7.5841687069424202, -3.9864241641726901, 0.82441242748559596, 1.28841942280286, 2.4602644684099202, -0.65833650503714802, -2.93422340475106, -4.7994849299481297, -3.1153746742144999, 0.76509679552570997, -0.00094253467883977896, 4.5884404541075803, 2.5577714145483599, -0.100362327319965, 18.711173319888399, -7.5191542625802104, -11.814804467633101, 7.51205003788884, -36.605280961279099, 0.11460812693040601, 0.498461399643222, -10.903564320961401, 13.2948947844546, -0.64349351510306596, 1.9974412451213299, -11.727821769419799, -4.9603602940684901, 17.916362650168399, 17.291804112001799, -7.9761250950845, 3.6407278735208699, -0.000183321670183587, 6.4691421816769399, 6.0512576241625498, -0.15162968127745899, 23.395366108183801, -14.5381852262701, -14.606223833564799, 10.199271998597199, -73.975176230999594, 0.109352036334604, 0.939662287060122, -5.0493506777824901, 12.432450504307001, 0.66340082972807302, 0.89171490853171798, -14.301193838340501, -7.1767924210601599, 37.417730343433, 34.621199008384998, -12.2257905481279, 5.0337643040644098, 0.00077853683475417402, -4.0437466042030499, -3.2232682351578399, 0.038202731665628202, -12.153196028398099, 6.5027616010011799, 7.2973627140258399, -12.054113026894999, 23.6623418919025, 0.0029087480524890102, -0.465988240269751, -5.8215678299339997, -0.92982871489462304, 0.72875377435640498, -1.76856112702097, 3.9100682853776498, 4.3638012685037904, -12.532035664209801, -10.8596693966264, 12.5729914998231, -1.17795314966104, -0.00047116201805309901, 2.7712702890005598, 1.4259517039641101, -0.060855532638316702, 9.8783846948200704, -5.3156162802238898, -6.24217543532784, 4.0955113938692902, -22.6133771249789, 0.0576846298115802, 0.37261538596098298, -5.69311024324454, 6.6165547759347501, -0.31572322723037299, 1.2076815066994999, -7.13883450856141, -3.0036796657518701, 12.888731168100399, 10.144844547714699, -3.4202567509716602, 2.2424073656324301, 0.00046719815518450402, -6.1786048720593501, -4.9366254575058903, 0.121293000821164, -13.5354546658637, 11.122151465656, 8.2996176249675795, -7.8492497139147304, 53.792699096533298, -0.056207389907105297, -0.72284563910330601, -0.034988476570927102, -5.8914910450597402, -0.57259031868870103, -1.3110690999933601, 8.9888650972260002, 6.8430482968640902, -26.406527264610599, -25.8419474444987, 8.95444342115516, -4.1168180484580699, 0.00068908057573134802, -2.0076563509740999, -3.65231424825159, 0.042894239647239998, -9.7520285174303201, 7.9819862061298199, 6.2214414143151, -1.1841920217922099, 31.911005041941699, -0.080053013664620296, -0.54185675163812796, 8.0781654837979193, -9.3493294125201594, -1.24083642122091, -1.6208022544009499, 8.8607449463367196, 2.3445831189331501, -16.218420387174199, -15.8119148955707, 1.7389982134136399, -1.0509978817476, -3.48584361237575e-05, 0.61330220442703598, 2.33052219623813, -0.0057796507046079101, 5.3801162861110896, -1.7460100802854299, -3.4260231079769401, 1.85323155008146, -1.34565392401789, 0.0020702237459098, 0.147768044797361, -0.43649104760725999, 0.997972495465969, 0.056933085588242997, 0.0077486424610570597, -0.89070134502194598, -0.68148789029708001, 0.89518325797891696, 0.16523545732706499, -2.8298454160600501, 0.26096748561569599, -3.9951230141139501e-05, 2.6625953366596802, 0.159171360187916, -0.0080654609832386693, 14.485659114429501, 0.26188806209423798, -8.9564367313419204, 9.5170929366304993, 3.6594343436186199, 0.017879567938259198, 0.0042052494877241001, -1.4377710841437801, 5.8763150360799203, 0.47441391996743998, -0.014783250610591801, -7.06163381200634, -2.9885184999935599, -1.42889911045556, -2.4433038426403901, -9.8958894810457991, 0.55194555716779503, -5.7250805560848302e-05, 0.98372766353792995, 3.2392588139392098, -0.0119630481344816, 0.14153713576169, -2.73924503033615, 0.060309030316031902, 2.34167965625057, -3.8604817562043001, 0.012593073725828199, 0.22349082635471901, -0.35749918018293803, 2.0835157939561699, 0.13368765195851301, 0.0515445449292352, -2.95655438325227, -1.09680637412728, 2.2418386652533302, 1.2169977713442901, -1.20005576483735, 0.48385142427875799}; #endif From 60a2d2c9862c348c5fdc54d9d29621bbf9c163f7 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 23 Feb 2023 13:49:21 +0100 Subject: [PATCH 20/30] Fixes tab-key not working to open/close Org-mode sections in Emacs Evil mode. Fix works on Linux and macOS. --- tools/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/init.el b/tools/init.el index bf2b48f..f0470d7 100644 --- a/tools/init.el +++ b/tools/init.el @@ -58,8 +58,8 @@ (add-hook 'org-babel-after-execute-hook 'org-display-inline-images) '(indent-tabs-mode nil) -(require 'evil) (setq evil-want-C-i-jump nil) +(require 'evil) (evil-mode 1) (global-font-lock-mode t) (global-superword-mode 1) From 216fcebf707a386274188bf88c65b74d456ac89a Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 23 Feb 2023 16:17:39 +0100 Subject: [PATCH 21/30] Added fucntion that generates private c headers. --- tools/lib.org | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/tools/lib.org b/tools/lib.org index 2d55f34..46fe807 100644 --- a/tools/lib.org +++ b/tools/lib.org @@ -32,7 +32,6 @@ | ~C~ | ~double[n][ldc]~ | out | Array containing the $m \times n$ matrix $C$ | | ~ldc~ | ~int64_t~ | in | Leading dimension of array ~C~ | - *** Fortran-C type conversions #+NAME:f_of_c @@ -132,22 +131,36 @@ return template #+END_SRC - #+RESULTS: generate_c_header - #+begin_src c :tangle (eval h_func) :comments org - qmckl_exit_code [] ( - const qmckl_context context, - const char transa, - const char transb, - const int64_t m, - const int64_t n, - const double* A, - const int64_t lda, - const double* B, - const int64_t ldb, - double* const C, - const int64_t ldc ); - #+end_src + #+NAME: generate_private_c_header + #+BEGIN_SRC python :var table=test :var rettyp="qmckl_exit_code" :var fname=[] :results drawer :noweb yes :wrap "src c :tangle (eval h_private_func) :comments org" +<> +results = [] +for d in parse_table(table): + name = d["name"] + c_type = d["c_type"] + + # Add star for arrays + if d["rank"] > 0 or d["inout"] in ["out", "inout"]: + c_type += "*" + + if d["inout"] == "out": + c_type += " const" + + # Only inputs are const + if d["inout"] == "in": + const = "const " + else: + const = "" + + results += [ f" {const}{c_type} {name}" ] + +results=',\n'.join(results) +template = f"""{rettyp} {fname} (\n{results} ); """ +return template + + #+END_SRC + *** Generates a C interface to the Fortran function #+NAME: generate_c_interface @@ -255,8 +268,6 @@ results='\n'.join(results) return results #+END_SRC - - ** Creating provide functions #+NAME: write_provider_header @@ -421,3 +432,4 @@ return msg return QMCKL_SUCCESS; } #+end_src + From 7c57fe2b6fad8d2de8f510176aaed34c0e3b3044 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 23 Feb 2023 17:30:00 +0100 Subject: [PATCH 22/30] Added fucntion that generates private fortran interfaces to C functions. --- tools/lib.org | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/tools/lib.org b/tools/lib.org index 46fe807..8e3c719 100644 --- a/tools/lib.org +++ b/tools/lib.org @@ -240,6 +240,55 @@ results = [ f"interface" , "" ] +for d in parse_table(table): + f_type = f_of_c_d[d["c_type"]] + inout = "intent("+d["inout"]+")" + name = d["name"] + + # Input scalars are passed by value + if d["rank"] == 0 and d["inout"] == "in": + value = ", value" + else: + value = " " + + # Append dimensions to the name + if d["rank"] == 0: + dims = "" + else: + d["dims"].reverse() + dims = "(" + ",".join(d["dims"]) + ")" + + results += [ f" {f_type:20}, {inout:12}{value} :: {name}{dims}" ] + +results += [ "" +, f" end function {fname}" +, f"end interface" +] +results='\n'.join(results) +return results + #+END_SRC + + #+NAME: generate_private_f_interface + #+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh_private_func) :comments org :exports none" +<> +<> +<> +d = parse_table(table) + +args = ", ".join([ x["name"] for x in d ]) + +rettyp_c = ctypeid_d[rettyp.lower()] + +results = [ f"interface" +, f" {rettyp_c} function {fname} &" +, f" ({args}) &" +, " bind(C)" +, " use, intrinsic :: iso_c_binding" +, " import" +, " implicit none" +, "" +] + for d in parse_table(table): f_type = f_of_c_d[d["c_type"]] inout = "intent("+d["inout"]+")" From 5e5c15a09d7ebe8dd77264f6cc24aecce38e05b5 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 20 Feb 2023 18:31:39 +0100 Subject: [PATCH 23/30] - Added qmckl_context to Slagel Splitting kernel - Renamed it to Sherman-Morrison Splitting Core. - Sherman-Morrison Splitting Core now callable on its own. User is responsible for what to do with the output data. - Added default switch cases with asserts to generate crash with message if a template for a specific size is missing. - Added switch breaks to prevent the default case to always execute and make the kernel crash at the assert. - Reorganisded the Sherman-Morrison Splitting kernel so that the HPC variant always calls the Core HPC variant and not the generec variant and make duplicate decisions. --- org/qmckl_sherman_morrison_woodbury.org | 1305 ++++++++++++----------- 1 file changed, 709 insertions(+), 596 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 98193cc..4c69d63 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -29,7 +29,7 @@ int main() { This is the range that determines the how many high performance kernel instantces will be generated, using the C-function templates defined in the sections below. If the name of the C-function template is called ~qmckl_kernel_{Dim}~, then ~range(K, L+1)~ will results in kernel instances from ~qmckl_kernel_K~ to ~qmckl_kernel_L~. #+NAME:kernel_generator_range #+begin_src python :noweb yes :exports none -range(2, 22) +range(2, 3) #+end_src @@ -272,7 +272,7 @@ end function qmckl_sherman_morrison_naive_doc #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: -#+begin_src c :tangle (eval h_func) :comments org +#+begin_src c :tangle (eval h_func) : comments org qmckl_exit_code qmckl_sherman_morrison_naive ( const qmckl_context context, const uint64_t LDS, @@ -288,7 +288,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive ( #+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_hpc") #+RESULTS: -#+begin_src c :tangle (eval h_func) :comments org +#+begin_src c :tangle (eval h_private_func) :comments org qmckl_exit_code qmckl_sherman_morrison_naive_hpc ( const qmckl_context context, const uint64_t LDS, @@ -324,6 +324,7 @@ Common includes and macros used by all the Sherman-Morrison-Woodbury kernels. #include #include "qmckl.h" #include "config.h" +#include "assert.h" // Order important because // __GNUC__ also set in ICC, ICX and CLANG @@ -736,7 +737,603 @@ assert(rc == QMCKL_SUCCESS); #+end_src -* Sherman-Morrison with update splitting +* Sherman-Morrison with Slagel Splitting (core) +** ~qmckl_slagel_splitting~ +:PROPERTIES: +:Name: qmckl_slagel_splitting +:CRetType: qmckl_exit_code +:FRetType: qmckl_exit_code +:END: + +*** Introduction +~qmckl_slagel_splitting~ is the inner core part of 'Sherman-Morrison with update splitting' in the next section. +It is not normally used by itself but it is possible to use it nonetheless. + +It has three extra parameters in its API: +- ~later_updates~ initially empty array that will contain the second halves of updates that were split during kernel execution +- ~later_index~ initially empty array that will contain the row/column numbers of the updates that were split during execution +- ~later~ initially zero integer that records the number of updates that were split during exection. + +It is up to the user to decide what to do with these updates once the kernel returns. Normally ~qmckl_slagel_splitting~ is +used as the core part of a recursive function, as is done in ~qmckl_sherman_morrison_splitting~ or as part of a more complex +kernel like ~qmckl_sherman_morrison_smw32s~. + +If the determinant is passed it will only be partially updated if there were any update splits. + +*** API +#+NAME: qmckl_slagel_splitting_args +| Variable | Type | In/Out | Description | +|-----------------+-------------------------+--------+---------------------------------------------------------------| +| ~context~ | ~qmckl_context~ | in | Global state | +| ~LDS~ | ~uint64_t~ | in | Leading dimension of Slater_inv | +| ~Dim~ | ~uint64_t~ | in | Dimension of Slater_inv | +| ~N_updates~ | ~uint64_t~ | in | Number of rank-1 updates to be applied to Slater_inv | +| ~Updates~ | ~double[N_updates*LDS]~ | in | Array containing the rank-1 updates | +| ~Updates_index~ | ~uint64_t[N_updates]~ | in | Array containing positions of the rank-1 updates | +| ~breakdown~ | ~double~ | in | Break-down parameter on which to fail or not | +| ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse Slater-matrix | +| ~later_updates~ | ~double[N_updates*LDS]~ | inout | Array containing the split updates for later | +| ~later_index~ | ~uint64_t[N_updates]~ | inout | Array containing the positions of the split updates for later | +| ~later~ | ~uint64_t~ | inout | Number of split updates for later | +| ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | + +*** Requirements + * ~LDS >= 2~ + * ~Dim >= 2~ + * ~N_updates >= 1~ + * ~Updates~ is allocated with $N_updates \times Dim$ elements + * ~Updates_index~ is allocated with $N_updates$ elements + * ~breakdown~ is a small number such that $0 < breakdown << 1$ + * ~Slater_inv~ is allocated with $Dim \times Dim$ elements + * ~later_updates~ is allocated with $later \times Dim$ elements + * ~later_index~ is allocated with $N_updates$ elements + * ~later >= 0~ + +*** Pedagogical kernel source (in Fortran) +The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is +able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore +not be used in real workloads. + +#+begin_src f90 :tangle (eval f) +integer function qmckl_slagel_splitting_doc_f( & + context, & + lds, dim, & + nupdates, & + upds, & + updates_index, & + breakdown, & + s_inv, & + later_updates, & + later_index, & + later, & + determinant) result(info) + + use qmckl + implicit none + integer*8 , intent(in) :: context + integer*8 , intent(in) :: lds, dim + integer*8 , intent(in) :: nupdates + integer*8 , intent(in) :: updates_index(nupdates) + real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: breakdown + real*8 , intent(inout) :: s_inv(dim * lds) + real*8 , intent(inout) :: later_updates(nupdates * lds) + integer*8 , intent(inout) :: later_index(nupdates) + integer*8 , intent(inout) :: later + real*8 , intent(inout) :: determinant + + real*8 , dimension(lds, nupdates) :: Updates + real*8 , dimension(dim, lds) :: Inverse + + info = QMCKL_FAILURE + + if (context == QMCKL_NULL_CONTEXT) then + info = QMCKL_INVALID_CONTEXT + return + endif + + ! Convert 'upds' and 's_inv' into the more easily readable Fortran + ! matrices 'Updates' and 'Inverse'. + call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) + + ! YET TO BE IMPLEMENTED + + ! Copy updated inverse back to s_inv + call copy_back(Inverse, s_inv, lds, dim) + + info = QMCKL_SUCCESS + +end function qmckl_slagel_splitting_doc_f +#+end_src + +**** C interface to the pedagogical kernel (not directly exposed) +The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure +that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in +Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function +~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h' +for C users and in the module file 'qmckl_f.F90' for Fortran users. + +#+CALL: generate_c_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval f) :comments org :exports none +integer(c_int32_t) function qmckl_slagel_splitting_doc & + (context, & + LDS, & + Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + later_updates, & + later_index, & + later, & + determinant) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + integer(c_int32_t), external :: qmckl_slagel_splitting_doc_f + info = qmckl_slagel_splitting_doc_f & + (context, & + LDS, & + Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + later_updates, & + later_index, & + later, & + determinant) + +end function qmckl_slagel_splitting_doc +#+end_src + +*** C headers (exposed in qmckl.h) +#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) + +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_slagel_splitting ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* later_updates, + uint64_t* later_index, + uint64_t* later, + double* determinant ); +#+end_src + +#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc") + +#+RESULTS: +#+begin_src c :tangle (eval h_func) :comments org +qmckl_exit_code qmckl_slagel_splitting_doc ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* later_updates, + uint64_t* later_index, + uint64_t* later, + double* determinant ); +#+end_src + +*** C sources +#+begin_src c :tangle (eval c) :comments org +qmckl_exit_code qmckl_slagel_splitting_hpc( + const qmckl_context context, + uint64_t LDS, + uint64_t Dim, + uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict later_updates, + uint64_t* __restrict later_index, + uint64_t* __restrict later, + double* __restrict determinant) { + + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith( + context, + QMCKL_NULL_CONTEXT, + "qmckl_slagel_splitting_hpc", + NULL); + } + + double __attribute__((aligned(8))) C[LDS]; + double __attribute__((aligned(8))) D[LDS]; + + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = S^{-1} x U_l + for (uint64_t i = 0; i < Dim; i++) { + C[i] = 0.0f; + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; + } + } + + // Denominator + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; + if (fabs(den) < breakdown) { + // U_l = U_l / 2: split the update in 2 equal halves and save the + // second halve in later_updates + IVDEP + ALIGNED + for (uint64_t i = 0; i < LDS; i++) { + later_updates[*later * LDS + i] = Updates[l * LDS + i] * 0.5f; + C[i] *= 0.5f; + } + later_index[*later] = Updates_index[l]; + (*later)++; + + den = 1.0f + C[cui]; + } // From here onwards we continue with applying the first halve of the + // update to Slater_inv + double iden = 1.0f / den; + + if (determinant) + *determinant *= den; + + // D = v^T x S^{-1} : 1 x LDS + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + D[j] = Slater_inv[cui * LDS + j]; + } + + // S^{-1} = S^{-1} - C x D / den + for (uint64_t i = 0; i < Dim; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < LDS; j++) { + const double update = C[i] * D[j] * iden; + Slater_inv[i * LDS + j] -= update; + } + } + l += 1; + } + + return QMCKL_SUCCESS; +} + #+end_src + +#+NAME:slagel_splitting_template_code +#+begin_src c +static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( + const qmckl_context context, + uint64_t N_updates, + const double* __restrict Updates, + const uint64_t* __restrict Updates_index, + const double breakdown, + double* __restrict Slater_inv, + double* __restrict later_updates, + uint64_t* __restrict later_index, + uint64_t* __restrict later, + double* __restrict determinant) { + + if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { + return qmckl_failwith( + context, + QMCKL_NULL_CONTEXT, + "qmckl_slagel_splitting_{Dim}", + NULL); + } + + double __attribute__((aligned(8))) C[D{Dim}_P]; + double __attribute__((aligned(8))) D[D{Dim}_P]; + + uint64_t l = 0; + // For each update + while (l < N_updates) { + // C = S^{-1} x U_l + for (uint64_t i = 0; i < {Dim}; i++) { + C[i] = 0.0f; + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; + } + } + + // Denominator + const int cui = Updates_index[l] - 1; + double den = 1.0f + C[cui]; + if (fabs(den) < breakdown) { + // U_l = U_l / 2: split the update in 2 equal halves and save the + // second halve in later_updates + IVDEP + ALIGNED + for (uint64_t i = 0; i < D{Dim}_P; i++) { + later_updates[*later * D{Dim}_P + i] = Updates[l * D{Dim}_P + i] * 0.5f; + C[i] *= 0.5f; + } + later_index[*later] = Updates_index[l]; + (*later)++; + + den = 1.0f + C[cui]; + } // From here onwards we continue with applying the first halve of the + // update to Slater_inv + double iden = 1.0f / den; + + if (determinant) + *determinant *= den; + + // D = v^T x S^{-1} : 1 x D{Dim}_P + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + D[j] = Slater_inv[cui * D{Dim}_P + j]; + } + + // S^{-1} = S^{-1} - C x D / den + for (uint64_t i = 0; i < {Dim}; i++) { + IVDEP + ALIGNED + for (uint64_t j = 0; j < D{Dim}_P; j++) { + const double update = C[i] * D[j] * iden; + Slater_inv[i * D{Dim}_P + j] -= update; + } + } + l += 1; + } + + return QMCKL_SUCCESS; +} +#+end_src + +#+NAME:slagel_splitting_kernel_generator +#+begin_src python :noweb yes +text=""" +<> +""" +result = [] +for Dim in <>: + Dim=str(Dim) + result.append(text.replace("{Dim}",Dim) ) + +return '\n'.join(result) +#+end_src + +#+NAME:slagel_splitting_switch-case_generator +#+begin_src python :noweb yes +text=""" +case {Dim}: { + return qmckl_slagel_splitting_{Dim}( + context, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, + later, + determinant); + break; +} +""" +result = [] +for Dim in <>: + Dim=str(Dim) + result.append(text.replace("{Dim}",Dim) ) + +return '\n'.join(result) +#+end_src + +#+begin_src c :tangle (eval c) :comments org :noweb yes +<> +#+end_src + +#+begin_src c :tangle (eval c) :comments org :noweb yes +qmckl_exit_code qmckl_slagel_splitting( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* later_updates, + uint64_t* later_index, + uint64_t* later, + double* determinant) { + + #ifdef HAVE_HPC + if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases + switch (Dim) { + <> + case default: { + assert(0 == 1 && "TEMPLATE NOT IMPLEMENTED!"); + break; + } + } + } + else { // Updating smaller sub-matrix + return qmckl_slagel_splitting_hpc( + context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, + later, + determinant); + } + #else + // return qmckl_slagel_splitting_doc( + // context, + // LDS, + // Dim, + // N_updates, + // Updates, + // Updates_index, + // breakdown, + // Slater_inv, + // later_updates, + // later_index, + // later, + // determinant); + return qmckl_slagel_splitting_hpc( + context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, + later, + determinant); + #endif + + return QMCKL_FAILURE; +} +#+end_src + +*** Fortran interfaces (exposed in qmckl_f.F90) +:PROPERTIES: +:Name: qmckl_slagel_splitting +:CRetType: qmckl_exit_code +:FRetType: qmckl_exit_code +:END: + +#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_hpc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_slagel_splitting_hpc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, & + Slater_inv, later_updates, later_index, later, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + end function qmckl_slagel_splitting_hpc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_doc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_slagel_splitting_doc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, & + Slater_inv, later_updates, later_index, later, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + end function qmckl_slagel_splitting_doc +end interface +#+end_src + +#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_slagel_splitting & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, & + Slater_inv, later_updates, later_index, later, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + end function qmckl_slagel_splitting +end interface +#+end_src + +*** Performance +This function cannot be used by itself and is used in Sherman-Morrison with update splitting and Woodbury 3x3 and 2x2 +with Sherman-Morrison and update splitting. Please look at the performance reccomendations for those two kernels. + + +* Sherman-Morrison with Slagel Splitting ** ~qmckl_sherman_morrison_splitting~ :PROPERTIES: :Name: qmckl_sherman_morrison_splitting @@ -914,37 +1511,76 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_doc ( #+end_src *** C source -#+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { +#+NAME:splitting_switch-case_generator +#+begin_src python :noweb yes +text=""" +case {Dim}: { + rc = qmckl_slagel_splitting_{Dim}( + context, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + later_updates, + later_index, &later, determinant); + break; +} +""" +result = [] +for Dim in <>: + Dim=str(Dim) + result.append(text.replace("{Dim}",Dim) ) + +return '\n'.join(result) +#+end_src + +#+begin_src c :tangle (eval c) :comments org :noweb yes +qmckl_exit_code qmckl_sherman_morrison_splitting_hpc( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_splitting", - NULL); + return qmckl_failwith( + context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_splitting_hpc", + NULL); } double __attribute__((aligned(8))) later_updates[LDS * N_updates]; uint64_t later_index[N_updates]; uint64_t later = 0; - qmckl_exit_code rc = qmckl_slagel_splitting( - LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, - later_updates, later_index, &later, determinant); + qmckl_exit_code rc; + if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { + switch (Dim) { + <> + default: { + assert(0 == 1 && "TEMPLATE NOT IMPLEMENTED!"); + break; + } + } + } else { + rc = qmckl_slagel_splitting_hpc( + context, LDS, Dim, N_updates, Updates, Updates_index, + breakdown, Slater_inv, later_updates, + later_index, &later, determinant); + } if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; if (later > 0) { - qmckl_exit_code rc = qmckl_sherman_morrison_splitting( - context, LDS, Dim, later, later_updates, later_index, breakdown, - Slater_inv, determinant); + qmckl_exit_code rc = qmckl_sherman_morrison_splitting_hpc( + context, LDS, Dim, later, + later_updates, later_index, + breakdown, Slater_inv, determinant); if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; } @@ -952,56 +1588,60 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc(const qmckl_context context } #+end_src -#+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_sherman_morrison_splitting(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { +#+begin_src c :tangle (eval c) :comment org +qmckl_exit_code qmckl_sherman_morrison_splitting( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_splitting", - NULL); + return qmckl_failwith( + context, + QMCKL_NULL_CONTEXT, + "qmckl_sherman_morrison_splitting", + NULL); } - #ifdef HAS_HPC - return qmckl_sherman_morrison_splitting_hpc(context, - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); + return qmckl_sherman_morrison_splitting_hpc( + context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); #else - // return qmckl_sherman_morrison_splitting_doc(context, - // LDS, - // Dim, - // N_updates, - // Updates, - // Updates_index, - // breakdown, - // Slater_inv, - // determinant); - return qmckl_sherman_morrison_splitting_hpc(context, - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); - #endif - - return QMCKL_SUCCESS; + // return qmckl_sherman_morrison_splitting_doc( + // context, + // LDS, + // Dim, + // N_updates, + // Updates, + // Updates_index, + // breakdown, + // Slater_inv, + // determinant); + return qmckl_sherman_morrison_splitting_hpc( + context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); + #endif + + return QMCKL_SUCCESS; } #+end_src @@ -1124,533 +1764,6 @@ assert(rc == QMCKL_SUCCESS); #+end_src -* Slagel Splitting -** ~qmckl_slagel_splitting~ -:PROPERTIES: -:Name: qmckl_slagel_splitting -:CRetType: qmckl_exit_code -:FRetType: qmckl_exit_code -:END: - -*** Introduction -~qmckl_slagel_splitting~ is the non-recursive, inner part of the 'Sherman-Morrison with update splitting'-kernel. -It is used internally to apply a collection of $N$ rank-1 updates to the inverse Slater-matrix $S^{-1}$ and -splitting an update in two equal pieces if necessary. In case of a split, it applies the first half of the update, -while putting the second half in a waiting queue to be applied at the end. - -Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, the update is applied as usual. Otherwise, $u_j$ will be redefined -as $\frac{1}{2}u_j$. One half is applied immediately, the other half will be applied at the end of the algorithm, using vectors -$u_{j'}=\frac{1}{2}u_j$ and $v_{j'}^T=v_{j}^T$, which are stored in the array \texttt{later_updates}. - -If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting -from applying the updates to the original matrix. - -*** API -#+NAME: qmckl_slagel_splitting_args -| Variable | Type | In/Out | Description | -|-----------------+-------------------------+--------+---------------------------------------------------------------| -| ~LDS~ | ~uint64_t~ | in | Leading dimension of Slater_inv | -| ~Dim~ | ~uint64_t~ | in | Dimension of Slater_inv | -| ~N_updates~ | ~uint64_t~ | in | Number of rank-1 updates to be applied to Slater_inv | -| ~Updates~ | ~double[N_updates*LDS]~ | in | Array containing the rank-1 updates | -| ~Updates_index~ | ~uint64_t[N_updates]~ | in | Array containing positions of the rank-1 updates | -| ~breakdown~ | ~double~ | in | Break-down parameter on which to fail or not | -| ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse Slater-matrix | -| ~later_updates~ | ~double[N_updates*LDS]~ | inout | Array containing the split updates for later | -| ~later_index~ | ~uint64_t[N_updates]~ | inout | Array containing the positions of the split updates for later | -| ~later~ | ~uint64_t~ | inout | Number of split updates for later | -| ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | - -*** Requirements - * ~LDS >= 2~ - * ~Dim >= 2~ - * ~N_updates >= 1~ - * ~Updates~ is allocated with $N_updates \times Dim$ elements - * ~Updates_index~ is allocated with $N_updates$ elements - * ~breakdown~ is a small number such that $0 < breakdown << 1$ - * ~Slater_inv~ is allocated with $Dim \times Dim$ elements - * ~later_updates~ is allocated with $later \times Dim$ elements - * ~later_index~ is allocated with $N_updates$ elements - * ~later >= 0~ - -*** Pedagogical kernel source (in Fortran) -The following source code written in Fortran is inteded to illustrate how the kernel works. Even though the kernel is -able to do numerically correct computations, it does not do it in the most efficient way possible. It should therefore -not be used in real workloads. - -#+begin_src f90 :tangle (eval f) -integer function qmckl_slagel_splitting_doc_f( & - lds, dim, & - nupdates, & - upds, & - updates_index, & - breakdown, & - s_inv, & - later_updates, & - later_index, & - later, & - determinant) result(info) - - use qmckl - implicit none - integer*8 , intent(in) :: lds, dim - integer*8 , intent(in) :: nupdates - integer*8 , intent(in) :: updates_index(nupdates) - real*8 , intent(in) :: upds(nupdates * lds) - real*8 , intent(in) :: breakdown - real*8 , intent(inout) :: s_inv(dim * lds) - real*8 , intent(inout) :: later_updates(nupdates * lds) - integer*8 , intent(inout) :: later_index(nupdates) - integer*8 , intent(inout) :: later - real*8 , intent(inout) :: determinant - - real*8 , dimension(lds, nupdates) :: Updates - real*8 , dimension(dim, lds) :: Inverse - - info = QMCKL_FAILURE - - ! Convert 'upds' and 's_inv' into the more easily readable Fortran - ! matrices 'Updates' and 'Inverse'. - call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) - - ! YET TO BE IMPLEMENTED - - ! Copy updated inverse back to s_inv - call copy_back(Inverse, s_inv, lds, dim) - - info = QMCKL_SUCCESS - -end function qmckl_slagel_splitting_doc_f -#+end_src - -**** C interface to the pedagogical kernel (not directly exposed) -The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure -that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in -Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function -~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h' -for C users and in the module file 'qmckl_f.F90' for Fortran users. - -#+CALL: generate_c_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc") - -#+RESULTS: -#+begin_src f90 :tangle (eval f) :comments org :exports none -integer(c_int32_t) function qmckl_slagel_splitting_doc & - (LDS, & - Dim, & - N_updates, & - Updates, & - Updates_index, & - breakdown, & - Slater_inv, & - later_updates, & - later_index, & - later, & - determinant) & - bind(C) result(info) - - use, intrinsic :: iso_c_binding - implicit none - - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) - integer (c_int64_t) , intent(inout) :: later_index(N_updates) - integer (c_int64_t) , intent(inout) :: later - real (c_double ) , intent(inout) :: determinant - - integer(c_int32_t), external :: qmckl_slagel_splitting_doc_f - info = qmckl_slagel_splitting_doc_f & - (LDS, & - Dim, & - N_updates, & - Updates, & - Updates_index, & - breakdown, & - Slater_inv, & - later_updates, & - later_index, & - later, & - determinant) - -end function qmckl_slagel_splitting_doc -#+end_src - -*** C headers (exposed in qmckl.h) -#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) - -#+RESULTS: -#+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_slagel_splitting ( - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* later_updates, - uint64_t* later_index, - uint64_t* later, - double* determinant ); -#+end_src - -*** C sources -#+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_slagel_splitting_hpc( - uint64_t LDS, - uint64_t Dim, - uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict later_updates, - uint64_t* __restrict later_index, - uint64_t* __restrict later, - double* __restrict determinant) { - - double __attribute__((aligned(8))) C[LDS]; - double __attribute__((aligned(8))) D[LDS]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = S^{-1} x U_l - for (uint64_t i = 0; i < Dim; i++) { - C[i] = 0.0f; - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - C[i] += Slater_inv[i * LDS + j] * Updates[l * LDS + j]; - } - } - - // Denominator - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; - if (fabs(den) < breakdown) { - // U_l = U_l / 2: split the update in 2 equal halves and save the - // second halve in later_updates - IVDEP - ALIGNED - for (uint64_t i = 0; i < LDS; i++) { - later_updates[*later * LDS + i] = Updates[l * LDS + i] * 0.5f; - C[i] *= 0.5f; - } - later_index[*later] = Updates_index[l]; - (*later)++; - - den = 1.0f + C[cui]; - } // From here onwards we continue with applying the first halve of the - // update to Slater_inv - double iden = 1.0f / den; - - if (determinant) - *determinant *= den; - - // D = v^T x S^{-1} : 1 x LDS - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - D[j] = Slater_inv[cui * LDS + j]; - } - - // S^{-1} = S^{-1} - C x D / den - for (uint64_t i = 0; i < Dim; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < LDS; j++) { - const double update = C[i] * D[j] * iden; - Slater_inv[i * LDS + j] -= update; - } - } - l += 1; - } - - return QMCKL_SUCCESS; -} - #+end_src - -#+NAME:slagel_splitting_template_code -#+begin_src c -static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( - uint64_t N_updates, - const double* __restrict Updates, - const uint64_t* __restrict Updates_index, - const double breakdown, - double* __restrict Slater_inv, - double* __restrict later_updates, - uint64_t* __restrict later_index, - uint64_t* __restrict later, - double* __restrict determinant) { - - double __attribute__((aligned(8))) C[D{Dim}_P]; - double __attribute__((aligned(8))) D[D{Dim}_P]; - - uint64_t l = 0; - // For each update - while (l < N_updates) { - // C = S^{-1} x U_l - for (uint64_t i = 0; i < {Dim}; i++) { - C[i] = 0.0f; - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - C[i] += Slater_inv[i * D{Dim}_P + j] * Updates[l * D{Dim}_P + j]; - } - } - - // Denominator - const int cui = Updates_index[l] - 1; - double den = 1.0f + C[cui]; - if (fabs(den) < breakdown) { - // U_l = U_l / 2: split the update in 2 equal halves and save the - // second halve in later_updates - IVDEP - ALIGNED - for (uint64_t i = 0; i < D{Dim}_P; i++) { - later_updates[*later * D{Dim}_P + i] = Updates[l * D{Dim}_P + i] * 0.5f; - C[i] *= 0.5f; - } - later_index[*later] = Updates_index[l]; - (*later)++; - - den = 1.0f + C[cui]; - } // From here onwards we continue with applying the first halve of the - // update to Slater_inv - double iden = 1.0f / den; - - if (determinant) - *determinant *= den; - - // D = v^T x S^{-1} : 1 x D{Dim}_P - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - D[j] = Slater_inv[cui * D{Dim}_P + j]; - } - - // S^{-1} = S^{-1} - C x D / den - for (uint64_t i = 0; i < {Dim}; i++) { - IVDEP - ALIGNED - for (uint64_t j = 0; j < D{Dim}_P; j++) { - const double update = C[i] * D[j] * iden; - Slater_inv[i * D{Dim}_P + j] -= update; - } - } - l += 1; - } - - return QMCKL_SUCCESS; -} -#+end_src - -#+NAME:slagel_splitting_kernel_generator -#+begin_src python :noweb yes -text=""" -<> -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) -#+end_src - -#+NAME:slagel_splitting_switch-case_generator -#+begin_src python :noweb yes -text=""" -case {Dim}: - return qmckl_slagel_splitting_{Dim}( - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - later_updates, - later_index, - later, - determinant); -""" -result = [] -for Dim in <>: - Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) - -return '\n'.join(result) -#+end_src - -#+begin_src c :tangle (eval c) :comments org :noweb yes -<> -#+end_src - -#+begin_src c :tangle (eval c) :comments org :noweb yes -qmckl_exit_code qmckl_slagel_splitting( - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* later_updates, - uint64_t* later_index, - uint64_t* later, - double* determinant) { - - #ifdef HAVE_HPC - if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases - switch (Dim) { - <> - } - } - else { // Updating smaller sub-matrix - return qmckl_slagel_splitting_hpc( - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - later_updates, - later_index, - later, - determinant); - } - #else - // return qmckl_slagel_splitting_doc( - // LDS, - // Dim, - // N_updates, - // Updates, - // Updates_index, - // breakdown, - // Slater_inv, - // later_updates, - // later_index, - // later, - // determinant); - return qmckl_slagel_splitting_hpc( - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - later_updates, - later_index, - later, - determinant); - #endif - - return QMCKL_FAILURE; -} -#+end_src - -*** Fortran interfaces (exposed in qmckl_f.F90) -:PROPERTIES: -:Name: qmckl_slagel_splitting -:CRetType: qmckl_exit_code -:FRetType: qmckl_exit_code -:END: - -#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_hpc") - -#+RESULTS: -#+begin_src f90 :tangle (eval fh_func) :comments org :exports none -interface - integer(c_int32_t) function qmckl_slagel_splitting_hpc & - (LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, later, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) - integer (c_int64_t) , intent(inout) :: later_index(N_updates) - integer (c_int64_t) , intent(inout) :: later - real (c_double ) , intent(inout) :: determinant - - end function qmckl_slagel_splitting_hpc -end interface -#+end_src - -#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_doc") - -#+RESULTS: -#+begin_src f90 :tangle (eval fh_func) :comments org :exports none -interface - integer(c_int32_t) function qmckl_slagel_splitting_doc & - (LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, later, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) - integer (c_int64_t) , intent(inout) :: later_index(N_updates) - integer (c_int64_t) , intent(inout) :: later - real (c_double ) , intent(inout) :: determinant - - end function qmckl_slagel_splitting_doc -end interface -#+end_src - -#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting") - -#+RESULTS: -#+begin_src f90 :tangle (eval fh_func) :comments org :exports none -interface - integer(c_int32_t) function qmckl_slagel_splitting & - (LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, later, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) - integer (c_int64_t) , intent(inout) :: later_index(N_updates) - integer (c_int64_t) , intent(inout) :: later - real (c_double ) , intent(inout) :: determinant - - end function qmckl_slagel_splitting -end interface -#+end_src - -*** Performance -This function cannot be used by itself and is used in Sherman-Morrison with update splitting and Woodbury 3x3 and 2x2 -with Sherman-Morrison and update splitting. Please look at the performance reccomendations for those two kernels. - * End of files From 8ba882675e3ee098b8cf949b8083b0519adf49da Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 20 Feb 2023 18:51:20 +0100 Subject: [PATCH 24/30] Renamed function prefixes. --- org/qmckl_sherman_morrison_woodbury.org | 244 ++++++++++++------------ 1 file changed, 122 insertions(+), 122 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 4c69d63..c91e185 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -34,9 +34,9 @@ range(2, 3) * Naïve Sherman-Morrison -** ~qmckl_sherman_morrison_naive~ +** ~qmckl_sm_naive~ :PROPERTIES: -:Name: qmckl_sherman_morrison_naive +:Name: qmckl_sm_naive :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: @@ -75,7 +75,7 @@ If the determinant of the Slater-matrix is passed, it will be updated to the det from applying the updates to the original matrix. *** API -#+NAME: qmckl_sherman_morrison_naive_args +#+NAME: qmckl_sm_naive_args | Variable | Type | In/Out | Description | |-----------------+-------------------------+--------+------------------------------------------------------| | ~context~ | ~qmckl_context~ | in | Global state | @@ -150,7 +150,7 @@ end subroutine copy_back #+end_src #+begin_src f90 :tangle (eval f) -integer function qmckl_sherman_morrison_naive_doc_f(context, & +integer function qmckl_sm_naive_doc_f(context, & lds, dim, & nupdates, & upds, & @@ -230,20 +230,20 @@ integer function qmckl_sherman_morrison_naive_doc_f(context, & info = QMCKL_SUCCESS -end function qmckl_sherman_morrison_naive_doc_f +end function qmckl_sm_naive_doc_f #+end_src **** C interface to the pedagogical kernel (not directly exposed) -The following Fortran function ~qmckl_sherman_morrison_naive_doc~ makes sure -that the pedagogical kernel ~qmckl_sherman_morrison_naive_doc_f~, written in -Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function ~qmckl_sherman_morrison_naive_doc~ will be exposed in the header file 'qmckl.h' +The following Fortran function ~qmckl_sm_naive_doc~ makes sure +that the pedagogical kernel ~qmckl_sm_naive_doc_f~, written in +Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function ~qmckl_sm_naive_doc~ will be exposed in the header file 'qmckl.h' for C users and in the module file 'qmckl_f.F90' for Fortran users. -#+CALL: generate_c_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") +#+CALL: generate_c_interface(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_doc") #+RESULTS: #+begin_src f90 :tangle (eval f) :comments org :exports none -integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & +integer(c_int32_t) function qmckl_sm_naive_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) result(info) @@ -260,20 +260,20 @@ integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - integer(c_int32_t), external :: qmckl_sherman_morrison_naive_doc_f - info = qmckl_sherman_morrison_naive_doc_f & + integer(c_int32_t), external :: qmckl_sm_naive_doc_f + info = qmckl_sm_naive_doc_f & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) -end function qmckl_sherman_morrison_naive_doc +end function qmckl_sm_naive_doc #+end_src *** C headers (exposed in qmckl.h) -#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) +#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: #+begin_src c :tangle (eval h_func) : comments org -qmckl_exit_code qmckl_sherman_morrison_naive ( +qmckl_exit_code qmckl_sm_naive ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -285,11 +285,11 @@ qmckl_exit_code qmckl_sherman_morrison_naive ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_hpc") +#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_hpc") #+RESULTS: #+begin_src c :tangle (eval h_private_func) :comments org -qmckl_exit_code qmckl_sherman_morrison_naive_hpc ( +qmckl_exit_code qmckl_sm_naive_hpc ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -301,11 +301,11 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_naive_doc") +#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_doc") #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_sherman_morrison_naive_doc ( +qmckl_exit_code qmckl_sm_naive_doc ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -344,8 +344,8 @@ Common includes and macros used by all the Sherman-Morrison-Woodbury kernels. #endif #+end_src -~qmckl_sherman_morrison_naive_hpc~ is a high performance variation of -~qmckl_sherman_morrison_naive~ written in C. It is used in cases when ~Dim~ is +~qmckl_sm_naive_hpc~ is a high performance variation of +~qmckl_sm_naive~ written in C. It is used in cases when ~Dim~ is smaller than the leading dimension ~LDS~, irrespective of whetether ~LDS~ includes zero padding to benefit from SIMD instructions or not. Cases like this include situations where one wants to apply updates to a square submatrix of the @@ -354,7 +354,7 @@ It takes advantage of memory aligned data and assumes no data dependencies inside the loops. The loops are fully vectorised whenever ~Dim~ is an integer multiple of ~SIMD_LEGTH~. #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_sherman_morrison_naive_hpc( +qmckl_exit_code qmckl_sm_naive_hpc( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -368,7 +368,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { return qmckl_failwith( context, QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive_hpc", + "qmckl_sm_naive_hpc", NULL); } @@ -423,10 +423,10 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( } #+end_src -~qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}~ is a C function-template that is used to genereate instances of C fucntions based on the range given above. The advantage of this method is that for each of these instances all the dimensions and loop-bounds are known at compile time, allowing the compiler to optimize more aggressively. +~qmckl_exit_code qmckl_sm_naive_{Dim}~ is a C function-template that is used to genereate instances of C fucntions based on the range given above. The advantage of this method is that for each of these instances all the dimensions and loop-bounds are known at compile time, allowing the compiler to optimize more aggressively. #+NAME:naive_template_code #+begin_src c - static inline qmckl_exit_code qmckl_sherman_morrison_naive_{Dim}( + static inline qmckl_exit_code qmckl_sm_naive_{Dim}( const qmckl_context context, const uint64_t N_updates, const double* __restrict Updates, @@ -438,7 +438,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive_hpc( if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { return qmckl_failwith(context, QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive_{Dim}", + "qmckl_sm_naive_{Dim}", NULL); } @@ -516,7 +516,7 @@ Python script that generated C switch cases that call individual kernel instance #+begin_src python :noweb yes text=""" case {Dim}: - return qmckl_sherman_morrison_naive_{Dim}(context, + return qmckl_sm_naive_{Dim}(context, N_updates, Updates, Updates_index, @@ -536,9 +536,9 @@ return '\n'.join(result) <> #+end_src -~qmckl_sherman_morrison_naive~ is a generic function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~. +~qmckl_sm_naive~ is a generic function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~. #+begin_src c :tangle (eval c) :comments org :noweb yes -qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, +qmckl_exit_code qmckl_sm_naive(const qmckl_context context, const uint64_t LDS, const uint64_t Dim, const uint64_t N_updates, @@ -551,7 +551,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { return qmckl_failwith(context, QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_naive", + "qmckl_sm_naive", NULL); } @@ -562,7 +562,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, } } else { // Updating smaller sub-matrix - return qmckl_sherman_morrison_naive_hpc(context, + return qmckl_sm_naive_hpc(context, LDS, Dim, N_updates, @@ -573,7 +573,7 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, determinant); } #else - return qmckl_sherman_morrison_naive_doc(context, + return qmckl_sm_naive_doc(context, LDS, Dim, N_updates, @@ -590,17 +590,17 @@ qmckl_exit_code qmckl_sherman_morrison_naive(const qmckl_context context, *** Fortran interfaces (exposed in qmckl_f.F90) :PROPERTIES: - :Name: qmckl_sherman_morrison_naive + :Name: qmckl_sm_naive :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: -#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive_hpc") +#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_hpc") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_sherman_morrison_naive_hpc & + integer(c_int32_t) function qmckl_sm_naive_hpc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) use, intrinsic :: iso_c_binding @@ -617,16 +617,16 @@ interface real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - end function qmckl_sherman_morrison_naive_hpc + end function qmckl_sm_naive_hpc end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive_doc") +#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_doc") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_sherman_morrison_naive_doc & + integer(c_int32_t) function qmckl_sm_naive_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) use, intrinsic :: iso_c_binding @@ -643,16 +643,16 @@ interface real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - end function qmckl_sherman_morrison_naive_doc + end function qmckl_sm_naive_doc end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_sherman_morrison_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_naive") +#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_sherman_morrison_naive & + integer(c_int32_t) function qmckl_sm_naive & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) use, intrinsic :: iso_c_binding @@ -669,7 +669,7 @@ interface real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - end function qmckl_sherman_morrison_naive + end function qmckl_sm_naive end interface #+end_src @@ -701,7 +701,7 @@ assert(Slater_inv1 != NULL); // original determinant of Slater1 (before applying updates) double det = 3.407025646103221e-10; -rc = qmckl_sherman_morrison_naive(context, +rc = qmckl_sm_naive(context, LDS, Dim, N_updates1, @@ -738,15 +738,15 @@ assert(rc == QMCKL_SUCCESS); * Sherman-Morrison with Slagel Splitting (core) -** ~qmckl_slagel_splitting~ +** ~qmckl_sm_splitting_core~ :PROPERTIES: -:Name: qmckl_slagel_splitting +:Name: qmckl_sm_splitting_core :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: *** Introduction -~qmckl_slagel_splitting~ is the inner core part of 'Sherman-Morrison with update splitting' in the next section. +~qmckl_sm_splitting_core~ is the inner core part of 'Sherman-Morrison with update splitting' in the next section. It is not normally used by itself but it is possible to use it nonetheless. It has three extra parameters in its API: @@ -754,14 +754,14 @@ It has three extra parameters in its API: - ~later_index~ initially empty array that will contain the row/column numbers of the updates that were split during execution - ~later~ initially zero integer that records the number of updates that were split during exection. -It is up to the user to decide what to do with these updates once the kernel returns. Normally ~qmckl_slagel_splitting~ is -used as the core part of a recursive function, as is done in ~qmckl_sherman_morrison_splitting~ or as part of a more complex +It is up to the user to decide what to do with these updates once the kernel returns. Normally ~qmckl_sm_splitting_core~ is +used as the core part of a recursive function, as is done in ~qmckl_sm_splitting~ or as part of a more complex kernel like ~qmckl_sherman_morrison_smw32s~. If the determinant is passed it will only be partially updated if there were any update splits. *** API -#+NAME: qmckl_slagel_splitting_args +#+NAME: qmckl_sm_splitting_core_args | Variable | Type | In/Out | Description | |-----------------+-------------------------+--------+---------------------------------------------------------------| | ~context~ | ~qmckl_context~ | in | Global state | @@ -795,7 +795,7 @@ able to do numerically correct computations, it does not do it in the most effic not be used in real workloads. #+begin_src f90 :tangle (eval f) -integer function qmckl_slagel_splitting_doc_f( & +integer function qmckl_sm_splitting_core_doc_f( & context, & lds, dim, & nupdates, & @@ -843,21 +843,21 @@ integer function qmckl_slagel_splitting_doc_f( & info = QMCKL_SUCCESS -end function qmckl_slagel_splitting_doc_f +end function qmckl_sm_splitting_core_doc_f #+end_src **** C interface to the pedagogical kernel (not directly exposed) -The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure -that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in +The following Fortran function ~qmckl_sm_splitting_core_doc~ makes sure +that the pedagogical kernel ~qmckl_sm_splitting_core_doc_f~, written in Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function -~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h' +~qmckl_sm_splitting_core_doc~ will be exposed in the header file 'qmckl.h' for C users and in the module file 'qmckl_f.F90' for Fortran users. -#+CALL: generate_c_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc") +#+CALL: generate_c_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc") #+RESULTS: #+begin_src f90 :tangle (eval f) :comments org :exports none -integer(c_int32_t) function qmckl_slagel_splitting_doc & +integer(c_int32_t) function qmckl_sm_splitting_core_doc & (context, & LDS, & Dim, & @@ -888,8 +888,8 @@ integer(c_int32_t) function qmckl_slagel_splitting_doc & integer (c_int64_t) , intent(inout) :: later real (c_double ) , intent(inout) :: determinant - integer(c_int32_t), external :: qmckl_slagel_splitting_doc_f - info = qmckl_slagel_splitting_doc_f & + integer(c_int32_t), external :: qmckl_sm_splitting_core_doc_f + info = qmckl_sm_splitting_core_doc_f & (context, & LDS, & Dim, & @@ -903,15 +903,15 @@ integer(c_int32_t) function qmckl_slagel_splitting_doc & later, & determinant) -end function qmckl_slagel_splitting_doc +end function qmckl_sm_splitting_core_doc #+end_src *** C headers (exposed in qmckl.h) -#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) +#+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_slagel_splitting ( +qmckl_exit_code qmckl_sm_splitting_core ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -926,11 +926,11 @@ qmckl_exit_code qmckl_slagel_splitting ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_slagel_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_slagel_splitting_doc") +#+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc") #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_slagel_splitting_doc ( +qmckl_exit_code qmckl_sm_splitting_core_doc ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -947,7 +947,7 @@ qmckl_exit_code qmckl_slagel_splitting_doc ( *** C sources #+begin_src c :tangle (eval c) :comments org -qmckl_exit_code qmckl_slagel_splitting_hpc( +qmckl_exit_code qmckl_sm_splitting_core_hpc( const qmckl_context context, uint64_t LDS, uint64_t Dim, @@ -965,7 +965,7 @@ qmckl_exit_code qmckl_slagel_splitting_hpc( return qmckl_failwith( context, QMCKL_NULL_CONTEXT, - "qmckl_slagel_splitting_hpc", + "qmckl_sm_splitting_core_hpc", NULL); } @@ -1033,7 +1033,7 @@ qmckl_exit_code qmckl_slagel_splitting_hpc( #+NAME:slagel_splitting_template_code #+begin_src c -static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( +static inline qmckl_exit_code qmckl_sm_splitting_core_{Dim}( const qmckl_context context, uint64_t N_updates, const double* __restrict Updates, @@ -1049,7 +1049,7 @@ static inline qmckl_exit_code qmckl_slagel_splitting_{Dim}( return qmckl_failwith( context, QMCKL_NULL_CONTEXT, - "qmckl_slagel_splitting_{Dim}", + "qmckl_sm_splitting_core_{Dim}", NULL); } @@ -1132,7 +1132,7 @@ return '\n'.join(result) #+begin_src python :noweb yes text=""" case {Dim}: { - return qmckl_slagel_splitting_{Dim}( + return qmckl_sm_splitting_core_{Dim}( context, N_updates, Updates, @@ -1159,7 +1159,7 @@ return '\n'.join(result) #+end_src #+begin_src c :tangle (eval c) :comments org :noweb yes -qmckl_exit_code qmckl_slagel_splitting( +qmckl_exit_code qmckl_sm_splitting_core( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -1184,7 +1184,7 @@ qmckl_exit_code qmckl_slagel_splitting( } } else { // Updating smaller sub-matrix - return qmckl_slagel_splitting_hpc( + return qmckl_sm_splitting_core_hpc( context, LDS, Dim, @@ -1199,7 +1199,7 @@ qmckl_exit_code qmckl_slagel_splitting( determinant); } #else - // return qmckl_slagel_splitting_doc( + // return qmckl_sm_splitting_core_doc( // context, // LDS, // Dim, @@ -1212,7 +1212,7 @@ qmckl_exit_code qmckl_slagel_splitting( // later_index, // later, // determinant); - return qmckl_slagel_splitting_hpc( + return qmckl_sm_splitting_core_hpc( context, LDS, Dim, @@ -1233,17 +1233,17 @@ qmckl_exit_code qmckl_slagel_splitting( *** Fortran interfaces (exposed in qmckl_f.F90) :PROPERTIES: -:Name: qmckl_slagel_splitting +:Name: qmckl_sm_splitting_core :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: -#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_hpc") +#+CALL: generate_f_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_core_hpc") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_slagel_splitting_hpc & + integer(c_int32_t) function qmckl_sm_splitting_core_hpc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, & Slater_inv, later_updates, later_index, later, determinant) & bind(C) @@ -1264,16 +1264,16 @@ interface integer (c_int64_t) , intent(inout) :: later real (c_double ) , intent(inout) :: determinant - end function qmckl_slagel_splitting_hpc + end function qmckl_sm_splitting_core_hpc end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting_doc") +#+CALL: generate_f_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_core_doc") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_slagel_splitting_doc & + integer(c_int32_t) function qmckl_sm_splitting_core_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, & Slater_inv, later_updates, later_index, later, determinant) & bind(C) @@ -1294,16 +1294,16 @@ interface integer (c_int64_t) , intent(inout) :: later real (c_double ) , intent(inout) :: determinant - end function qmckl_slagel_splitting_doc + end function qmckl_sm_splitting_core_doc end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_slagel_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_slagel_splitting") +#+CALL: generate_f_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_core") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_slagel_splitting & + integer(c_int32_t) function qmckl_sm_splitting_core & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, & Slater_inv, later_updates, later_index, later, determinant) & bind(C) @@ -1324,7 +1324,7 @@ interface integer (c_int64_t) , intent(inout) :: later real (c_double ) , intent(inout) :: determinant - end function qmckl_slagel_splitting + end function qmckl_sm_splitting_core end interface #+end_src @@ -1334,9 +1334,9 @@ with Sherman-Morrison and update splitting. Please look at the performance recco * Sherman-Morrison with Slagel Splitting -** ~qmckl_sherman_morrison_splitting~ +** ~qmckl_sm_splitting~ :PROPERTIES: -:Name: qmckl_sherman_morrison_splitting +:Name: qmckl_sm_splitting :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: @@ -1357,7 +1357,7 @@ If the determinant of the Slater-matrix is passed, it will be updated to the det from applying the updates to the original matrix. *** API -#+NAME: qmckl_sherman_morrison_splitting_args +#+NAME: qmckl_sm_splitting_args | Variable | Type | In/Out | Description | |---------------+-----------------------+--------+------------------------------------------------------| | context | qmckl_context | in | Global state | @@ -1386,7 +1386,7 @@ able to do numerically correct computations, it does not do it in the most effic not be used in real workloads. #+begin_src f90 :tangle (eval f) -integer function qmckl_sherman_morrison_splitting_doc_f(context, & +integer function qmckl_sm_splitting_doc_f(context, & lds, dim, & nupdates, & upds, & @@ -1422,21 +1422,21 @@ integer function qmckl_sherman_morrison_splitting_doc_f(context, & info = QMCKL_SUCCESS -end function qmckl_sherman_morrison_splitting_doc_f +end function qmckl_sm_splitting_doc_f #+end_src **** C interface to the pedagogical kernel (not directly exposed) -The following Fortran function ~qmckl_slagel_splitting_doc~ makes sure -that the pedagogical kernel ~qmckl_slagel_splitting_doc_f~, written in +The following Fortran function ~qmckl_sm_splitting_core_doc~ makes sure +that the pedagogical kernel ~qmckl_sm_splitting_core_doc_f~, written in Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function -~qmckl_slagel_splitting_doc~ will be exposed in the header file 'qmckl.h' +~qmckl_sm_splitting_core_doc~ will be exposed in the header file 'qmckl.h' for C users and in the module file 'qmckl_f.F90' for Fortran users. -#+CALL: generate_c_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_doc") +#+CALL: generate_c_interface(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_doc") #+RESULTS: #+begin_src f90 :tangle (eval f) :comments org :exports none -integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc & +integer(c_int32_t) function qmckl_sm_splitting_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) result(info) @@ -1453,20 +1453,20 @@ integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc & real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - integer(c_int32_t), external :: qmckl_sherman_morrison_splitting_doc_f - info = qmckl_sherman_morrison_splitting_doc_f & + integer(c_int32_t), external :: qmckl_sm_splitting_doc_f + info = qmckl_sm_splitting_doc_f & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) -end function qmckl_sherman_morrison_splitting_doc +end function qmckl_sm_splitting_doc #+end_src *** C headers (exposed in qmckl.h) -#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) +#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname=get_value("Name")) #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_sherman_morrison_splitting ( +qmckl_exit_code qmckl_sm_splitting ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -1478,11 +1478,11 @@ qmckl_exit_code qmckl_sherman_morrison_splitting ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_hpc") +#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_hpc") #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_sherman_morrison_splitting_hpc ( +qmckl_exit_code qmckl_sm_splitting_hpc ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -1494,11 +1494,11 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sherman_morrison_splitting_doc") +#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_doc") #+RESULTS: #+begin_src c :tangle (eval h_func) :comments org -qmckl_exit_code qmckl_sherman_morrison_splitting_doc ( +qmckl_exit_code qmckl_sm_splitting_doc ( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -1515,7 +1515,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_doc ( #+begin_src python :noweb yes text=""" case {Dim}: { - rc = qmckl_slagel_splitting_{Dim}( + rc = qmckl_sm_splitting_core_{Dim}( context, N_updates, Updates, @@ -1536,7 +1536,7 @@ return '\n'.join(result) #+end_src #+begin_src c :tangle (eval c) :comments org :noweb yes -qmckl_exit_code qmckl_sherman_morrison_splitting_hpc( +qmckl_exit_code qmckl_sm_splitting_hpc( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -1551,7 +1551,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc( return qmckl_failwith( context, QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_splitting_hpc", + "qmckl_sm_splitting_hpc", NULL); } @@ -1569,7 +1569,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc( } } } else { - rc = qmckl_slagel_splitting_hpc( + rc = qmckl_sm_splitting_core_hpc( context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, later_updates, later_index, &later, determinant); @@ -1577,7 +1577,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc( if (rc != QMCKL_SUCCESS) return QMCKL_FAILURE; if (later > 0) { - qmckl_exit_code rc = qmckl_sherman_morrison_splitting_hpc( + qmckl_exit_code rc = qmckl_sm_splitting_hpc( context, LDS, Dim, later, later_updates, later_index, breakdown, Slater_inv, determinant); @@ -1589,7 +1589,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting_hpc( #+end_src #+begin_src c :tangle (eval c) :comment org -qmckl_exit_code qmckl_sherman_morrison_splitting( +qmckl_exit_code qmckl_sm_splitting( const qmckl_context context, const uint64_t LDS, const uint64_t Dim, @@ -1604,11 +1604,11 @@ qmckl_exit_code qmckl_sherman_morrison_splitting( return qmckl_failwith( context, QMCKL_NULL_CONTEXT, - "qmckl_sherman_morrison_splitting", + "qmckl_sm_splitting", NULL); } #ifdef HAS_HPC - return qmckl_sherman_morrison_splitting_hpc( + return qmckl_sm_splitting_hpc( context, LDS, Dim, @@ -1619,7 +1619,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting( Slater_inv, determinant); #else - // return qmckl_sherman_morrison_splitting_doc( + // return qmckl_sm_splitting_doc( // context, // LDS, // Dim, @@ -1629,7 +1629,7 @@ qmckl_exit_code qmckl_sherman_morrison_splitting( // breakdown, // Slater_inv, // determinant); - return qmckl_sherman_morrison_splitting_hpc( + return qmckl_sm_splitting_hpc( context, LDS, Dim, @@ -1647,17 +1647,17 @@ qmckl_exit_code qmckl_sherman_morrison_splitting( *** Fortran interfaces (exposed in qmckl_f.F90) :PROPERTIES: - :Name: qmckl_sherman_morrison_naive + :Name: qmckl_sm_naive :CRetType: qmckl_exit_code :FRetType: qmckl_exit_code :END: -#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting_hpc") +#+CALL: generate_f_interface(table=qmckl_sm_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_hpc") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_sherman_morrison_splitting_hpc & + integer(c_int32_t) function qmckl_sm_splitting_hpc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) use, intrinsic :: iso_c_binding @@ -1674,16 +1674,16 @@ interface real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - end function qmckl_sherman_morrison_splitting_hpc + end function qmckl_sm_splitting_hpc end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting_doc") +#+CALL: generate_f_interface(table=qmckl_sm_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting_doc") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_sherman_morrison_splitting_doc & + integer(c_int32_t) function qmckl_sm_splitting_doc & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) use, intrinsic :: iso_c_binding @@ -1700,16 +1700,16 @@ interface real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - end function qmckl_sherman_morrison_splitting_doc + end function qmckl_sm_splitting_doc end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_sherman_morrison_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sherman_morrison_splitting") +#+CALL: generate_f_interface(table=qmckl_sm_splitting_args,rettyp=get_value("FRetType"),fname="qmckl_sm_splitting") #+RESULTS: #+begin_src f90 :tangle (eval fh_func) :comments org :exports none interface - integer(c_int32_t) function qmckl_sherman_morrison_splitting & + integer(c_int32_t) function qmckl_sm_splitting & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & bind(C) use, intrinsic :: iso_c_binding @@ -1726,7 +1726,7 @@ interface real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant - end function qmckl_sherman_morrison_splitting + end function qmckl_sm_splitting end interface #+end_src @@ -1739,7 +1739,7 @@ assert(Updates3 != NULL); assert(Updates_index3 != NULL); assert(Slater_inv3_2 != NULL); det = -1.23743195512859e-09; -rc = qmckl_sherman_morrison_splitting(context, LDS, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2, &det); +rc = qmckl_sm_splitting(context, LDS, Dim, N_updates3, Updates3, Updates_index3, breakdown, Slater_inv3_2, &det); assert(fabs(det - 1.602708950725074e-10) < 1e-15); for (unsigned int i = 0; i < Dim; i++) { for (unsigned int j = 0; j < Dim; j++) { From 8216f682b38ce0e7598fe4d2a0757656603de873 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Tue, 21 Feb 2023 19:27:23 +0100 Subject: [PATCH 25/30] Strange Fortran type error... --- org/qmckl_sherman_morrison_woodbury.org | 363 ++++++++++++++---------- 1 file changed, 217 insertions(+), 146 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index c91e185..d323cab 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -132,7 +132,7 @@ end subroutine convert #+end_src #+begin_src f90 :tangle (eval f) :comment org :exports none -subroutine copy_back(Inverse, s_inv, lds, dim) +subroutine copy_back_inv(Inverse, s_inv, lds, dim) implicit none integer*8 , intent(in) :: lds, dim real*8 , intent(in) , dimension(dim, lds) :: Inverse @@ -146,7 +146,25 @@ subroutine copy_back(Inverse, s_inv, lds, dim) s_inv((i - 1) * lds + j) = Inverse(i, j) end do end do -end subroutine copy_back +end subroutine copy_back_inv +#+end_src + +#+begin_src f90 :tangle (eval f) :comment org :exports none +subroutine copy_back_lu(Later_updates, later_upds, lds, nupdates) + implicit none + integer*8 , intent(in) :: lds, nupdates + real*8 , intent(in) , dimension(nupdates, lds) :: Later_updates + real*8 , intent(out) :: later_upds(nupdates * lds) + + integer*8 :: i, j + + ! Copy updated inverse back to s_inv + do i = 1, nupdates + do j = 1, lds + later_upds((i - 1) * lds + j) = Later_updates(i, j) + end do + end do +end subroutine copy_back_lu #+end_src #+begin_src f90 :tangle (eval f) @@ -539,20 +557,21 @@ return '\n'.join(result) ~qmckl_sm_naive~ is a generic function that contains decision making logic that calls the proper kernel based on the used library configuration (~--enable-doc~ and ~--enable-hpc~) and the passed array dimensions ~LDS~ and ~Dim~. #+begin_src c :tangle (eval c) :comments org :noweb yes qmckl_exit_code qmckl_sm_naive(const qmckl_context context, - const uint64_t LDS, - const uint64_t Dim, - const uint64_t N_updates, - const double* Updates, - const uint64_t* Updates_index, - const double breakdown, - double* Slater_inv, - double* determinant) { + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* determinant) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { - return qmckl_failwith(context, - QMCKL_NULL_CONTEXT, - "qmckl_sm_naive", - NULL); + return qmckl_failwith( + context, + QMCKL_NULL_CONTEXT, + "qmckl_sm_naive", + NULL); } #ifdef HAVE_HPC @@ -562,26 +581,28 @@ qmckl_exit_code qmckl_sm_naive(const qmckl_context context, } } else { // Updating smaller sub-matrix - return qmckl_sm_naive_hpc(context, - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); + return qmckl_sm_naive_hpc( + context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); } #else - return qmckl_sm_naive_doc(context, - LDS, - Dim, - N_updates, - Updates, - Updates_index, - breakdown, - Slater_inv, - determinant); + return qmckl_sm_naive_doc( + context, + LDS, + Dim, + N_updates, + Updates, + Updates_index, + breakdown, + Slater_inv, + determinant); #endif return QMCKL_FAILURE; @@ -621,6 +642,32 @@ interface end interface #+end_src +#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sm_naive & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sm_naive +end interface +#+end_src + #+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_doc") #+RESULTS: @@ -647,32 +694,6 @@ interface end interface #+end_src -#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive") - -#+RESULTS: -#+begin_src f90 :tangle (eval fh_func) :comments org :exports none -interface - integer(c_int32_t) function qmckl_sm_naive & - (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_sm_naive -end interface -#+end_src - *** Performance This function performs best when there is only 1 rank-1 update in the update cycle. It is not useful to use Sherman-Morrison with update splitting for these cycles since splitting @@ -803,27 +824,32 @@ integer function qmckl_sm_splitting_core_doc_f( & updates_index, & breakdown, & s_inv, & - later_updates, & - later_index, & - later, & + later_upds, & + Later_index, & + Later, & determinant) result(info) use qmckl implicit none - integer*8 , intent(in) :: context - integer*8 , intent(in) :: lds, dim - integer*8 , intent(in) :: nupdates - integer*8 , intent(in) :: updates_index(nupdates) - real*8 , intent(in) :: upds(nupdates * lds) - real*8 , intent(in) :: breakdown - real*8 , intent(inout) :: s_inv(dim * lds) - real*8 , intent(inout) :: later_updates(nupdates * lds) - integer*8 , intent(inout) :: later_index(nupdates) - integer*8 , intent(inout) :: later - real*8 , intent(inout) :: determinant + integer*8 , intent(in) :: context + integer*8 , intent(in) :: lds, dim + integer*8 , intent(in) :: nupdates + integer*8 , intent(in) :: updates_index(nupdates) + real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: breakdown + real*8 , intent(inout) :: s_inv(dim * lds) + real*8 , intent(inout) :: determinant + integer*8 , intent(inout) :: Later + integer*8 , intent(inout) :: Later_index(nupdates) + real*8 , intent(inout) :: later_upds(nupdates * lds) - real*8 , dimension(lds, nupdates) :: Updates + real*8 , dimension(nupdates, lds) :: Updates + real*8 , dimension(nupdates, lds) :: Later_updates real*8 , dimension(dim, lds) :: Inverse + real*8 , dimension(dim) :: C + real*8 , dimension(lds) :: D + real*8 :: denominator, idenominator, update + integer*8 :: i, j, l, row info = QMCKL_FAILURE @@ -831,15 +857,65 @@ integer function qmckl_sm_splitting_core_doc_f( & info = QMCKL_INVALID_CONTEXT return endif - + ! Convert 'upds' and 's_inv' into the more easily readable Fortran ! matrices 'Updates' and 'Inverse'. call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) - ! YET TO BE IMPLEMENTED - ! Copy updated inverse back to s_inv - call copy_back(Inverse, s_inv, lds, dim) + l = 1; + ! For each update do... + do while (l < nupdates + 1) + + ! Compute C = S^{-1}U(l) + do i = 1, dim + C(i) = 0 + do j = 1, dim + C(i) = C(i) + Inverse(i, j) * Updates(j, l) + end do + end do + + ! Compute denominator = 1 + V(l)^TC + row = updates_index(l) + denominator = 1 + C(row) + + ! If denominator is too close to zero: + ! - Split update in 2 before storing in Later_updates + ! - Split previously computed vector C in 2 + ! - Recompute the denominator + if (abs(denominator) < breakdown) then + do i = 1, dim + Later_updates(i, l) = Updates(i, l) / 2 + C(i) = C(i) / 2 + end do + Later_index(Later) = updates_index(l) + Later = Later + 1 + denominator = 1 + C(row) + end if + + idenominator = 1 / denominator + + ! Update det(S) + determinant = determinant * denominator + + ! selecting column: v_l^T * S_inv + D = Inverse(row, :) + + ! A^{-1} = A^{-1} - C x D / denominator + do i = 1, dim + do j = 1, dim + update = C(i) * D(j) * idenominator + Inverse(i, j) = Inverse(i, j) - update + end do + end do + + l = l + 1 + end do + + ! Copy updated inverse and later updates + ! back to s_inv and later_upds + call copy_back_inv(Inverse, s_inv, lds, dim) + call copy_back_lu(Later_Updates, later_upds, lds, nupdates) info = QMCKL_SUCCESS @@ -855,57 +931,6 @@ for C users and in the module file 'qmckl_f.F90' for Fortran users. #+CALL: generate_c_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc") -#+RESULTS: -#+begin_src f90 :tangle (eval f) :comments org :exports none -integer(c_int32_t) function qmckl_sm_splitting_core_doc & - (context, & - LDS, & - Dim, & - N_updates, & - Updates, & - Updates_index, & - breakdown, & - Slater_inv, & - later_updates, & - later_index, & - later, & - determinant) & - bind(C) result(info) - - use, intrinsic :: iso_c_binding - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) - integer (c_int64_t) , intent(inout) :: later_index(N_updates) - integer (c_int64_t) , intent(inout) :: later - real (c_double ) , intent(inout) :: determinant - - integer(c_int32_t), external :: qmckl_sm_splitting_core_doc_f - info = qmckl_sm_splitting_core_doc_f & - (context, & - LDS, & - Dim, & - N_updates, & - Updates, & - Updates_index, & - breakdown, & - Slater_inv, & - later_updates, & - later_index, & - later, & - determinant) - -end function qmckl_sm_splitting_core_doc -#+end_src - *** C headers (exposed in qmckl.h) #+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname=get_value("Name")) @@ -926,10 +951,29 @@ qmckl_exit_code qmckl_sm_splitting_core ( double* determinant ); #+end_src +#+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_hpc") + +#+RESULTS: +#+begin_src c :tangle (eval h_private_func) :comments org +qmckl_exit_code qmckl_sm_splitting_core_hpc ( + const qmckl_context context, + const uint64_t LDS, + const uint64_t Dim, + const uint64_t N_updates, + const double* Updates, + const uint64_t* Updates_index, + const double breakdown, + double* Slater_inv, + double* later_updates, + uint64_t* later_index, + uint64_t* later, + double* determinant ); +#+end_src + #+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc") #+RESULTS: -#+begin_src c :tangle (eval h_func) :comments org +#+begin_src c :tangle (eval h_func) :no-expand comments org qmckl_exit_code qmckl_sm_splitting_core_doc ( const qmckl_context context, const uint64_t LDS, @@ -1386,7 +1430,8 @@ able to do numerically correct computations, it does not do it in the most effic not be used in real workloads. #+begin_src f90 :tangle (eval f) -integer function qmckl_sm_splitting_doc_f(context, & +integer recursive function qmckl_sm_splitting_doc_f( & + context, & lds, dim, & nupdates, & upds, & @@ -1397,28 +1442,54 @@ integer function qmckl_sm_splitting_doc_f(context, & use qmckl implicit none - integer*8 , intent(in) :: context - integer*8 , intent(in) :: lds, dim - integer*8 , intent(in) :: nupdates - integer*8 , intent(in) :: updates_index(nupdates) - real*8 , intent(in) :: upds(nupdates * lds) - real*8 , intent(in) :: breakdown - real*8 , intent(inout) :: s_inv(dim * lds) - real*8 , intent(inout) :: determinant + integer*8 , intent(in) :: context + integer*8 , intent(in) :: lds, dim + integer*8 , intent(in) :: nupdates + integer*8 , intent(in) :: updates_index(nupdates) + real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: breakdown + real*8 , intent(inout) :: s_inv(dim * lds) + real*8 , intent(inout) :: determinant - real*8 , dimension(lds, nupdates) :: Updates - real*8 , dimension(dim, lds) :: Inverse + integer*8 :: Later + integer*8 , dimension(nupdates) :: Later_index + real*8 , dimension(nupdates * lds) :: Later_updates info = QMCKL_FAILURE - ! Convert 'upds' and 's_inv' into the more easily readable Fortran - ! matrices 'Updates' and 'Inverse'. - call convert(upds, s_inv, Updates, Inverse, nupdates, lds, dim) + if (context == QMCKL_NULL_CONTEXT) then + info = QMCKL_INVALID_CONTEXT + return + endif - ! YET TO BE IMPLEMENTED + Later = 0 + Later_index = 0 + Later_updates = 0 - ! Copy updated inverse back to s_inv - call copy_back(Inverse, s_inv, lds, dim) + info = qmckl_sm_splitting_core_doc_f( & + context, & + lds, dim, & + nupdates, & + upds, & + updates_index, & + breakdown, & + s_inv, & + Later_updates, & + Later_index, & + Later, & + determinant) + + if (Later > 0) then + info = qmckl_sm_splitting_doc_f( & + context, & + lds, dim, & + Later, & + Later_updates, & + Later_index, & + breakdown, & + s_inv, & + determinant) + end if info = QMCKL_SUCCESS From 7a97aa4a77c913a90226e0dc446ab0294929616c Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 23 Feb 2023 15:57:35 +0100 Subject: [PATCH 26/30] Fixed Fortran function call bug. --- org/qmckl_sherman_morrison_woodbury.org | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index d323cab..c2d1127 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -29,7 +29,7 @@ int main() { This is the range that determines the how many high performance kernel instantces will be generated, using the C-function templates defined in the sections below. If the name of the C-function template is called ~qmckl_kernel_{Dim}~, then ~range(K, L+1)~ will results in kernel instances from ~qmckl_kernel_K~ to ~qmckl_kernel_L~. #+NAME:kernel_generator_range #+begin_src python :noweb yes :exports none -range(2, 3) +range(2, 22) #+end_src @@ -244,7 +244,7 @@ integer function qmckl_sm_naive_doc_f(context, & end do ! Copy updated inverse back to s_inv - call copy_back(Inverse, s_inv, lds, dim) + call copy_back_inv(Inverse, s_inv, lds, dim) info = QMCKL_SUCCESS @@ -1451,6 +1451,8 @@ integer recursive function qmckl_sm_splitting_doc_f( & real*8 , intent(inout) :: s_inv(dim * lds) real*8 , intent(inout) :: determinant + integer , external :: qmckl_sm_splitting_core_doc_f + integer*8 :: Later integer*8 , dimension(nupdates) :: Later_index real*8 , dimension(nupdates * lds) :: Later_updates @@ -1690,17 +1692,7 @@ qmckl_exit_code qmckl_sm_splitting( Slater_inv, determinant); #else - // return qmckl_sm_splitting_doc( - // context, - // LDS, - // Dim, - // N_updates, - // Updates, - // Updates_index, - // breakdown, - // Slater_inv, - // determinant); - return qmckl_sm_splitting_hpc( + return qmckl_sm_splitting_doc( context, LDS, Dim, @@ -1710,6 +1702,16 @@ qmckl_exit_code qmckl_sm_splitting( breakdown, Slater_inv, determinant); + // return qmckl_sm_splitting_hpc( + // context, + // LDS, + // Dim, + // N_updates, + // Updates, + // Updates_index, + // breakdown, + // Slater_inv, + // determinant); #endif return QMCKL_SUCCESS; From 8e2674a3b2f9f8062555ed8228848c360b7889bd Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Thu, 23 Feb 2023 17:16:55 +0100 Subject: [PATCH 27/30] reorder --- org/qmckl_sherman_morrison_woodbury.org | 52 ++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index c2d1127..831abda 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -616,32 +616,6 @@ qmckl_exit_code qmckl_sm_naive(const qmckl_context context, :FRetType: qmckl_exit_code :END: -#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_hpc") - -#+RESULTS: -#+begin_src f90 :tangle (eval fh_func) :comments org :exports none -interface - integer(c_int32_t) function qmckl_sm_naive_hpc & - (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & - bind(C) - use, intrinsic :: iso_c_binding - import - implicit none - - integer (c_int64_t) , intent(in) , value :: context - integer (c_int64_t) , intent(in) , value :: LDS - integer (c_int64_t) , intent(in) , value :: Dim - integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) - integer (c_int64_t) , intent(in) :: Updates_index(N_updates) - real (c_double ) , intent(in) , value :: breakdown - real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: determinant - - end function qmckl_sm_naive_hpc -end interface -#+end_src - #+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname=get_value("Name")) #+RESULTS: @@ -668,6 +642,32 @@ interface end interface #+end_src +#+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_hpc") + +#+RESULTS: +#+begin_src f90 :tangle (eval fh_func) :comments org :exports none +interface + integer(c_int32_t) function qmckl_sm_naive_hpc & + (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) & + bind(C) + use, intrinsic :: iso_c_binding + import + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: determinant + + end function qmckl_sm_naive_hpc +end interface +#+end_src + #+CALL: generate_f_interface(table=qmckl_sm_naive_args,rettyp=get_value("FRetType"),fname="qmckl_sm_naive_doc") #+RESULTS: From 656d2681873204923d6b87c2ec61e91464d290de Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Sun, 26 Feb 2023 12:26:33 +0100 Subject: [PATCH 28/30] qmckl_sm_splitting_doc kernel works. --- org/qmckl_sherman_morrison_woodbury.org | 125 +++++++++++++++++------- 1 file changed, 88 insertions(+), 37 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 831abda..36e62bc 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -153,7 +153,7 @@ end subroutine copy_back_inv subroutine copy_back_lu(Later_updates, later_upds, lds, nupdates) implicit none integer*8 , intent(in) :: lds, nupdates - real*8 , intent(in) , dimension(nupdates, lds) :: Later_updates + real*8 , intent(in) , dimension(lds, nupdates) :: Later_updates real*8 , intent(out) :: later_upds(nupdates * lds) integer*8 :: i, j @@ -161,7 +161,7 @@ subroutine copy_back_lu(Later_updates, later_upds, lds, nupdates) ! Copy updated inverse back to s_inv do i = 1, nupdates do j = 1, lds - later_upds((i - 1) * lds + j) = Later_updates(i, j) + later_upds((i - 1) * lds + j) = Later_updates(j, i) end do end do end subroutine copy_back_lu @@ -303,7 +303,7 @@ qmckl_exit_code qmckl_sm_naive ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_hpc") +#+CALL: generate_private_c_header(table=qmckl_sm_naive_args,rettyp=get_value("CRetType"),fname="qmckl_sm_naive_hpc") #+RESULTS: #+begin_src c :tangle (eval h_private_func) :comments org @@ -343,6 +343,7 @@ Common includes and macros used by all the Sherman-Morrison-Woodbury kernels. #include "qmckl.h" #include "config.h" #include "assert.h" +#include "stdio.h" // Order important because // __GNUC__ also set in ICC, ICX and CLANG @@ -835,22 +836,24 @@ integer function qmckl_sm_splitting_core_doc_f( & integer*8 , intent(in) :: lds, dim integer*8 , intent(in) :: nupdates integer*8 , intent(in) :: updates_index(nupdates) - real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: upds(lds * nupdates) real*8 , intent(in) :: breakdown real*8 , intent(inout) :: s_inv(dim * lds) real*8 , intent(inout) :: determinant integer*8 , intent(inout) :: Later integer*8 , intent(inout) :: Later_index(nupdates) - real*8 , intent(inout) :: later_upds(nupdates * lds) + real*8 , intent(inout) :: later_upds(lds * nupdates) - real*8 , dimension(nupdates, lds) :: Updates - real*8 , dimension(nupdates, lds) :: Later_updates + real*8 , dimension(lds, nupdates) :: Updates + real*8 , dimension(lds, nupdates) :: Later_updates real*8 , dimension(dim, lds) :: Inverse real*8 , dimension(dim) :: C real*8 , dimension(lds) :: D real*8 :: denominator, idenominator, update integer*8 :: i, j, l, row + write(*,*) "Entering 'qmckl_sm_splittinig_core_doc_f'" + info = QMCKL_FAILURE if (context == QMCKL_NULL_CONTEXT) then @@ -888,7 +891,7 @@ integer function qmckl_sm_splitting_core_doc_f( & Later_updates(i, l) = Updates(i, l) / 2 C(i) = C(i) / 2 end do - Later_index(Later) = updates_index(l) + Later_index(Later + 1) = updates_index(l) Later = Later + 1 denominator = 1 + C(row) end if @@ -919,6 +922,8 @@ integer function qmckl_sm_splitting_core_doc_f( & info = QMCKL_SUCCESS + write(*,*) "Leaving 'qmckl_sm_splittinig_core_doc_f'" + end function qmckl_sm_splitting_core_doc_f #+end_src @@ -931,6 +936,62 @@ for C users and in the module file 'qmckl_f.F90' for Fortran users. #+CALL: generate_c_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc") +#+RESULTS: +#+begin_src f90 :tangle (eval f) :comments org :exports none +integer(c_int32_t) function qmckl_sm_splitting_core_doc & + (context, & + LDS, & + Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + later_updates, & + later_index, & + later, & + determinant) & + bind(C) result(info) + + use, intrinsic :: iso_c_binding + implicit none + + integer (c_int64_t) , intent(in) , value :: context + integer (c_int64_t) , intent(in) , value :: LDS + integer (c_int64_t) , intent(in) , value :: Dim + integer (c_int64_t) , intent(in) , value :: N_updates + real (c_double ) , intent(in) :: Updates(N_updates*LDS) + integer (c_int64_t) , intent(in) :: Updates_index(N_updates) + real (c_double ) , intent(in) , value :: breakdown + real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) + real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + integer (c_int64_t) , intent(inout) :: later_index(N_updates) + integer (c_int64_t) , intent(inout) :: later + real (c_double ) , intent(inout) :: determinant + + integer(c_int32_t), external :: qmckl_sm_splitting_core_doc_f + + write(*,*) "Entering 'qmckl_sm_splittinig_core_doc'" + + info = qmckl_sm_splitting_core_doc_f & + (context, & + LDS, & + Dim, & + N_updates, & + Updates, & + Updates_index, & + breakdown, & + Slater_inv, & + later_updates, & + later_index, & + later, & + determinant) + + write(*,*) "Leaving 'qmckl_sm_splittinig_core_doc'" + +end function qmckl_sm_splitting_core_doc +#+end_src + *** C headers (exposed in qmckl.h) #+CALL: generate_c_header(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname=get_value("Name")) @@ -1221,7 +1282,7 @@ qmckl_exit_code qmckl_sm_splitting_core( if (LDS == (1+(Dim-1)/SIMD_LENGTH)*SIMD_LENGTH) { // Most cases switch (Dim) { <> - case default: { + default: { assert(0 == 1 && "TEMPLATE NOT IMPLEMENTED!"); break; } @@ -1243,20 +1304,7 @@ qmckl_exit_code qmckl_sm_splitting_core( determinant); } #else - // return qmckl_sm_splitting_core_doc( - // context, - // LDS, - // Dim, - // N_updates, - // Updates, - // Updates_index, - // breakdown, - // Slater_inv, - // later_updates, - // later_index, - // later, - // determinant); - return qmckl_sm_splitting_core_hpc( + return qmckl_sm_splitting_core_doc( context, LDS, Dim, @@ -1446,7 +1494,7 @@ integer recursive function qmckl_sm_splitting_doc_f( & integer*8 , intent(in) :: lds, dim integer*8 , intent(in) :: nupdates integer*8 , intent(in) :: updates_index(nupdates) - real*8 , intent(in) :: upds(nupdates * lds) + real*8 , intent(in) :: upds(lds * nupdates) real*8 , intent(in) :: breakdown real*8 , intent(inout) :: s_inv(dim * lds) real*8 , intent(inout) :: determinant @@ -1455,7 +1503,9 @@ integer recursive function qmckl_sm_splitting_doc_f( & integer*8 :: Later integer*8 , dimension(nupdates) :: Later_index - real*8 , dimension(nupdates * lds) :: Later_updates + real*8 , dimension(lds * nupdates) :: Later_updates + + write(*,*) "Entering 'qmckl_sm_splitting_doc_f'" info = QMCKL_FAILURE @@ -1495,6 +1545,8 @@ integer recursive function qmckl_sm_splitting_doc_f( & info = QMCKL_SUCCESS + write(*,*) "Leaving 'qmckl_sm_splitting_doc_f'" + end function qmckl_sm_splitting_doc_f #+end_src @@ -1520,16 +1572,21 @@ integer(c_int32_t) function qmckl_sm_splitting_doc & integer (c_int64_t) , intent(in) , value :: LDS integer (c_int64_t) , intent(in) , value :: Dim integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) + real (c_double ) , intent(in) :: Updates(LDS*N_updates) integer (c_int64_t) , intent(in) :: Updates_index(N_updates) real (c_double ) , intent(in) , value :: breakdown real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) real (c_double ) , intent(inout) :: determinant integer(c_int32_t), external :: qmckl_sm_splitting_doc_f + + write(*,*) "Entering 'qmckl_sm_splitting_doc'" + info = qmckl_sm_splitting_doc_f & (context, LDS, Dim, N_updates, Updates, Updates_index, breakdown, Slater_inv, determinant) + write(*,*) "Leaving 'qmckl_sm_splitting_doc'" + end function qmckl_sm_splitting_doc #+end_src @@ -1672,6 +1729,8 @@ qmckl_exit_code qmckl_sm_splitting( const double breakdown, double* Slater_inv, double* determinant) { + + printf("Entering 'qmckl_sm_splitting'\n"); if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { return qmckl_failwith( @@ -1680,7 +1739,7 @@ qmckl_exit_code qmckl_sm_splitting( "qmckl_sm_splitting", NULL); } - #ifdef HAS_HPC + #ifdef HAVE_HPC return qmckl_sm_splitting_hpc( context, LDS, @@ -1702,18 +1761,10 @@ qmckl_exit_code qmckl_sm_splitting( breakdown, Slater_inv, determinant); - // return qmckl_sm_splitting_hpc( - // context, - // LDS, - // Dim, - // N_updates, - // Updates, - // Updates_index, - // breakdown, - // Slater_inv, - // determinant); #endif + printf("Leaving 'qmckl_sm_splitting'\n"); + return QMCKL_SUCCESS; } #+end_src From 1640eb60f97b1574af22dae982ee06edb942fdd9 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 27 Feb 2023 11:29:01 +0100 Subject: [PATCH 29/30] Changed argument order. --- org/qmckl_sherman_morrison_woodbury.org | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index 36e62bc..efe10fc 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -790,11 +790,11 @@ If the determinant is passed it will only be partially updated if there were any | ~LDS~ | ~uint64_t~ | in | Leading dimension of Slater_inv | | ~Dim~ | ~uint64_t~ | in | Dimension of Slater_inv | | ~N_updates~ | ~uint64_t~ | in | Number of rank-1 updates to be applied to Slater_inv | -| ~Updates~ | ~double[N_updates*LDS]~ | in | Array containing the rank-1 updates | +| ~Updates~ | ~double[LDS*N_updates]~ | in | Array containing the rank-1 updates | | ~Updates_index~ | ~uint64_t[N_updates]~ | in | Array containing positions of the rank-1 updates | | ~breakdown~ | ~double~ | in | Break-down parameter on which to fail or not | | ~Slater_inv~ | ~double[Dim*LDS]~ | inout | Array containing the inverse Slater-matrix | -| ~later_updates~ | ~double[N_updates*LDS]~ | inout | Array containing the split updates for later | +| ~later_updates~ | ~double[LDS*N_updates]~ | inout | Array containing the split updates for later | | ~later_index~ | ~uint64_t[N_updates]~ | inout | Array containing the positions of the split updates for later | | ~later~ | ~uint64_t~ | inout | Number of split updates for later | | ~determinant~ | ~double~ | inout | Determinant of the Slater-matrix | @@ -928,11 +928,11 @@ end function qmckl_sm_splitting_core_doc_f #+end_src **** C interface to the pedagogical kernel (not directly exposed) -The following Fortran function ~qmckl_sm_splitting_core_doc~ makes sure -that the pedagogical kernel ~qmckl_sm_splitting_core_doc_f~, written in -Fortran, can be called from C using the ~ISO_C_BINDING~. The Fortran function -~qmckl_sm_splitting_core_doc~ will be exposed in the header file 'qmckl.h' -for C users and in the module file 'qmckl_f.F90' for Fortran users. +The function ~qmckl_sm_splitting_core_doc~ makes sure that +~qmckl_sm_splitting_core_doc_f~ can be called from C using the +~ISO_C_BINDING~. Function ~qmckl_sm_splitting_core_doc~ will be +exposed in ~qmckl.h~ and ~qmckl_f.F90~, but +~qmckl_sm_splitting_core_doc_f~ will not. #+CALL: generate_c_interface(table=qmckl_sm_splitting_core_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_core_doc") @@ -960,19 +960,16 @@ integer(c_int32_t) function qmckl_sm_splitting_core_doc & integer (c_int64_t) , intent(in) , value :: LDS integer (c_int64_t) , intent(in) , value :: Dim integer (c_int64_t) , intent(in) , value :: N_updates - real (c_double ) , intent(in) :: Updates(N_updates*LDS) + real (c_double ) , intent(in) :: Updates(LDS*N_updates) integer (c_int64_t) , intent(in) :: Updates_index(N_updates) real (c_double ) , intent(in) , value :: breakdown real (c_double ) , intent(inout) :: Slater_inv(Dim*LDS) - real (c_double ) , intent(inout) :: later_updates(N_updates*LDS) + real (c_double ) , intent(inout) :: later_updates(LDS*N_updates) integer (c_int64_t) , intent(inout) :: later_index(N_updates) integer (c_int64_t) , intent(inout) :: later real (c_double ) , intent(inout) :: determinant integer(c_int32_t), external :: qmckl_sm_splitting_core_doc_f - - write(*,*) "Entering 'qmckl_sm_splittinig_core_doc'" - info = qmckl_sm_splitting_core_doc_f & (context, & LDS, & @@ -987,8 +984,6 @@ integer(c_int32_t) function qmckl_sm_splitting_core_doc & later, & determinant) - write(*,*) "Leaving 'qmckl_sm_splittinig_core_doc'" - end function qmckl_sm_splitting_core_doc #+end_src From b01c7c306be0ef4d8c544654c59dc41bc8ae6a3f Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Mon, 27 Feb 2023 12:04:04 +0100 Subject: [PATCH 30/30] Done with splitting doc. --- org/qmckl_sherman_morrison_woodbury.org | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index efe10fc..4ddd949 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -371,7 +371,7 @@ include situations where one wants to apply updates to a square submatrix of the full matrix. It takes advantage of memory aligned data and assumes no data dependencies inside the loops. The loops are fully vectorised whenever ~Dim~ is an integer -multiple of ~SIMD_LEGTH~. +multiple of ~SIMD_LENGTH~. #+begin_src c :tangle (eval c) :comments org qmckl_exit_code qmckl_sm_naive_hpc( const qmckl_context context, @@ -525,9 +525,9 @@ text=""" result = [] for Dim in <>: Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) + result.append(text.replace("{Dim}",Dim)) -return '\n'.join(result) +return ''.join(result) #+end_src Python script that generated C switch cases that call individual kernel instances. @@ -541,14 +541,13 @@ case {Dim}: Updates_index, breakdown, Slater_inv, - determinant); -""" + determinant);""" result = [] for Dim in <>: Dim=str(Dim) - result.append(text.replace("{Dim}",Dim) ) + result.append(text.replace("{Dim}",Dim)) -return '\n'.join(result) +return ''.join(result) #+end_src #+begin_src c :tangle (eval c) :comments org :noweb yes @@ -1225,7 +1224,7 @@ for Dim in <>: Dim=str(Dim) result.append(text.replace("{Dim}",Dim) ) -return '\n'.join(result) +return ''.join(result) #+end_src #+NAME:slagel_splitting_switch-case_generator @@ -1244,14 +1243,13 @@ case {Dim}: { later, determinant); break; -} -""" +}""" result = [] for Dim in <>: Dim=str(Dim) result.append(text.replace("{Dim}",Dim) ) -return '\n'.join(result) +return ''.join(result) #+end_src #+begin_src c :tangle (eval c) :comments org :noweb yes @@ -1603,10 +1601,10 @@ qmckl_exit_code qmckl_sm_splitting ( double* determinant ); #+end_src -#+CALL: generate_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_hpc") +#+CALL: generate_private_c_header(table=qmckl_sm_splitting_args,rettyp=get_value("CRetType"),fname="qmckl_sm_splitting_hpc") #+RESULTS: -#+begin_src c :tangle (eval h_func) :comments org +#+begin_src c :tangle (eval h_private_func) :comments org qmckl_exit_code qmckl_sm_splitting_hpc ( const qmckl_context context, const uint64_t LDS,