From 2f0ca9f674d93d2b64507935788a5e23a85671cb Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 14 Feb 2024 11:26:10 +0100 Subject: [PATCH] Improved Jastrow --- org/qmckl_jastrow_champ.org | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/org/qmckl_jastrow_champ.org b/org/qmckl_jastrow_champ.org index c3751756..44b4a2ba 100644 --- a/org/qmckl_jastrow_champ.org +++ b/org/qmckl_jastrow_champ.org @@ -6177,19 +6177,22 @@ qmckl_exit_code qmckl_compute_een_rescaled_e_hpc ( const size_t e2 = elec_num*elec_num; #ifdef HAVE_OPENMP -#pragma omp parallel for +#pragma omp parallel #endif - for (size_t nw = 0; nw < (size_t) walk_num; ++nw) { - - memset(&een_rescaled_e[nw*(cord_num+1)*elec_num*elec_num],0,(cord_num+1)*elec_num*elec_num*sizeof(double)); - - double* restrict een_rescaled_e_ij = malloc(len_een_ij*sizeof(double)); + { + double* restrict een_rescaled_e_ij = calloc(len_een_ij,sizeof(double)); - memset(&(een_rescaled_e_ij[0]),0,len_een_ij*sizeof(double)); for (size_t kk = 0; kk < elec_pairs ; ++kk) { een_rescaled_e_ij[kk]= 1.0; } +#ifdef HAVE_OPENMP +#pragma omp for +#endif + for (size_t nw = 0; nw < (size_t) walk_num; ++nw) { + + memset(&een_rescaled_e[nw*(cord_num+1)*elec_num*elec_num],0,(cord_num+1)*elec_num*elec_num*sizeof(double)); + size_t kk = 0; for (size_t i = 0; i < (size_t) elec_num; ++i) { double* restrict ee1 = &een_rescaled_e_ij[kk + elec_pairs]; @@ -6257,8 +6260,9 @@ qmckl_exit_code qmckl_compute_een_rescaled_e_hpc ( } } - free(een_rescaled_e_ij); } + free(een_rescaled_e_ij); + } // OpenMP return QMCKL_SUCCESS; }