diff --git a/org/qmckl_jastrow.org b/org/qmckl_jastrow.org index 3070ca3..c5856ef 100644 --- a/org/qmckl_jastrow.org +++ b/org/qmckl_jastrow.org @@ -4843,8 +4843,6 @@ integer function qmckl_compute_een_rescaled_e_doc_f( & double precision :: x integer*8 :: i, j, k, l, nw - allocate(een_rescaled_e_ij(elec_num * (elec_num - 1) / 2, cord_num + 1)) - info = QMCKL_SUCCESS if (context == QMCKL_NULL_CONTEXT) then @@ -4867,6 +4865,8 @@ integer function qmckl_compute_een_rescaled_e_doc_f( & return endif + allocate(een_rescaled_e_ij(elec_num * (elec_num - 1) / 2, cord_num + 1)) + ! Prepare table of exponentiated distances raised to appropriate power een_rescaled_e = 0.0d0 do nw = 1, walk_num @@ -4965,18 +4965,6 @@ qmckl_exit_code qmckl_compute_een_rescaled_e_hpc ( const double* ee_distance, double* const een_rescaled_e ) { - double *een_rescaled_e_ij; - double x; - const int64_t elec_pairs = (elec_num * (elec_num - 1)) / 2; - const int64_t len_een_ij = elec_pairs * (cord_num + 1); - int64_t k; - - // number of element for the een_rescaled_e_ij[N_e*(N_e-1)/2][cord+1] - // probably in C is better [cord+1, Ne*(Ne-1)/2] - //elec_pairs = (elec_num * (elec_num - 1)) / 2; - //len_een_ij = elec_pairs * (cord_num + 1); - een_rescaled_e_ij = (double *) malloc (len_een_ij * sizeof(double)); - if (context == QMCKL_NULL_CONTEXT) { return QMCKL_INVALID_CONTEXT; } @@ -5000,6 +4988,23 @@ qmckl_exit_code qmckl_compute_een_rescaled_e_hpc ( een_rescaled_e[kk]= 0.0; } + double x; + const int64_t elec_pairs = (elec_num * (elec_num - 1)) / 2; + const int64_t len_een_ij = elec_pairs * (cord_num + 1); + int64_t k; + + // number of elements for the een_rescaled_e_ij[N_e*(N_e-1)/2][cord+1] + // probably in C is better [cord+1, Ne*(Ne-1)/2] + // elec_pairs = (elec_num * (elec_num - 1)) / 2; + // len_een_ij = elec_pairs * (cord_num + 1); + double* een_rescaled_e_ij = (double *) malloc (len_een_ij * sizeof(double)); + if (een_rescaled_e_ij == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_compute_een_rescaled_e_hpc", + NULL); + } + /* for (int nw = 0; nw < walk_num; ++nw) { for (int l = 0; l < (cord_num + 1); ++l) {